Sensor template for temperature

trying to figure out how templates work.

in the template tester this code works:
{{ states(‘sensor.pws_temp_c’) }}C | {{ states(‘sensor.pws_feelslike_c’) }}C | {{ states(‘sensor.pws_relative_humidity’) }}%

it shows me temperatur / feels like / humidity in one line.
I want to put this in an sensor so i get it in the GUI in 1 single line.

but when making the sensor it doesn’t work:

  • platform: template
    sensors:
    temp_vocht:
    value_template: “{{ states(‘sensor.pws_temp_c’) }}C | {{ states(‘sensor.pws_feelslike_c’) }}C | {{ states(‘sensor.pws_relative_humidity’) }}%”
    friendly_name: ‘Temperatuur’
    entity_id: sun.sun

I have the idea it goes wrong in the entity_id ?
What do i need to put there? If i remove it, it also doesn’t work.

solved it…
value_template: ‘{{ states.sensor.pws_temp_c.state }} C | {{ states.sensor.pws_feelslike_c.state }} C | {{ states.sensor.pws_relative_humidity.state}}’

is the way to go.

1 Like

The template dev tool is your friend here. Button at the bottom of the sidebar. It’ll let you debug template output in real time.

1 Like