I would like to be able to read/track who-did-what in my HA environments in order to plan follow-up actions/automations with that information.
As a (simple) example, when I am adding/removing items to a shopping-list then I want to send out a notification but not (!) to me (logically) or add ‘who’ added/removed the item.
As I have not seen this anywhere to far it may be a fundamental change that may not be wanted or too costly to achieve but nevertheless… I am asking
Isn’t that info already available in the logbook?
I am no expert on HA events but I would assume via event listener you could get the same information who changed the entity…
This is new to me but honestly I did not check all ‘events’ … So maybe it logs in some cases but e.g. Shopping list does not show anything. For my ‘lights’ I have partial results, possibly it depends if it is triggered from the client (laptop/mobile) or the server/automation…which would do fine as long as this is stable/reliable.
If possible, can you share for what Event you received above entry and if you ‘always’ has a userid visible?
Every state change has a context object that contains this information. You can use templates to access it for your messages. This does not work for people physically turning on/off things because HA does not know the source. It only works for users using the UI.
Thanks but apparently not for all integrations …or am I missing the point for ‘shopping list’? Note…just using SL as an example … not as the only integration I need this for
I can guarantee you that it has a context object. All state objects have them.
Well. … I checked events in the db but nothing for the ShoList sensor itself…its data is stored outside the db in a .json file so maybe that explains it. For the related services …yes, but not for updating the list itself. Anyhow, you have already helped me a lot so this thread can be closed…thanks !
does updating the list use an event? If yes, what event and what’s in the event object? The context object can attach it self to things in many different ways when it’s not state objects.
It does not seem to trigger any event, i.e. if I update the list via the app or laptop, there is no event added in the db. This integration also comes with services to a.o. update the list, also these donot trigger an event. The state of sensor.shopping_list also does not change when I use that. The only thing I can see is that the history notes down the new list…no userid info.
Now, I would like to avoid zooming in on this particular integration as it is one of many that I was aiming for with my request…so we can close it