I have this automation working to stop switches from being switched.
How can I specify this for a certain user? I need to do it for some users.
`alias: Prevent Access to Dummy Light
description: ""
triggers:
- entity_id:
- input_boolean.dummy_light_1
trigger: state
conditions:
- input_boolean.dummy_light_1
- condition: state
entity_id: input_boolean.light_access_control
state: "off" - condition: state
entity_id: input_boolean.automation_lock
state: "off"
actions: - data:
message: "TT: {{ trigger }} "
level: info
action: system_log.write - target:
entity_id: input_boolean.automation_lock
action: input_boolean.turn_on
data: {} - target:
entity_id: input_boolean.dummy_light_1
action: input_boolean.toggle
data: {} - delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 1 - target:
entity_id: input_boolean.automation_lock
action: input_boolean.turn_off
data: {}
mode: single`
I tried the template, but the triggers don't have any context or user-related information.
{{ trigger.context.user_id == 'defcef455af7458496656999f9f3800d' }}
2024-12-11 14:54:25.233 INFO (MainThread) [homeassistant.components.system_log.external] TT: {'id': '0', 'idx': '0', 'alias': None, 'platform': 'state', 'entity_id': 'input_boolean.dummy_light_1', 'from_state': <state input_boolean.dummy_light_1=off; editable=False, icon=mdi:lightbulb-outline, friendly_name=Dummy Light 1 @ 2024-12-11T14:54:25.039918+02:00>, 'to_state': <state input_boolean.dummy_light_1=on; editable=False, icon=mdi:lightbulb-outline, friendly_name=Dummy Light 1 @ 2024-12-11T14:54:25.233094+02:00>, 'for': None, 'attribute': None, 'description': 'state of input_boolean.dummy_light_1'}
and tried the person.state, but it didn't set correctly; all users' states were unknown.
condition: state entity_id: person.kutad state: home
any solution?