In a debug node, using the events: all
node, it’s possible to identify state changes
and tie them to a user_id
. This gives me the ability to create a notification which reports which user changed the state of a given control.
I noticed that the json object sent for events of type script_started
don’t contain nearly as much information. Below is an example of the msg object for scripts in the event bus.
event_type: "script_started"
topic: "script_started"
payload: object
event_type: "script_started"
entity_id: "script.open_door"
event: object
name: "open_door"
entity_id: "script.open_door"
_msgid: "5111f822.9c9078"
QUESTION: When defining the script in yaml, is there a way to include the user who triggered the script?
This script is triggered by an Execute
button on the HA UI. It uses MQTT Publish to trigger a relay on a magnetic door lock. It would be nice to be able to know who triggered it when it happens.
The only workaround I can think of would be to create a switch that would trigger the script and then the script would reset the switch, and then we would have the user id included.
Any thoughts?