Hue sensor temperature adjustment

Hi All,

I have a couple of Hue motion sensors and their temperature sensors read a couple of degrees out from the correct temperature so I am trying to adjust them. From reading various other topics I came up with this

sensor.sensor_hall_front_temperature:
  battery_level: 40
  device_class: temperature
  unit_of_measurement: °C
  value_template: {{ (states('sensor.sensor_hall_front_temperature') | float + 2.8) | round(2)  }}

If I try this in the Template test section it gives me the adjusted temperature. However, adding it to my customize.yaml it doesn’t work and, when I reboot, triggers safe mode.

If I remove the value_template line it correctly adjusts the battery level so I know the basic customization is working.

The logs show:

invalid key: "OrderedDict([("(states('sensor.sensor_hall_front_temperature') | float + 2.8) | round(2)", None)])" in "/config/customize.yaml", line 5, column 0
19:58:42 – Home Assistant Core Integration (ERROR)
invalid key: "OrderedDict([("(states('sensor.sensor_hall_front_temperature') | float + 2.8) | round(2)", None)])" in "/config/customize.yaml", line 5, column 0
19:58:42 – util/yaml/loader.py (ERROR)

Any help would be great, thanks

Welcome.

templates aren’t allowed in the customize section and you can’t modify values on existing sensors. However, you can create a new sensor based off the existing sensor that has the desired value. To do this, use a template sensor. Also, don’t forget to wrap all single line templates in quotes.

sensor:
- platform: template
  sensors:
    modified_sensor_hall_front_temperature:
      friendly_name: Hall Temperature
      unit_of_measurement: °C
      value_template: "{{ (states('sensor.sensor_hall_front_temperature') | float + 2.8) | round(2)  }}"
1 Like

Thanks, that works great.
Out of curiosity, how do I add these to an area and hide the original sensors with the incorrect temperature? I can’t see anywhere that lets you do that in the GUI and my attempts to do it in the config files ended up in errors.