Philips Hue Motion Sensor Battery Level

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

I have a Hue hub as well.

Developer tools > stat shows this:

This is the code I entered:

2021-06-02 16_41_16-File editor - Home Assistant

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

Why don‘t you use the sensor.xxxxxxxx_battery_level and put it in a lovelace card?

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?

Because he said “Entity not available”

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.

Yes

image

Only in identitys are only the motion sensors. Not the battery level sensors

Are all entities displayed?(top most right: the upside down “pyramid”). I ask precautionary because you said you are new to HA.

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.

  1. hall (hal)
  2. kitchen (keuken)
  3. toilet (toilet)
  4. garden (tuin)

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

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.

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') }}"