I need a bit of help as I am struggling with determining what triggered an entity state change
In my case, entity_id is a light from a shelly dimmer, using HAAS native shelly integration (not via mqtt)
my headache is that regardless who changes it (automation or physical), the trigger.to_state.context.parent_id comes null within this simple test code
trigger:
- platform: state
entity_id:
- light.den_dimmer_1
attribute: brightness
id: trg_test
- platform: time_pattern
seconds: /4
enabled: false
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: trg_test
sequence:
- service: notify.persistent_notification
data:
title: test
message: |
"ID. | Parent | user"
to_state: {{ trigger.to_state }}
context.id: {{ trigger.to_state.context.id }}
context.parent_id: {{ trigger.to_state.context.parent_id }}
context.user_id: {{ trigger.to_state.context.user_id }}
default:
- service: light.toggle
data: {}
target:
entity_id: light.den_dimmer_1
Below shows parent_id is null when triggered by automation.
However, the Logbook DOES know an automation triggered it or it was done by hand - those two events in the middle.
Can someone please point me what I am doing wrong ?