Hi there,
Trying to do something seemingly simple but can’t figure it out.
I have a schedule during which the bathroom lights will be turned on and off based on a motion sensor, this is what that looks like
Works great, easy enough.
Now I wish to expand this so that if the light is turned on via the app or the physical switch… the automation should not turn it off or on
This is how these look like
How on earth can I test for this and put it into the automation.
Read about 'context" but can’t seem to find that
Here is what I have so far.
Thank you
I read that but am totally lost as to where to put this in.
Could you share where this would go please?
Is it under automation, then the automation and then yaml?
tinker tinker… 50% working. 
I now have it so far that it disables the automation if the light is activated by the app or the physical device but I can’t get it enabled again if the light gets switched off.
Here is what I have, any suggestions?
alias: En - Disable Bath-Lights
description: ""
triggers:
- trigger: state
entity_id:
- light.bath_light
to: "on"
id: Bath-on
- trigger: state
entity_id:
- light.bath_light
to: "off"
id: Bath-off
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id:
- Bath-on
- condition: template
value_template: >-
{{trigger.to_state.context.id != none and
trigger.to_state.context.parent_id == none and
trigger.to_state.context.user_id != none}}
alias: State changed HA interface on
sequence:
- action: automation.turn_off
metadata: {}
data:
stop_actions: true
target:
entity_id: automation.bath_lights
alias: Bath-Lights
- choose:
- conditions:
- condition: trigger
id:
- Bath-on
- condition: template
value_template: >-
{{trigger.to_state.context.id != none and
trigger.to_state.context.parent_id == none and
trigger.to_state.context.user_id == none}}
alias: State changed manually on
sequence:
- action: automation.turn_off
metadata: {}
data:
stop_actions: true
target:
entity_id: automation.bath_lights
alias: Bath-Lights
- choose:
- conditions:
- condition: trigger
id:
- Bath-off
- condition: template
value_template: >-
{{trigger.to_state.context.id != none and
trigger.to_state.context.parent_id == none and
trigger.to_state.context.user_id != none}}
alias: State changed HA interface off
sequence:
- action: automation.turn_on
metadata: {}
data:
stop_actions: true
target:
entity_id: automation.bath_lights
alias: Bath-Lights
- choose:
- conditions:
- condition: trigger
id:
- Bath-off
- condition: template
value_template: >-
{{trigger.to_state.context.id != none and
trigger.to_state.context.parent_id == none and
trigger.to_state.context.user_id == none}}
alias: State changed manually off
sequence:
- action: automation.turn_on
metadata: {}
data:
stop_actions: true
target:
entity_id: automation.bath_lights
alias: Bath-Lights
mode: queued
max: 10
what is this for?
mode: queued
max: 10
most appreciated