Temperature template sensor

Hi,

I’m trying to offset by 6°C one of my temperature sensors so I added the following to configuration.yaml :

template:                                                                                                                                             
  - sensor:                                                                                                                                           
      - name: "Temperature cuisine"                                                                                                                   
        unit_of_measurement: "..C"                                                                                                                    
        value_template: "{{ states('sensor.lumi_lumi_sensor_magnet_aq2_device_temperature_3') | float - 6}}"                                          
        device_class: temperature

Unfortunately I get the error :

Invalid config for [template]: [value_template] is an invalid option for [template].

How do I format this correctly?

Read the documentation. Look at the example. As the error says, there is no value_template option in the new template sensor format.

https://www.home-assistant.io/integrations/template/#state-based-template-binary-sensors-buttons-numbers-selects-and-sensors

Also you should provide a default for your float filter. And an availability template too.

template:                                                                                                                                             
  - sensor:                                                                                                                                           
      - name: "Temperature cuisine"                                                                                                                   
        unit_of_measurement: "..C"                                                                                                                    
        state: "{{ states('sensor.lumi_lumi_sensor_magnet_aq2_device_temperature_3') | float(0) - 6}}"
        availability: "{{ states('sensor.lumi_lumi_sensor_magnet_aq2_device_temperature_3') | is_number }}"                                    
        device_class: temperature
1 Like