oneufus
(Rob)
June 2, 2021, 11:26am
1
Hello all!
I am looking for the right configuration to display the battery status of my Philips Hue motion sensors on my Lovelace dashboard. I searched this forum and found two threads. Neither of them have really helped me yet.
My system:
Home Assistant 2021.5.5
Raspberry Pi 4 4GB with SSD
Conbee II zigbee stick
Z-Wave.Me stick
Who can help me with the right steps?
Thanks in advance!
I have this as a sensor but I am using a Hue hub.
platform: attributes
attribute: battery_level
unit_of_measurement: "%"
entities:
- sensor.back_yard_light_level
- sensor.front_yard_light_level
- sensor.kitchen_sensor_light_level
- sensor.lounge_sensor_light_level
- sensor.shed_light_level
- sensor.toilet_sensor_light_level
Edit: Check the developer tools > state page to see if your setup has the battery as an attribute on the motion sensor.
battery_level: 100
sensitivity: 0
sensitivity_max: 4
friendly_name: Back yard motion
device_class: motion
oneufus
(Rob)
June 2, 2021, 2:53pm
4
I have a Hue hub as well.
Developer tools > stat shows this:
oneufus
(Rob)
June 2, 2021, 2:53pm
5
This is the code I entered:
oneufus
(Rob)
June 2, 2021, 2:54pm
6
When I did a configuration validation I get this message:
guess this was used GitHub - pilotak/homeassistant-attributes: Breaks out specified attribute from other entities to a sensor
by lunatic as a custom integration
but you can do without that and use core template sensors
sensor:
- platform: template
sensors:
front_room_motion_sensor_battery:
friendly_name: Front room battery
value_template: >
{{state_attr('binary_sensor.front_room_sensor_motion','battery_level')}}
note this it the ‘legacy’ format for template sensors, you can rewrite this in the new template:
format
1 Like
pedolsky
(Pedolsky)
June 2, 2021, 3:41pm
8
Why don‘t you use the sensor.xxxxxxxx_battery_level
and put it in a lovelace card?
oneufus
(Rob)
June 2, 2021, 4:23pm
9
Thanks guys for willing to help me. But I am a newby. I need a step by step explanation. The steps I have taken above lead to an error. What else should I do?
oneufus
(Rob)
June 2, 2021, 4:49pm
10
Because he said “Entity not available”
pedolsky
(Pedolsky)
June 2, 2021, 5:08pm
11
Is it activated?
Settings —> integrations —> Philips Hue —> entities
or
Settings —> entities —> search
What file did you add it to?
Yes I was thinking I missed something else that enabled this but couldn’t remember what it was.
oneufus
(Rob)
June 2, 2021, 7:46pm
14
Yes
Only in identitys are only the motion sensors. Not the battery level sensors
pedolsky
(Pedolsky)
June 2, 2021, 8:22pm
15
Are all entities displayed?(top most right: the upside down “pyramid”). I ask precautionary because you said you are new to HA.
oneufus
(Rob)
June 3, 2021, 8:33am
16
I hope I understand you correctly, but my list of identities includes my motion sensors from hue. I have a total of 4 motion sensors.
hall (hal)
kitchen (keuken)
toilet (toilet)
garden (tuin)
Troon
(Troon)
June 3, 2021, 10:57am
18
You need to edit configuration.yaml
, which I think you tried to do before, but you didn’t say where that screenshot was from. Add the following lines at the end of the file:
template:
- sensor:
- name: "Keuken sensor battery level"
unit_of_measurement: "%"
device_class: battery
state: "{{ state_attr('binary_sensor.keuken_sensor_motion', 'battery_level') }}"
- sensor:
- name: "Hal sensor battery level"
unit_of_measurement: "%"
device_class: battery
state: "{{ state_attr('binary_sensor.hal_sensor_motion', 'battery_level') }}"
Then restart HA and you should have a sensor.keuken_sensor_battery_level
and another for hal
that you can add to Lovelace. You can work out how to add the other two.
3 Likes
oneufus
(Rob)
June 3, 2021, 12:49pm
19
Thank you very much! With this configuration everything works perfectly. I can now add all sensors to my Lovelace dashboard. Thanks again!
yeah that is what I suggested here before. He needs the template sensors.
btw, you don’t need the - sensor:
on each entity, a single key suffices.
Troon
(Troon)
June 3, 2021, 12:58pm
21
Yes, I know: your recommendation was getting lost in a lot of chatter though!
Good catch on the format, this will also work:
template:
- sensor:
- name: "Keuken sensor battery level"
unit_of_measurement: "%"
device_class: battery
state: "{{ state_attr('binary_sensor.keuken_sensor_motion', 'battery_level') }}"
- name: "Hal sensor battery level"
unit_of_measurement: "%"
device_class: battery
state: "{{ state_attr('binary_sensor.hal_sensor_motion', 'battery_level') }}"