Automation for temperature threshold with value template not working

Hey all. I have a boiler that is quite sensitive to shutting off if the pressure is too high or low. My thermostat is not smart yet :disappointed:, so I want to set up an automation that notifies me if the room temperature drops below the value of an input_slider.

Below is what I’ve got so far. It is accepted as valid code, but doesn’t appear to be working…

- alias: 'Temperature warning'
  trigger:
    platform: template
    value_template: >
      {% if state.sensor.living_room_temperature < state.input_slider.warning_temperature %}true{% endif %}
  action:
    - service: notify.notify
      data_template:
        message: 'Temperature: {{ states.sensor.living_room_temperature.state }} {{ states.sensor.living_room_temperature.attributes.unit_of_measurement }}'

Any help would be appreciated!

Try this:

- alias: 'Temperature warning'
  trigger:
    platform: state
    entity_id: sensor.living_room_temperature
  condition:
    condition: template
    value_template: '{{ (states("sensor.living_room_temperature") | float) < (states("input_slider.warning_temperature") | float) }}'
  action:
    - service: notify.notify
      data_template:
        message: 'Temperature: {{ states.sensor.living_room_temperature.state }} {{ states.sensor.living_room_temperature.attributes.unit_of_measurement }}'

Looks good so far, thank you! I’ll just wait until it triggers.

I’m still getting my head around the HASS’s YAML, why does the trigger also require a condition separately. And why does the equality require its type to be stated?