Wait for trigger issue

I have a zwave sensor in a grow tent pulling temp and rh. I have an automation to turn on an input_boolean at a given low temperature and another automation to handle when the boolean is turned on. The boolean controls the actual heater plugged into a zwave switch (so I can manually trigger the boolean and warm to the high end of the temp range whenever I want).

When the boolean turns on, it should wait for the numeric state of the temperature sensor to be above a given value, then continue (turning off the boolean). Sometimes, it doesn’t continue when the value crosses above the threshold. Last night it did it and my tent was at 100+ degrees for 6 hours.

Screenshot of the trace and the relevant entry in my automation. Any help?

Edit: Full automation below

          - wait_for_trigger:
              - platform: numeric_state
                entity_id: sensor.norby_enviro_temp
                above: input_number.norby_heat_off_temp
            continue_on_timeout: false

You’re using a Numeric State Trigger in wait_for_trigger. That means it is waiting for the temperature to increase from below the threshold value (represented by input_number.norby_heat_off_temp) to above it. If the temperature is already above the threshold value, wait_for_trigger will wait until the temperature drops below the threshold and then increases above it. In other words, it may wait for a long time, meanwhile the temperature can climb well above the threshold value.

You didn’t supply a timeout value and there’s no default value for it so wait_for_trigger will wait exclusively for the Numeric State Trigger and not expire after a certain amount of time. Without specifying timeout, the continue_on_timeout option is ineffective.

Either add a timeout or change it from wait_for_trigger to wait_template.

- wait_template: "{{ state('sensor.norby_enviro_temp') | float > states('input_number.norby_heat_off_temp') | float }}"

That’s by design. This boolean is only turned on when below the heat_off_temp (sensor < target). In the trace it was evaluating 82.1 and the trigger was fired at the time the sensor was at 75.9 (below the target of 76 - which has a similar numeric state trigger).

I’ll give the wait_template a try. I haven’t looked into that before. Thank you

I’m finding it difficult to follow along because I don’t have the benefit of seeing the automation you are using. I suggest posting it so that I and others can see how this wait_for_trigger is used within it.

Fair enough. I’m going to update to a wait_template and let it run. Would still be curious why what I have wasn’t working. From the trace it looks like got to the wait_for_trigger at 11:42:33PM and evaluated sensor > input_number as true, but didn’t continue. Both the boolean and the device it controls were still on.

I changed the target temperature to a higher value and reran the warm-up and it correctly went from below the target (88 in this case) and then turned off. This is with no changes to the automation. Below is the screenshot of the latest run of the automation and the entire automation. I can see the difference of result: true vs result: false but can’t understand why.

alias: Warm up Norby (actions)
description: ''
trigger:
  - platform: state
    entity_id: input_boolean.warm_norby_up
condition: []
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: input_boolean.warm_norby_up
            state: 'on'
        sequence:
          - repeat:
              until:
                - condition: device
                  type: is_on
                  device_id: 0ce486101cb9ed8b4dad7d851fec4325
                  entity_id: switch.norby_heater_solo_switch
                  domain: switch
              sequence:
                - type: turn_on
                  device_id: 0ce486101cb9ed8b4dad7d851fec4325
                  entity_id: switch.norby_heater_solo_switch
                  domain: switch
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 10
                    milliseconds: 0
          - service: script.greauxbox_event
            data:
              tent: Norby
              event: Heater on (Warm up Norby - Actions)
          - wait_for_trigger:
              - platform: numeric_state
                entity_id: sensor.norby_enviro_temp
                above: input_number.norby_heat_off_temp
            continue_on_timeout: false
          - repeat:
              until:
                - condition: state
                  entity_id: input_boolean.warm_norby_up
                  state: 'off'
              sequence:
                - service: input_boolean.turn_off
                  target:
                    entity_id: input_boolean.warm_norby_up
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 10
                    milliseconds: 0
      - conditions:
          - condition: state
            entity_id: input_boolean.warm_norby_up
            state: 'off'
        sequence:
          - repeat:
              until:
                - condition: device
                  type: is_off
                  device_id: 0ce486101cb9ed8b4dad7d851fec4325
                  entity_id: switch.norby_heater_solo_switch
                  domain: switch
                - condition: state
                  entity_id: input_boolean.hold_norby_temp
                  state: 'on'
              sequence:
                - type: turn_off
                  device_id: 0ce486101cb9ed8b4dad7d851fec4325
                  entity_id: switch.norby_heater_solo_switch
                  domain: switch
                - service: input_boolean.turn_on
                  target:
                    entity_id: input_boolean.hold_norby_temp
                - delay:
                    hours: 0
                    minutes: 0
                    seconds: 10
                    milliseconds: 0
          - service: script.greauxbox_event
            data:
              tent: Norby
              event: Heater off (Warm up Norby - Actions)
    default: []
mode: restart