Package org.openhab.binding.omnilink.internal.model

Examples of org.openhab.binding.omnilink.internal.model.Unit


    logger.debug("Trying to match command to object type "
        + config.getObjectType());
   
    switch (config.getObjectType()) {
    case UNIT: {
      Unit unit = (Unit) config.getDevice();
      boolean resendToChildren = false;
      if (command == OnOffType.ON) {
        cmd = OmniLinkCmd.CMD_UNIT_ON.getNumber();
      } else if (command == OnOffType.OFF) {
        cmd = OmniLinkCmd.CMD_UNIT_OFF.getNumber();
      } else if (command == IncreaseDecreaseType.INCREASE) {
        cmd = OmniLinkCmd.CMD_UNIT_UPB_BRIGHTEN_STEP_1.getNumber();
        resendToChildren = true;
      } else if (command == IncreaseDecreaseType.DECREASE) {
        cmd = OmniLinkCmd.CMD_UNIT_UPB_DIM_STEP_1.getNumber();
        resendToChildren = true;
      } else if (command instanceof PercentType) {
        int level = ((PercentType) command).intValue();
        if (level == 0 || level == 100) {
          cmd = level == 0 ? OmniLinkCmd.CMD_UNIT_OFF.getNumber()
              : OmniLinkCmd.CMD_UNIT_ON.getNumber();
        } else {
          cmd = OmniLinkCmd.CMD_UNIT_PERCENT.getNumber();
          param1 = level;
          resendToChildren = true;
        }
      } else if (command instanceof StringType
          && unit.getProperties().getUnitType() == UnitProperties.UNIT_TYPE_HLC_ROOM) {
        int roomNum = (unit.getProperties().getNumber() + 7) / 8;
        // every room has 6 links, the 3rd is where link A starts,
        // so in room 1 linkA=link3 linkB=link4 linkc=link6 linkd=link7
        String str = ((StringType) command).toString().toLowerCase();
        int linkNum = 0;
        if (str.contains("scene a"))
          linkNum = 0;
        else if (str.contains("scene b"))
          linkNum = 1;
        else if (str.contains("scene c"))
          linkNum = 2;
        else if (str.contains("scene d"))
          linkNum = 3;
        else
          break;
        param1 = 0;
        param2 = ((roomNum * 6) - 3) + linkNum;
        cmd = OmniLinkCmd.CMD_UNIT_UPB_LINK_ON.getNumber();
      }
      // if this is a room, send the command to all the other units
      if (resendToChildren
          && unit.getProperties().getUnitType() == UnitProperties.UNIT_TYPE_HLC_ROOM) {
        for (int i = unit.getProperties().getNumber() + 1; i < unit
            .getProperties().getNumber() + 8; i++) {
          commands.add(new OmniLinkControllerCommand(cmd, param1, i));
        }
      } else {
        commands.add(new OmniLinkControllerCommand(cmd, param1, param2));
View Full Code Here


          for (OmniLinkBindingProvider provider : providers) {
            switch (config.getObjectType()) {
            case UNIT: {
              UnitProperties p = readUnitProperties(config
                  .getNumber());
              Unit unit = unitMap.get(number);
              if (unit == null) {
                unit = new Unit(p);
                unitMap.put(number, unit);
              }
              config.setDevice(unit);
              unit.setProperties(p);
              unit.updateItem(provider.getItem(itemName), config,
                  eventPublisher);
            }
              break;
            case THERMO_COOL_POINT:
            case THERMO_FAN_MODE:
View Full Code Here

        status.getClass());
   
    Integer number = new Integer(status.getNumber());
   
    if (status instanceof UnitStatus && unitMap.containsKey(number)) {
      Unit unit = unitMap.get(number);
      unit.getProperties().updateUnit((UnitStatus) status);
      updateItemsForDevice(unit);
    } else if (status instanceof ThermostatStatus
        && thermostatMap.containsKey(number)) {
      logger.debug("Updating thermo " + number);
      Thermostat thermo = thermostatMap.get(number);
View Full Code Here

TOP

Related Classes of org.openhab.binding.omnilink.internal.model.Unit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.