#choose between 2 picking random 3rd option?
1 messages · Page 1 of 1 (latest)
why did it pick the magical wonderful 3rd path in traces?
id: '1769774794315'
alias: Turn Outside Light Off
description: ''
triggers:
- trigger: time
at: '00:00:01'
- trigger: time
at: '09:00:01'
- trigger: time
at: '07:00:01'
- trigger: state
entity_id:
- sun.sun
from: null
to: null
conditions: []
actions:
- choose:
- conditions:
- condition: time
after: '00:00:00'
before: '00:01:00'
- condition: time
after: '09:00:00'
before: '09:01:00'
sequence:
- action: light.turn_off
metadata: {}
target:
entity_id: light.downstairs_hallway_light_switch_1_switch_2
data: {}
- conditions:
- condition: time
after: '07:00:00'
before: '07:01:00'
- condition: state
entity_id: sun.sun
state:
- below_horizon
sequence:
- action: light.turn_on
metadata: {}
target:
entity_id: light.downstairs_hallway_light_switch_1_switch_2
data: {}
mode: single```
When the sun changed, from above horizon, to below horizon
then surely, when it hits "then do", it would choose the one where the sun is below horizon
and then turn the light on
right
surely?
it must match all conditions in the condition
fails the time condition
- condition: time
after: '07:00:00'
before: '07:01:00'
is false, ergo not chosen
ok
so if I add an or block
and then put that all in there
it should just be fine and work
right
yes with an or if the sun condition matches it will chose that path
btw using trigger ids would be much cleaner here
i see
looks fine, but definitely look into replacing those time conditions with trigger conditions
something like:
triggers:
- trigger: time
id: "on"
at: "07:00:00"
- trigger: time
id: "off"
at: "09:00:00"
- trigger: state
entity_id:
- sun.sun
to:
- below_horizon
id: "on"
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id:
- "on"
sequence:
- action: light.turn_on
target:
entity_id: light.ceiling_lights
default:
- action: light.turn_off
target:
entity_id: light.ceiling_lights
Are trigger IDs unique per automation? or do I have to worry about naming convention