I use the Wait for trigger action in my automation with to triggers; A and B, and using the UI it automatically defines them as:
If trigger A or trigger B = true, then the the wait_for_trigger is true
And that’s fine. But I want different criterias for A and B.
I want A to be true when its value is 2, and B to be true when its value is 45
And it isn’t possible to set different criteria for A and B
So how can I create a ‘Wait for trigger’ that becomes true if A or B becomes true as in my example?
I tried using two triggers, and the description next to the traffic light icon changed to: Wait for two triggers which I interpret as an AND criteria. and that’s not what I want.
Aha, so the automation will continue (beyond the second trigger) even if only the first triggers (and vice versa)?
I just tried, and it didn’t. Both triggers had to trigger. The automation trace stopped after the first trigger and didn’t continue until the second had triggered.
Here it is:
alias: Kjøkken - kjør oppvaskmaskin ved lav strømpris
description: ""
trigger:
- alias: Trigges når oppvaskmaskinen slås på
platform: state
entity_id:
- switch.011120387256000640_bsh_common_setting_powerstate
to: "on"
condition: []
action:
- wait_for_trigger:
- platform: state
entity_id:
- binary_sensor.011120387256000640_bsh_common_status_doorstate
to: "off"
for:
hours: 0
minutes: 0
seconds: 0
timeout:
hours: 0
minutes: 0
seconds: 0
milliseconds: 0
continue_on_timeout: true
alias: "Wait for trigger: Door closed"
- wait_for_trigger:
- platform: numeric_state
entity_id:
- sensor.hours_delay
below: 1
- platform: state
entity_id:
- input_button.delay_override
- service: homeassistant.turn_on
data: {}
target:
entity_id: switch.011120387256000640_bsh_common_setting_powerstate
alias: Slå på oppvaskmaskinen (den kan ha timet-ut)
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- service: button.press
data: {}
target:
entity_id: button.011120387256000640_start_pause
mode: single
(just ignore the Norwegian language here and there)
It seems to me that consecutive triggers are all AND logic except when two (or more) trigger entities are entered for one trigger. Then those becomes OR logic. But that takes me back to square one again.
So, I still need help.
Your automation contains two wait_for_trigger actions:
The first one has a single trigger (State Trigger).
The second has two triggers (Numeric State Trigger and State Trigger).
When you say “first trigger” do you mean the first wait_for_trigger action? Or the first trigger, of the two triggers, in the second wait_for_trigger action?
The two wait_for_trigger actions operate in sequence; the first one must be executed (triggered) before the second one is executed.
The second wait_for_trigger action contains two logically ORed triggers.
Ok, thanks - I’ve been sleeping on the issue (I’m probably on a different time zone than you🌞), and I may have conclude incorrectly last night because the condition for the sensor.hours_delay in second wait_for_trigger action was already < 1 when the automation started.
And I guess a transition to <1 is needed for the trigger to trigger, right (it won’t trigger if the condition is already met when the automation starts?)
Hence my conclusion was likely incorrect.
So, to summerize - it is possible to build any combination of AND and OR logic?