Numeric state trigger and threshold

I thought numeric states only trigger when a value crosses a threshold, but an automation is triggering with this:-

(The second template based trigger evaluates to the false, I checked this in dev tools, and the trace output confirms it.)

if:
  - condition: or
    conditions:
      - condition: numeric_state
        entity_id: sensor.our_house_outdoor_temperature
        below: input_number.house_temperature_shutoff_outside_temp
      - condition: template
        value_template: >-
          {% set sensor =
          'sensor.'~states('input_select.house_temperature_shutoff_sensor')~'_temperature'
          %}

          {{states(sensor)|float(0)<=states('input_number.house_temperature_lower_limit')|float(0)}}
  - condition: not
    conditions:
      - condition: state
        entity_id: climate.main_house
        state: auto
    enabled: true
then:
  - action: climate.set_hvac_mode
    metadata: {}
    data:
      hvac_mode: auto
    target:
      entity_id: climate.main_house
  - data:
      message: Heating is now auto.
      title: Tado Alert
    action: notify.mobile_app_my_phone

According to this trace output:-

if/condition/0/conditions/0/entity_id/0
Executed: 3 December 2024 at 18:19:04
Result:
result: true
state: 4.35
if/condition/1
Executed: 3 December 2024 at 18:19:04
Result:
result: false
if/condition/1/conditions/0
Executed: 3 December 2024 at 18:19:04
Result:
result: true
if/condition/1/conditions/0/entity_id/0
Executed: 3 December 2024 at 18:19:04
Result:
result: true
state: auto
wanted_state: auto

The input helper evalues to the value ‘10.0’ according to dev tools:-

{{states(‘input_number.house_temperature_shutoff_outside_temp’)}}

so 4.35 is below 10, but it didnt cross the threshold.

Can’t see any triggers in your code - only conditions. :grin:

I’m an idiot, and thats the answer. I had swapped the two terms in my head and now its obvious I look at it. I need to re-work my automation to use the condition as a trigger.

2 Likes