Graph based logging of events

There’s a lot of things that are pretty hard to do in HA. I guess one of the reasons are the complexity caused by a huge amount of supported integrations. One problem that I walk into pretty often is the need to know a state and what caused that state
A possible solution to some of the problems caused by the complexity is if every event in HA was logged in a graph db or similar for a set number of events in the past. If that was the case we could instantly get any states and what caused that state.

One simple use for this ability would be to tell if a scene is “active” based on what is the expected states for that scene. Another use for this is to revert to a previous state: You have a scene that sets the house into night mode (most lights are off, some are on and some are dimmed). You have a motion sensor that trigger a scene in a part of the house (dimmed light in the hallway). When motion stops and there’s no need for lights in the hallway HA would be able to set the lights back to its previous state regardless of changes done in other parts of the house after night mode was initiated.

And there’s limitless of other possibilities by implementing this, like reporting states to other systems/frontends like HomeKit.

– JT –

Whatever you mean by that, all events are already logged in the HA db.

What prevent you to do that right now, based upon the current states?

You can create scenes on-the-fly for that.

Neo4j is a good example for a graph db. The thing about graph db’s vs conventional logging is that a graph db is more conserned about the graph: how events/data are connected. One clear advantage of this is vs conventional is that you will gain full visibility into complex events and how states changes over time wihout the need to forsee all eventualities and take into account all possible states after new events has changed some of the states from the original event. In short it helps connect the dots between an action and the reactions.
As an example if I activate a scene for a group of lights and after activation dim part of the group I only need to query the db how that “scene evolved” to be able to get to the last setting if an other scene is temporarly triggered and I need to get back to the previous setting.
Another example is the ability to create dynamic heating models for a full house based on sensors spread around the house: You should be able to calculate the convection times from one part of the house to a different part based on heat difference and if some doors are open or closed. Instead of creating the model by your selfe, let the db create the model.

@koying On another hand, the scenes on-the-fly sounds very interresting! Can you tell me about hoe to do that?

– JT –

Goes over my head, tbh :wink:

For scenes on-the-fly:

Thanks a lot! This is something I’ve really been missing.