pallebh
(Palle Bertram Hansen)
March 26, 2019, 8:25pm
1
If more then one switch is triggered at the same time only the first will be reset by the automation action. Why ??
id: ‘1552514198401’
alias: Reset pir sensors
trigger:
platform: state
entity_id:
switch.pir_01
switch.pir_02
switch.pir_03
switch.pir_04
switch.pir_05
switch.pir_06
switch.pir_07
switch.pir_08
switch.pir_09
switch.pir_10
for: ‘10’
to: ‘on’
condition: []
action:
service: switch.turn_off
data_template:
entity_id: “{{trigger.entity_id}}”
jwelter
(John Welter)
March 26, 2019, 9:41pm
2
Triggers are OR and conditions are AND.
pallebh
(Palle Bertram Hansen)
March 26, 2019, 10:01pm
3
It is just one rule. The rule should turn the given switch after 10 seconds. I could like this one rule and not these 10 rules.
id: ‘1552514198401’
alias: Reset switch.pir_01
trigger:
entity_id: switch.pir_01
for: ‘10’
platform: state
to: ‘on’
condition: []
action:
service: switch.turn_off
entity_id: switch.pir_01
id: ‘1552514198402’
alias: Reset switch.pir_02
trigger:
entity_id: switch.pir_02
for: ‘10’
platform: state
to: ‘on’
condition: []
action:
service: switch.turn_off
entity_id: switch.pir_02
id: ‘1552514198403’
alias: Reset switch.pir_03
trigger:
entity_id: switch.pir_03
for: ‘10’
platform: state
to: ‘on’
condition: []
action:
service: switch.turn_off
entity_id: switch.pir_03
id: ‘1552514198404’
alias: Reset switch.pir_04
trigger:
entity_id: switch.pir_04
for: ‘10’
platform: state
to: ‘on’
condition: []
action:
service: switch.turn_off
entity_id: switch.pir_04
id: ‘1552514198405’
alias: Reset switch.pir_05
trigger:
entity_id: switch.pir_05
for: ‘10’
platform: state
to: ‘on’
condition: []
action:
service: switch.turn_off
entity_id: switch.pir_05
id: ‘1552514198406’
alias: Reset switch.pir_06
trigger:
entity_id: switch.pir_06
for: ‘10’
platform: state
to: ‘on’
condition: []
action:
service: switch.turn_off
entity_id: switch.pir_06
id: ‘1552514198407’
alias: Reset switch.pir_07
trigger:
entity_id: switch.pir_07
for: ‘10’
platform: state
to: ‘on’
condition: []
action:
service: switch.turn_off
entity_id: switch.pir_07
id: ‘1552514198408’
alias: Reset switch.pir_08
trigger:
entity_id: switch.pir_08
for: ‘10’
platform: state
to: ‘on’
condition: []
action:
service: switch.turn_off
entity_id: switch.pir_08
id: ‘1552514198409’
alias: Reset switch.pir_09
trigger:
entity_id: switch.pir_09
for: ‘10’
platform: state
to: ‘on’
condition: []
action:
service: switch.turn_off
entity_id: switch.pir_09
id: ‘1552514198410’
alias: Reset switch.pir_10
trigger:
entity_id: switch.pir_10
for: ‘10’
platform: state
to: ‘on’
condition: []
action:
service: switch.turn_off
entity_id: switch.pir_10
id: ‘1552514198410’
alias: Reset switch.pir_10
trigger:
entity_id: switch.pir_10
for: ‘10’
platform: state
to: ‘on’
condition: []
action:
service: switch.turn_off
entity_id: switch.pir_10
rccoleman
(Rob Coleman)
March 27, 2019, 12:42am
4
Please use code block formatting as described in the blue box at the top to preserve formatting.
Unfortunately, automations in YAML are fairly restrictive in that a only a single trigger causes the automation to fire at a given time, the trigger events aren’t queued, and they won’t re-trigger if conditions change during execution. When I’ve run into repetitive automations like that, I just write an AppDaemon script in Python to handle it. None of those restrictions apply to AppDaemon, and a small amount of code can do a lot of work.