-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve context object to allow better logbook entries #473
Comments
Could this also cover the case where the change is initiated from the API interface. I have a Pi based set of control consoles that access HA to turn things on/off via GET/POST calls to HA. Currently, any of these logs as by the user who created the authentication token (namely, me) no matter which console the command came from. What would be nice would be to augment that call with enough context information so that this could log as from a specific console. |
This information is already there. This is what the backend provides for my light that has been turned on my an automation. In some cases it is not correctly rendered in the frontend (more-info {see your screenshot} and logbook card, I will create a PR home-assistant/frontend#8231), but in the logbook panel it is shown.
|
@spacegaier Thanks for your feedback on this. I see indeed that when an entity has been changed by an automation, it already shows up correctly in the logbook panel (as in your example). My only remaining question is how an integration can make use of this functionality. |
Have a look at the unit test |
Fire an event when a schedule fires with same context. Then add a logbook platform. This is a dev q. Not architecture |
Context
The logbook entries are very useful for tracing back when+why the states of entities were changed.
The current implementation already allows you to see which user made a change to an entity, if this was done through the GUI.
In other cases, such as an automation that turned on an entity, it is not always clear what happened, since this is not mentioned in the logbook entry.
Proposal
My proposal is to improve the context description for logbook entries.
E.g.:
And perhaps other use-cases, which I cannot think of right now.
This change can be made possible by expanding the ha.Context object, allowing it to refer to an (automation) entity or an integration entry.
Ofcourse the
ha-logbook
frontend element should be modified as well, for being able to pretty-print the context.Consequences
The proposed change seems a win-win to me, from what I can see there are no negative side-effects.
To be sure, we need to investigate in which places the ha.Context object is used currently.
The text was updated successfully, but these errors were encountered: