Examples of HmBattery


Examples of org.openhab.binding.homematic.internal.model.HmBattery

  /**
   * Adds the battery info datapoint to the specified device if the device has
   * batteries.
   */
  protected void addBatteryInfo(HmDevice device) throws HomematicClientException {
    HmBattery battery = HmBatteryTypeProvider.getBatteryType(device.getType());
    if (battery != null) {
      for (HmChannel channel : device.getChannels()) {
        if ("0".equals(channel.getNumber())) {
          try {
            logger.debug("Adding battery type to device {}: {}", device.getType(), battery.getInfo());
            HmDatapoint dp = new HmDatapoint();
            FieldUtils.writeField(dp, "name", "BATTERY_TYPE", true);
            FieldUtils.writeField(dp, "writeable", Boolean.FALSE, true);
            FieldUtils.writeField(dp, "valueType", 20, true);
            dp.setValue(battery.getInfo());
            channel.addDatapoint(dp);
          } catch (IllegalAccessException ex) {
            throw new HomematicClientException(ex.getMessage(), ex);
          }
        }
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.