Triger id madness

in this automation i have a numeric state trigger id, that for some reason runs the automation but not passes when i check the “condition” of its own ID tag trigger.

can someone explain this please?

BTW, if i add a condition with the exact same info as the trigger ID - it passed just fine as “true”, while the same trigger ID does not.
i’m sure i am just missing something, but until i can figure it out…
what is this madness???

here is the code for the entire automation.

alias: bedroom ac temp control 24.6-25.5
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.studie_badroom_avg_temp
    below: 24.6
    id: blow 24.6
  - platform: numeric_state
    entity_id: sensor.studie_badroom_avg_temp
    above: 25.5
    id: above 25.5
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: blow 24.6
        sequence:
          - repeat:
              until:
                - condition: numeric_state
                  entity_id: sensor.sonoff_100107ee35_power
                  below: 50
              sequence:
                - service: climate.turn_off
                  target:
                    entity_id: climate.bedroom_ac
                  data: {}
                - wait_template: ""
                  continue_on_timeout: true
                  timeout: "00:01"
          - service: switch.turn_on
            data: {}
            target:
              entity_id: switch.sonoff_1000bfcad9
      - conditions:
          - condition: trigger
            id: above 25.5
        sequence:
          - repeat:
              until:
                - condition: numeric_state
                  entity_id: sensor.sonoff_100107ee35_power
                  above: 50
              sequence:
                - service: climate.turn_on
                  data: {}
                  target:
                    entity_id: climate.bedroom_ac
                - wait_template: ""
                  continue_on_timeout: true
                  timeout: "00:01"
          - service: switch.turn_off
            data: {}
            target:
              entity_id: switch.sonoff_1000bfcad9
    default: []
mode: restart

i use it to control my dumb ac unit when i go to sleep. it keeps the room within the desired temp gap, and turns a fan on and off as well.
it uses an IR remote, and checks the power state of a smart plug to make sure the IR worked and the ac unit is working or not, based on the power draw of the smart plug.

next, i want to add a helper with more numeric options for min and max temp, but even with “fixed” numbers, i m struggling now.

cheers

Don’t believe you can manually ‘test’ for a TriggerID, since you’re testing the condition manually and no TriggerID is actually being ‘passed’ to the condition…

I am not sure u r right.

in the example below, there is the same automation, but the measure against the “temp sensor”, is not a fixed number but a helper. i created a “min” and “max” helpers with the desired values.
after configuring 2 triggers, and giving them ID tags, i duplicated the triggers as conditions and placed them within the “options” (just to check them, and to make sure i m not completely out of my mind).
however, as seen in the pic. while the “ID tag” fail, the condition passes. you can check the yaml code to see that they are “the same”.
in that case, how come the “tag” fail, but the condition passes? this automation does not trigger at all, although the condition that was supposed to trigger it - does.
(yes, i know its disabled)

here is the pic, and the yaml is down below.

alias: bd ac test temp control with helpers
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.studie_badroom_avg_temp
    below: input_number.bd_ac_min_temp
    value_template: ""
    id: min
  - platform: numeric_state
    entity_id: sensor.studie_badroom_avg_temp
    above: input_number.bd_ac_max_temp
    id: max
    value_template: ""
action:
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: sensor.studie_badroom_avg_temp
            below: input_number.bd_ac_min_temp
          - condition: trigger
            id: min
        sequence:
          - repeat:
              until:
                - condition: numeric_state
                  entity_id: sensor.sonoff_100107ee35_power
                  below: 50
              sequence:
                - service: climate.turn_off
                  target:
                    entity_id: climate.bedroom_ac
                  data: {}
                - wait_template: ""
                  continue_on_timeout: true
                  timeout: "00:01"
          - service: switch.turn_on
            data: {}
            target:
              entity_id: switch.sonoff_1000bfcad9
      - conditions:
          - condition: numeric_state
            entity_id: sensor.studie_badroom_avg_temp
            above: input_number.bd_ac_max_temp
          - condition: trigger
            id: max
        sequence:
          - repeat:
              until:
                - condition: numeric_state
                  entity_id: sensor.sonoff_100107ee35_power
                  above: 50
              sequence:
                - service: climate.turn_on
                  data: {}
                  target:
                    entity_id: climate.bedroom_ac
                - wait_template: ""
                  continue_on_timeout: true
                  timeout: "00:01"
          - service: switch.turn_off
            data: {}
            target:
              entity_id: switch.sonoff_1000bfcad9
    default: []
mode: restart

im so not getting what is wrong with my code…
please help
cheers :slight_smile:

ps
i do feel like my explanations are a little “all over the place”, so if any other clarification is needed - please ask.
i’ll be more than happy to assist you all to help me…

Numeric state triggers fire only on the state change of the entity given for entity_id (in your case the Sensor), changing the value of an entity listed under above or below (in your case the Input number) will make a condition true, but it will not cause a trigger to fire… and will not create a trigger.id that can be checked by the Trigger condition. If you need it to fire on the change or either entity, you will need to use a Template trigger or two Numeric state triggers.

interesting. that would explain what i m seeing, though i’ll be lying if i said i fully “understand” it…

if i understand you correctly i need to use something like this:

"{{ states('input_number.bd_ac_max_temp') | int(0) }}"

as that give out the number selected by the given entity.
where would i place it in the code for this automation to work, taking into account the number given by the helpr?
as this section in the automation - does not triger

though - as mentioned - it does passes as “true” when i check the “condition”

Your problem is your value_template: "" lines. Remove them.

Automation Trigger - Home Assistant (home-assistant.io)

Your value_template lines are converting the sensor value to an empty string. That’s why it’s never triggering.

so i deleted the value from the template, and its looks like this now, and now it works.
i set both helpers to (min and max) to 25, and manually set the temp sensor to 30 and 20 (back and forth), and the automation triggers.

alias: bd ac test temp control with helpers
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.studie_badroom_avg_temp
    below: input_number.bd_ac_min_temp
    id: min
  - platform: numeric_state
    entity_id: sensor.studie_badroom_avg_temp
    above: input_number.bd_ac_max_temp
    id: max

gr8

Remove the value_template:... lines completely.

you were (unsurprisingly) right…

i am marking your reply as the solution - as it is
:slight_smile:
cheers and, naturally - many many thanks.

i really appreciate both @Didgeridrew and @Markus99 reaching out and helping me sort this out.
love this community

1 Like