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.
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.
- 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…
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 !!
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 ?
I’ve just found this: value_template: "{{ states('sensor.entry_motion_sensor_temperature') | round|int }}"
… the question still remain, can I integrate the two ?
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
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.
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.