db_88
1
Hi.
i want to use the battery state on danalock in autmation but i cant seem to get the state.
when i use sensor templet i get nothing:
batteri_danalock:
friendly_name: "batteri_danalock"
value_template: "{{states.zwave.polycontrol_danalock_v3_btze_7.battery_level}}"
is it because it is not a sensor but a Zwave entity?
Tinkerer
(aka DubhAd on GitHub)
2
That’s an attribute, which is why it isn’t showing up that way. Try this instead:
- platform: template
sensors:
batteri_danalock:
entity_id: zwave.polycontrol_danalock_v3_btze_7
value_template: "{{ state_attr('zwave.polycontrol_danalock_v3_btze_7', 'battery_level')|int }}"
device_class: battery
unit_of_measurement: '%'
This will also give you pretty graphs, and the icon will update to reflect the battery level.