Logbook / state change history on entity pop-up's history tab

Some entities, like bulbs, switches and binary sensors has logbook/state change history entries under the history tab of the pop-up window of the entity.

Does anybody know how this can be added to any other entities? I have an MQTT sensor which has states as text, and I would like to see the history of it like the other state change history entries as mentioned above. Where and what configuration has to be added to be displayed in the pop-up of the entity? Maybe some custom code?

Any help is appreciated.

First try to find out is it possible to show a Logbook for this sensor in general.
Add a Logbook card for this sensor.
In my small practice, every sensor which has these features can be seen in the Logbook card:

  • the sensor does not have unit_of_measurement;
  • the sensor is not excluded from logbook & recorder integrations.

I can see the sensor in Logbook, but I don’t know how to get the history list. It displays with the horizontal bar only, what is not so nice with its 24 hours view. I would really like to get it as a list in the History tab of the pop-up.

Show what you already got in the more-info popup.
A small picture is much better than 1000 words.

Here are two examples:

Gate, binary sensor with list

The sensor which I want to have a list…

And it hasn’t got a unit_of_measurement

A bit odd, but not all “Stand by” states showing up in the Logbook:

Do you mean that the sensor has more changes and only some of them are present in the Logbook?

Check your logbook.yaml , does it have any excluding rules for this sensor

I have never set up any excluding rules for any sensors.

If you look at the picture, two states are the same after each other. There should be a short “Stand by” in between them. You can see it on the bar graph, as those small ticks.

Actually it might due to a logging issue as I can see in the logs.

What about a NORMAL logbook view, not from a buggy mobile app?

The mobile app renders as a webview so there isn’t any difference.

But back to the original question, how these state changes can be populated on the pop-up?

Not always even for stock lovelace.

once again - check desktop more-info

Both shows the same. There is no difference.

I am looking for a solution how the logbook records can be displayed on the pop-up for a non-binary sensor. I haven’t found any way to do this yet, that’s why I am asking the community.

I have multiple sensors with text states (NUT, MQTT, GIOŚ) and none has logbook/history records on the pop-up. I would be happy to have it, but I don’t know is it a limitation of HA or I have to enable it somehow.

Very strange that there is no logbook for this entity.
I checked my setup, seems that ALL entities w/o unit have the logbook on more-info (except entities excluded from recorder & logbook).

Could it be nuance for these types of data? I do not have these integrations so far, cannot simulate your case.

Regarding my doubts about mobile App - many things look differently on my iPhone & iPad, that is why I just do not trust screenshots from mobile App.

Can you show it? Anything which hasn’t got fixed states, like on/off, open/close, but multiple possible or changing states.

Yes, give me some time, I will prepare different examples.

I have a feeling that it doesn’t generate the list of events, because it hasn’t got a list with the possible options.

Do not think that it does matter.
Imagine a sensor which returns an address of a person location (“places” integration).
In my setup I can see a logbook with addresses when a person on move.

In short - you are right!!! - I found some entities which DO NOT have a logbook displayed.
I need some more time for analysis.

Any progress with this? I also have template sensors that don’t show Logbook events in history pop-up.

If the entity has an unknown number of possible values ( to HA), then the changes are not shown in the Logbook. I don’t know if it’s possible to define the expected values. I have a template sensor that combines two binary sensors. I know that it will only be in one of three states, but HA doesn’t so only changes to the default state are shown in the Logbook.

Actually changes are shown in the Logbook, but not on the entity’s pop-up history.

Here is an example: