Hi,
after hours of RTFM i got stuck. Hope you can help me out and point me into the right direction. I am trying to check within an automation if any of the (potentially affected) devices have been somewhat changed beforehand by another automation or user.
Use Case:
Jane enters a room, the lights are turned on automatically by an automation rule. She logs into Lovelace and dims the light. A couple of minutes later, she is moving which is picked up by the motion sensors and triggers the initial automation. This automation would reset all lights and thus “override” Jane’s custom setting.
My research brought me to the conclusion that having a condition that checks for ?.to_state.context.user_id
, might be the right direction.
Question:
How can I check within an automation if any related light has been changed manually recently before I substantially turn/dim/change the lights via actions.
Automation YAML
alias: EG Wohnen - Licht an bei Bewegung (bei Tag)
description: ""
trigger:
- type: motion
platform: device
device_id: f98f0c92fc70451ca0b9406f27b24530
entity_id: binary_sensor.bewegungsmelder_lautsprecher_occupancy
domain: binary_sensor
- type: motion
platform: device
device_id: 1c07b571a3b744440e1e924b6966bcfa
entity_id: binary_sensor.bewegungsmelder_kuhlschrank_occupancy
domain: binary_sensor
condition:
- condition: state
entity_id: input_boolean.kinomodus
state: "off"
action:
- scene: scene.wohnzimmer_hell
- service: automation.trigger
target:
entity_id: automation.wz_morgens_und_abends_kuchenlicht
data:
skip_condition: false
mode: single