Adjusting Hue Motion sensor temperature reading

So I hope this makes sense. I have a hue motion sensor in my kitchen, and for some reason it’s reading the temperature about 2C higher than actual. I’ve other hue motion sensors and have placed them beside the high temp unit and the difference, is always around 2 degrees, give or take a tenth.

What I’d like to do have my system take the reading and reduce it by 2 degrees, so that on screen, it reads similar to my other sensors. Does this make sense? I’m not sure how to go about doing this, and I haven’t found anyone else posting about it. Can anyone help?

tl;dr
Sensor reads +2 degrees above others. Want system to subtract 2 degrees so it displays inline with other sensors.

Sam

2 Likes

You can create a template sensor that subtracts 2 degrees from it and use that instead.

Could you give me an idea how I might do that? I’ve had a quick look at the template sensor docs and can’t quite work out what I need to do. sigh

Sure thing! You’ll want to do something like this:

sensor:
- platform: template
  sensors:
    hue_motion_temp_calibrated:
      friendly_name: "Calibrated Hue motion temp"
      unit_of_measurement: "°C"
      value_template: "{{ float(states('sensor.motion_sensor_temperature')) - 2 }}"

The Hue integration creates three logical sensors for each physical motion sensor (one for light level, motion, and temperature). Change sensor.motion_sensor_temperature to whatever the entity ID is for the Hue motion sensor temperature you’re referring to.

You can also change hue_motion_temp_calibrated and the friendly name to whatever you want.

5 Likes

Perfect, thank you very much. I haven’t tried it yet, but I’l report back
:stuck_out_tongue:

Success! Much thanks

Thanks, this helped me too :slight_smile:

Hi !

Here’s my stab at it :

- platform: template
  sensors:

    # Offset for Hue Motion sensors
    hall0_modect1_temperature:
      friendly_name_template: "{{ state_attr('sensor.hall0_modect1_temperature_raw', 'friendly_name') }}"
      unit_of_measurement: °C
      value_template: "{{ ((states('sensor.hall0_modect1_temperature_raw') | float) + 3.31) | round(2) }}"
      device_class: temperature
      availability_template: "{% if states('sensor.hall0_modect1_temperature_raw') | int %}true{% endif %}"
    hall1_modect1_temperature:
      friendly_name_template: "{{ state_attr('sensor.hall1_modect1_temperature_raw', 'friendly_name') }}"
      unit_of_measurement: °C
      value_template: "{{ ((states('sensor.hall1_modect1_temperature_raw') | float) + 2.7) | round(2) }}"
      device_class: temperature
      availability_template: "{% if states('sensor.hall1_modect1_temperature_raw') | int %}true{% endif %}"

Using the availability_template helps avoiding my temp graphs jumping to 0 sometimes when HA restarts and the template sensor is up before the actual raw sensor…

Hope it helps :slight_smile:

1 Like

Oh my !

Let’s not get ahead of ourselves, but, Philips answered on their forums that they might be considering adding a ZigBee setting to configure the offset directly on the motion sensor !!

1 Like

Thanks very much for this, very useful and has helped me with my first template.

I’m now trying to get rid of all the decimal places, so far I have this in my configuration.yaml:

# Offsets to correct Hue temperature sensors
  - platform: template
    sensors:
      hue_motion_sensor_flat_temperature_offset:
        friendly_name: "Hue Motion Sensor Temperature Flat Offset"
        unit_of_measurement: "°C"
        value_template: "{{ float(states('sensor.hue_motion_sensor_flat_temperature')) +1.3 }}"
      hue_motion_sensor_flat_temperature_offset_no_decimal:
        friendly_name: "Hue Motion Sensor Temperature Flat Offset No Decimal"
        unit_of_measurement: "°C"
        value_template: "{{ '%0.0f'|format(states('sensor.hue_motion_sensor_flat_temperature_offset')|float + 0.0) }}"

I first use your line to correct (offset) the temperature then I use Tom’s line to mimit the decimal places BUT I have no idea what the formulae are doing, I’m just poking and hoping. What does the float + 0.0 at the end do, it was originally 0.7 …

° Is there a better way of doing this ?
° Can the two be combined into one statement ?

Thanks in anticipation … /0^0\

I’ve just found this:
value_template: "{{ states('sensor.entry_motion_sensor_temperature') | round|int }}"
… the question still remain, can I integrate the two ?

(source, by ‘Twit’ — Remove temperature gauge decimal places)

Thanks, creating a new sensor via a template is better than nothing but it’s not ideal. It creates a new entity that’s detached from the Hue device and can’t be assigned to an area, so you still get the uncalibrated temperature showing up everywhere by default. Has anyone found a solution to this?

I think’s it’s somewhat easy to think its just off 2 degrees. I have an accurate jalee BT temperature sensor which has been calibrated from factory. I have 6 hue sensors and put the jalee on top of the sensor and waited an hour to acclimate. I wrote down the temperature of the hue sensor together with the jalee temperature. After I was finished with this I put all the sensors in the fridge together with the jalee and wrote the temperatures again. Now I have two measurements per sensor for every hue sensor with also tow measures from the jalee. I put the figures in iAlgebra. It is already wrong from here that the inaccuracy is lineair but at least we can populate a lineair function based on f(x)=ax+b
See example: 8 degree Jalee = 6,3 degree on Hue and 24 degree Jalee = 27 degree on Hue. Results in f(x)=1,294x - 4,05

Screenshot 2022-09-26 at 01.30.59

Resulting in something like:

      hue_motion_temp_calibrated_garage:
        friendly_name: "Calibrated Hue motion temp garage"
        unit_of_measurement: "°C"
        value_template: "{{ float(states('sensor.hue_garagesensor_temperature')) * 1.294 - 4.05 | round(1) }}"
1 Like

So annoying. Each of the Hue Sensors comes up with a different temperature. I have two right next to each other and they’ve just been sitting there for hours and the difference between them is 1.3 degrees.

I just unboxed two Ecowitt sensors, and they’re reading exactly the same temperature as one another, to one tenth of a degree. Also the exact same humidity reading.

Nobody has mentioned, that in Zigbee2MQTT there is an option to calibrate the value.

Oh wow, I wish that was in Home Assistant natively!

How would you use that if you’re just using native Hue alongside Home Assistant?

My comment was about a possibilty in Z2M. I do not know about Hue hub.

1 Like

You need to use template sensors. It’s a bit of a faff, but it’s what I did way back.
My method was to get a mercury thermometer and place it beside the hue sensor and leave it for 24 hours. Observe the temperature on the thermometer and use that to determine the offset. It does seem that the sensors themselves are reliable, so once you set the offset, you’re good to go. You can use the code below to create the calibrated sensors. Obviously you’ll need to create one for each Hue sensor.

sensor:
  - platform: template
    sensors:
### Hue temperature sensor calibration
#
# Dropping Kitchen 1 temperature reading by 3 degrees to bring it inline with actual temperature.
      kitchen_t_1_calibrated:
        friendly_name: "Kitchen 1 Temperature"
        unit_of_measurement: "°C"
        value_template: "{{ (states('sensor.hue_sensor')|float-3)|round(2) }}"

The important part is float, which will need to be either + or - and the offset.
You can add the code to your config.yaml file.

Wow this is awesome! Thank you so much!!!

1 Like