Philips Hue Motion Sensor Battery Level

Mariusthvdb’s suggestion required a few more adaptations on my part. I probably did something wrong there and it didn’t work.

Troon gave me code with my sensor descriptions already pasted in. When I pasted it into my config file, everything suddenly worked.

Thanks again!

I don’t mean to hijack a thread, but I have been working thru some similar issues with Hue myself. With the coding above, would a ‘change’ in battery level be reported back as an ‘event’ by these sensors?

It would drive a state change in these template sensors the next time that the Hue system sent through a new data set. You could use that to trigger an automation if you wanted to.

My sensor stats in mobile Lovelace dashboard

I only think that temp stats are not very aqurate.

I guess that is my point. Those ‘state changes’ would not be automatic, since i don’t believe the Hue device reports back to HA. But HA does apparently ‘poll’ or check temperature and Lux level periodically, since a chart appears for the in the ‘History’ screen at the bottom.

correct, most of the time they are way off :wink:

thats why I created calibrated temp sensors:

      dining_table_sensor_calibrated_temperature:
        friendly_name: Dining table calibr temp
        value_template: >
          {{(states('sensor.dining_table_sensor_temperature')|float +
             states('input_number.temp_calibration')|float)|round(2)}}

input_number set at 1.7 makes them come close to the thermostats in the house…

that has been changed with this edition / update! HUE now pushes state changes, and they are immediate. which is a huge improvement and we’ve all been looking out for that.

2 Likes

Is this the complete code? Can I put this code below my batt sensor code?

yes, it is a template sensor, just like the others. It is the legacy format, and if you dont have that yet (you copied the new format template: above), you also need the sensor: key as I showed here Philips Hue Motion Sensor Battery Level - #7 by Mariusthvdb

sensor:

  - platform: template
    sensors:
      dining_table_sensor_calibrated_temperature:
        friendly_name: Dining table calibr temp
        value_template: >
          {{(states('sensor.dining_table_sensor_temperature')|float +
             states('input_number.temp_calibration')|float)|round(2)}}

and of course edit the names.

I would advise you to start understanding what you are doing, and read some documentation. Start with the configuration.yaml and template: documentation. this is all very basic, and you should try to grasp it for your own sake :wink:

we’re here to help though

1 Like

How does one now take advantage of this? Is there a specific area in the documentation? Since I believe what I currently have for Hue is a ‘hack’ I came up with, I’d like to understand how the new feature works.

Thank you. I really appreciate. I will do some research to learn the basics. I really enjoy working on this.

all is done in the backend, and makes HUE integration push its changes, where before HA needed to poll every 5 seconds. This means all changes now are immediate, and known to HA.

You don’t need to do anything.

You can catch the HUE events and use these in automations. Before, they could be not responsive enough for motion sensor automations, or remote switch button pushes. These will now act swiftly, so you can actually use them :wink:

if you want more info, check the YouTube release party video, where Paulus talks about this at the start

2 Likes

From what I can tell, it looks to me like the only thing that changed is the ‘motion’ detection is now pretty much instantaneous. Unfortunately I do not make use of the motion detection feature. :frowning:

well, there’s more to life than you can tell… just try the color wheel on a HUE light, it’s instantaneous now.
As I explained above, HUE integration went from HA Poll to HUE Push, which is huge and effective throughout the full integration.

1 Like

I’m trying to understand it, but for that I really need to read more :grinning: I understand the concepts of legacy and new template format. But I still don’t quite understand where and how to rewrite this.

I have now pasted the above code into configuration.yaml. The code has been validated but I don’t see any change in my temperature. What can I do?

This is my code:

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

       - name: "Toilet sensor battery level"
         unit_of_measurement: "%"
         device_class: battery
         state: "{{ state_attr('binary_sensor.toilet_sensor_motion', 'battery_level') }}"

       - name: "Tuin sensor battery level"
         unit_of_measurement: "%"
         device_class: battery
         state: "{{ state_attr('binary_sensor.tuin_sensor_motion', 'battery_level') }}"
         
sensor:

  - platform: template
    sensors:
      keuken_sensor_calibrated_temperature:
        friendly_name: Keuken calibr temp
        value_template: >
          {{(states('sensor.keuken_sensor_temperature')|float +
             states('input_number.temp_calibration')|float)|round(2)}}

do you have an input_number.temp_calibration? probably not :wink:

of course you need to create that too. hint: Input Number - Home Assistant

have a look, try to create that, and report back.

Your new sensor converted to new format for consistency — put it below the Tuin sensor in place of the sensor: block.

      - name: "Keuken sensor calibrated temperature"
        state: >
            {{ (states('sensor.keuken_sensor_temperature')|float + 
                states('input_number.temp_calibration')|float)|round(2) }}
1 Like

You put me to work :grinning:

I made this:

check the entity_id… and name for that matter
simply name it Temperature calibration and the system will add the slug ( _ ) and create the entity id as desired

honestly, I never use the UI for creating entities, and write all yaml:

input_number:

  temp_calibration:
    name: Temp calibration
    min: -2
    max: 2.5
    step: 0.1
    icon: mdi:thermostat
    unit_of_measurement: °C

note you have entered the value in the step size field, which is incorrect. You set the value in the Frontend.