Package org.openhab.core.library.types

Examples of org.openhab.core.library.types.PercentType.intValue()


  @Override
  public Object commandToBinding(Command command, HmValueItem hmValueItem) {
    if (command.getClass() == IncreaseDecreaseType.class) {
      PercentType type = convertFromBinding(hmValueItem);

      int percent = type.intValue();
      percent += command.equals(IncreaseDecreaseType.INCREASE) ? 10 : -10;
      percent = (percent / 10) * 10;
      percent = Math.min(100, percent);
      percent = Math.max(0, percent);
      return convertToBinding(new PercentType(percent), hmValueItem);
View Full Code Here


    PercentType oldPercent = getCurrentState(bulb, bridgeId, type);
    if(oldPercent.equals(PercentType.ZERO)) sendOn(bulb, bridgeId);
    try {
      if (bulb < 6) {
        if (command.compareTo(oldPercent) > 0) {
          int repeatCount = (command.intValue() - oldPercent.intValue()) / 10;
          for(int i = 0; i <= repeatCount; i++) {
            Thread.sleep(100);
            if(BindingType.brightness.equals(type) && bulb < 6) {
              sendIncrease(bulb, rgbwSteps, bridgeId);
            } else if(BindingType.colorTemperature.equals(type)) {
View Full Code Here

            } else if(BindingType.discoMode.equals(type)) {
              sendDiscoModeUp(bulb, bridgeId);
            }
          }
        } else if (command.compareTo(oldPercent) < 0) {
          int repeatCount = (oldPercent.intValue() - command.intValue()) / 10;
          for(int i = 0; i <= repeatCount; i++) {
            Thread.sleep(100);
            if(BindingType.brightness.equals(type) && bulb < 6) {
              sendDecrease(bulb, rgbwSteps, bridgeId);
            } else if(BindingType.colorTemperature.equals(type)) {
View Full Code Here

          volume = new PercentType(((Double)o).intValue());
        }
      }
      
      updateProperty("Application.Volume", volume);
      this.volume = new BigDecimal(volume.intValue());
    }

  }

  private void processSystemStateChanged(String method, Map<String, Object> json) {
View Full Code Here

    PercentHandler(DeviceFeature f) { super(f); }
    @Override
    public void handleCommand(InsteonPLMBindingConfig conf, Command cmd, InsteonDevice dev) {
      try {
        PercentType pc = (PercentType)cmd;
        logger.debug("changing level of {} to {}", dev.getAddress(), pc.intValue());
        int level = (pc.intValue()*255)/100;
        if (level > 0) { // make light on message with given level
          Msg m = dev.makeStandardMessage((byte) 0x0f, (byte) 0x11, (byte) level);
          dev.enqueueMessage(m, m_feature);
          logger.info("PercentHandler: sent msg to set {} to {}", dev.getAddress(), level);
View Full Code Here

    @Override
    public void handleCommand(InsteonPLMBindingConfig conf, Command cmd, InsteonDevice dev) {
      try {
        PercentType pc = (PercentType)cmd;
        logger.debug("changing level of {} to {}", dev.getAddress(), pc.intValue());
        int level = (pc.intValue()*255)/100;
        if (level > 0) { // make light on message with given level
          Msg m = dev.makeStandardMessage((byte) 0x0f, (byte) 0x11, (byte) level);
          dev.enqueueMessage(m, m_feature);
          logger.info("PercentHandler: sent msg to set {} to {}", dev.getAddress(), level);
        } else { // switch off
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.