History Graph not showing correct data

Hi

I have a history graph setup to monitor the state of various switches in my home.

I have been having some issues where by the state of the device does change however the change is not reflected within the graph.

For example I have a wifi thermostat (fstwifitu) which toggles on and off with IO off peak times (23:30 to 05:30)

You can see that the state change has been logged (switch changes 5 hours ago),

I also confirmed the state change in the Tuya console:
image

However the history graph has this as staying constantly off for the entire time:

Not sure where I should look to start debugging this?

Thanks

Looks puzzling.
3 pictures with no clarification which entities are shown.

Sorry they are all the same entity., fstwifitu

It cannot be same entity since it have different states on Entities card & different graphs on History-graph.
You should specify which entity correspond to each screenshot.

That is what the problem is, the history graph is not accurately representing the actual states of the device.

Once again.
You are talking about some entity - like it is not shown properly on History-graph.
And then you post a graph for 2 entities.
Could you post only NEEDED info?

According to this

you probably mean a “bottom” entitiy which stays OFF.
Here you are talking about some entity which changes ON->OFF->ON

and this seems to be the “top” graph.
Then what entity are you talking about?

Sorry i do appreciate the last screenshot is difficult to read, windows would not let me crop it down any further.

image

just to recap:

  • I have a wifi immersion heater switch called fstwifitu (part of the Tuya integration), it auto toggles at times of the day between on and off.
  • Other elements of HA see and record the switch change.
  • I have confirmed via the Tuya console the device is indeed turning off and off.
  • The history graph seems to have stopped showing the on and off states and just shows off.

As far as I understood:

  1. There is a switch controlled by some integration. The switch represents some “part” of some physical device.
  2. Using Tuya console - you see some info which shows that the “part” was toggled between ON & OFF.
  3. History graph for this switch shows a constant OFF for this period.

Right?

Possible reasons:

  1. You are watching a history-graph for another switch. Double check entity_id (not non-unique friendly name) of this history-graph - is it same entity_id of a switch managed by the integration.
  2. Due to unknown reasons the integration stopped updating the switch based on the actual physical device. Check Log for errors.

Also, earlier you posted a more-info window for some OFF switch.
Is it same switch?
Asking because it shows that it was changed 5 hours ago:
image
Assume that the screenshot was made at ~13:30 (my local time of your post)
If you are saying that history-graph shows a constant OFF - then it COULD be a proper value of “ON → OFF” change at 05:30 (if we have different GMT).
Ofc this is valid if HA was not rebooted since HA reports wrong last-changed then.

1 Like

Yep thats spot on.

The IDs match, when I click on the history graph bar the switch appears, I toggle that switch but the history graph bar stays the same.

The integration, HA, the physical switch are all playing nicely, ill check the logs for any errors.

This is correct but even hours later it still remains as off.

I have now noticed other things are not being properly reflected by history-graph charts, such as my invertor work mode. I wonder if there could be an underlying database issues which is affecting the history of devices being logged.

Clear browser’s cache just in case and re-check.

I’m experiencing the exact same issues. For the past week, multiple different sensors, from multiple different domains, from multiple different integrations (including core ones), have been changing state just fine—but all of the history is stuck showing values from five days ago.

I’ve cleared my browser cache with no improvement.

I’ve just bumped my Docker image to the latest and rebuilt my container. I guess we’ll see if that improves things.

Another member here has had a similar problem in the past and figured that it might be related to just too much data: in their case, the UniFi integration (which I’m using) was generating a lot of sensor data and it seemed (still seems?) that the History integration just can’t “keep up”.

Almost definitely an underlying issue with the History integration (or maybe its SQLite backend).

I myself had similar issues with History which occur even with a browser cache cleared.
There are related issues in Github (at least which I know), some of them still present, some hopefully resolved:
one
two
three
four
In my experience - most of glitches are not observed after HA reboot.

Upgrading and rebuilding the container didn’t help.

I’ve stopped HA, completely deleted the database, and restarted HA. So far, so good—however, I’m anticipating problems again closer to the 10-day mark.

Well, I pretty much called it: as of yesterday, it has again stopped recording history. No errors in the log. Frustrating!

I guess I’ll try reducing my logging duration down to something like 7 days—but that’s not my preferred long-term solution.

Suggest to register a detailed issue in core.