Kane610/deconz

Battery levels as own entities

Closed this issue · 2 comments

Unfortunalety the battery levels of devices like Philips motion sensor and Xiaomi/Aqara ambience, door/window and vibration sensors are modelled only as attributes named {{battery_level}} of their sensor values/entities like temperature and humidity so they aren't directly accessible as own entities in Home Assistant and need to be integrated complicatedly and error-prone by using template sensors like following snippet demonstrates:

- platform: template
  sensors:
    amb_battery:
      device_class: battery
      unit_of_measurement: '%'
      value_template: >
        {% if is_state('sensor.amb_temp', 'unknown') %}
          110
        {% else %}
          {{ states.sensor.amb_temp.attributes["battery_level"] | float}}
        {% endif %}

Contrary ZHA component of Home Assistent directly exports these battery levels correctly as own entities.

In addition current implementation provides the values redundantly for each entity/value of a single device but in fact its only one unique device entity/value which should be exposed as such one.

Note:
In my setup only battery levels of IKEA devices are exposed correctly since these provide "Power Consumption" ZigBee cluster

Looking forward to receive a reply.

Yes, this will happen.

Just saw in the current 0.100 change log that the feature has been integrated.
Thanks a lot for your quick and uncomplicated support!