Logic to automation crossing a numeric_state threshold

Hi all,
I have my head round the crossing threshold for automations, makes sense that only when a value crosses a below/above that it triggers the automation, but I’m trying to think of the most efficient way of doing this for a heating system:

automation1 - a Low point trigger, check a temperature sensor and a set heat-target helper and trigger on that:

platform: numeric_state
entity_id:
  - sensor.house_temperature_temperature
below: input_number.heating_targettemperature
for:
  hours: 0
  minutes: 5
  seconds: 0

automation2 - a High point trigger, check a temperature sensor and a set heat-target helper and trigger on that:

platform: numeric_state
entity_id:
  - sensor.house_temperature_temperature
above: input_number.heating_targettemperature
for:
  hours: 0
  minutes: 5
  seconds: 0

The problem is the helper input_number.heating_targettemperature gets changed by various actions, calendar events, manual events, etc. When the target is changed it of course hasn’t strictly passed the threshold so the two automations above won’t get triggered.
Without writing a horribly inefficient time */5 minutes automation to check and trigger is there a smarter way of doing what I need?

So far my only thinking is writing an automation that is manually triggered (i.e. chained onto the calendar, manual events, etc) that uses an if/else type condition to check if above or if below and trigger.
Is there a better way?

Yes this is a limitation of the numeric state trigger using an input number. It does not monitor the input number for changes that could cause a trigger. The best way around this limitation is to use a template trigger that monitors both the sensor and input number for changes:

platform: template
value_template: "{{ states('sensor.house_temperature_temperature')|float(0) < states('input_number.heating_targettemperature')|float(0) }}"
for:
  hours: 0
  minutes: 5
  seconds: 0
1 Like

Brilliant, thank you, makes sense so it will ‘subscribe’ to both sensor and input number.