Identify what user turn device on/off

The logbook shows what user turned on/off a device. How can you extract this information to perform an automation in node-RED?

If you use trigger state then you should get an object with:

msg.data.event.new_state.context and I believe the user_id is the “person” who did the action.
At least when you use events that is true. I assume it is with trigger state also.

1 Like

That is absolutely right. Thank you!

This used to work for me, but now the user_id is null. Are either of you experiencing the same?

If you look at the entity that was used to trigger the flow, in HA click on the entity and look at the log. Does it say there who changed it’s state there?