Input boolean first state change is not saved

I have an input boolean that has not changed state for a long time. On the main page it shows that it’s in current state for a 4 weeks, but history is empty.



Then, if I change it’s state, the first change reason wouldn’t get to the history at all. It shows when the state was changed on the graph, but not the reason for it.

Second state change and all the next ones will behave as usual

History is only stored for 10 days. If you don’t have state changes in that 10 day period, you’ll have no history.

Ok, but my post is not about it. I just changed the state 2 times. Both of them are shown on the graph, but history shows only second one. Both happened in the last minute :slight_smile:

UPD: i’ve tested it a few times on different input booleans I didn’t touch in a while and it works like this every one of them.

Everything looks correct based on the images you’ve shown. You see the on state in the logbook and history. The off state was the previous state. The context for that state wasn’t known because it happened outside the history window that you have.

  1. state is on for 4 weeks, history is empty
  2. I turn it off, history shows that it became off, but don’t show who or what did this change
  3. I turn it on 1 more time. Now history shows not only time of this change, but that Admin cnanged the state

I’ve recorded a video with this on another similar switch for easier understanding

Yes, after 10 days, your history is cleared. Meaning all state changes that happened beyond 10 days ago are gone.

The input boolean was already off. There’s no state change.

Correct, you now see the single state change.

Bro please look at the video…
I did 2 state changes (off>on, on>off) and there’s only 1 in history

You aren’t understanding, so I’ll just let you be.

Ok i misstyped the states…

  1. It was OFF, I turn it ON, history shows that it became ON, but does’t show who or what did this change
  2. It’s now ON, I turn it OFF. Now history shows not only time of this change, but that Admin cnanged the state

The point of this whole thing is not about 10 days history. It is about (just please, look at the 15 seconds video) that I do 2 state changes right now recording this and see only 1 of them in the history

Yes it does, it shows that it was a service call, and it has - Admin (the user that performed the action).

Please try to understand that this is 100% related to the 10 day history.

Right now, regardless of state, you have 0 history.

First state change will provide the entity with history.

Second state change will now show up. This causes logbook to see a state change in the events table. Which will in turn add it to the logbook.

Events table → logbook.
History table → History.

Logbook only records changes in state.

If you go from nothing to something, that is not logged in logbook.

You have to go from something to something for it to be seen. I.e. a full valid state change.


Ok, here’s another similar input boolean I still haven’t touched. HA def knows it’s state, so it’s sertainly not “nothing”.

Anyway, how can I “fix” this annoying issue without setting purge_keep_days to 10k and killing my ssd after a few months? What’s the workaround? Next time something really important changes state after a long time, I need to know why it did this.

If there’s no state change in months, it won’t be in the 10 day history. Sorry, that’s how it works.

You can’t, if it’s not in history this will happen.

More data isn’t going to kill the SSD. They are rated on reads/writes. More data is just more data. You’re still having the same read/writes.

Write an automation to notify you if it’s that important and you don’t want to alter your history.

Yes, but it will eat all the space available :slight_smile:

Every state change is important. Every single one. I just can’t understand how is this not a bug that state change is not logged anywhere. HA knows the current state, nevermind the history.

If you think it’s a bug, write up an issue.

Already in the process…

1 Like