Help with an IF statement for my heating

Just learning my way in Home Assistant and I was wondering if its possible to create a template sensor that will set itself to on or off based on if a sensor is below the value of another sensor, something like this …

if sensor.livingroom.temp < sensor.livingroom.temp.setpoint then make the template sensor on otherwise off

guessing i can do this in a helper - template ?

Any help would be greatly appreciated.

Something like this should work:

{{ iif((states('sensor.livingroom.temp')|float) < (states('sensor.livingroom.temp.setpoint')|float), 'on', 'off') }}

Yes. This is possible with both an helper and with “And if” Condition in the visual automation helper.

Use the visual editor select “And If” then “Add Condition” then select “Entity” then select “Numeric State” then select the sensory then select “Below Mode” then enter the value in “Numeric value of another entity”

2 Likes

Not an automation, but a template binary sensor, under Helpers.

State template is as simple as:

{{ states('sensor.livingroom_temp')|float < states('sensor.livingroom_temp_setpoint')|float }}

Check your entity IDs: you wrote sensor.livingroom.temp for example, but a sensor name cannot have a dot in the “slug”.

That answers your specific question, but you may want to look at: