Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battery levels as own entities #42

Closed
embeddeddev opened this issue Sep 6, 2019 · 2 comments · Fixed by home-assistant/core#26591
Closed

Battery levels as own entities #42

embeddeddev opened this issue Sep 6, 2019 · 2 comments · Fixed by home-assistant/core#26591
Assignees

Comments

@embeddeddev
Copy link

embeddeddev commented Sep 6, 2019

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.

@Kane610
Copy link
Owner

Kane610 commented Sep 11, 2019

Yes, this will happen.

@embeddeddev
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants