Logbook entry on state change with no history on this entity

Preambula

So after a long frustrating and rude (on both sides) conversation here with mod I finally get it and want to raise a request, seek for help and/or do it myself with a little help from the community.

Now, logbook does not reflect state changes if history is absent. This means, if some state changes less often than you have purge_keep_days set up in recorder, you won’t know who or what changed this entity. So you have 2 options:
a) You accept that HA is unable to help you with identifying patterns with rare occasions and why they happen
b) You set purge_keep_days for like 100/1000/10000 days and have no space in your storage after a few months if you have a lot of entities total in system, because you can’t make it larger only for some entities

Also, there’s some purely made integrations for PLC’s with which system starts with them in “unknown” or “unavailable” status until you change something for the first time. I didn’t check, but there’s a chance this one will also have no logbook entry. If “unknown” state is threated as no state, it should be true.

On the other hand, current entity state, no matter what it is, is still stored somewhere and can be checked against with developer tools, templates, automations or your own eyes. So logging the change is 100% possible with some code rewrite.

Yeah, you can make an automation to log it that way. So you’ll need to do it for every entity you need and don’t forget to add new one there every time something this valuable appears in your system. Plus, making an automation to do something that system base functionality is already almost doing is just strange imo.

Vote for this pls and peace to you all!

I see the passion in your words, but after reading it a couple of times, I have no idea what exactly you want to change and what you want to change it to.
It’s not a language thing. Your grammar is clearly understandable.
It’s that a clearer proposal would greatly help your chances of someone helping you with this idea, as stated in the pinned post.

I can try to explain it, because it does make sense actually.

You have a bulb that has been turned on 10 days ago and it has been burning since then.
Your recorder.purge_days are set to 7.
The recorder will have purged the state change 10 days ago, because it is more than the 7 days limits.
Now the recorder have no data on the bulb, but the bulb entity exist and if there is no change registered in the recorder, then it must be because it has not changed state in the days the recorder store data for, so that must mean that the bulb still retain the state it has for the 7 days the recorder store for.

What OP wish for is when there is no state change in the recorder registered in the recorder then set the state in the recorders timeline to that of the current state, instead of as now, where it is just not available.

1 Like

Ok, so eliminate the purge completely, save the last state forever?

No, I think the way would be to extract the data as it is now and then enrich it with the current states of the devices that are not found in the extracted data.

If the bulb has a current state and is not present in the extracted data, then it is because it have had that state for the entire duration.