I’ve got a problem I’m trying to figure out and I’m stumped. I have an input_number (actually a couple) that get updated once a day via automation. One of them is calculating the daily covid-19 cases by taking the number confirmed from the Coronavirus sensor and subtracting the prev day which is also stored in an input_number.
On Sat, there was a problem with the data from the sensor and it ended up messing up the state of my daily cases. The value was actually the total number confirmed. This has caused havoc with my graph on my lovelace page. So I went into the db and I fixed all the values. They are all correct now and I’ve restarted HA as well as rebooting the whole pi it runs on. I’ve checked and double checked the database and everything looks fine in both the states and events tables, but the graph is still messed up and I can’t figure out where it keeps getting the wrong number.
For instance, this graph uses an entity called input_number.covid19_daily_cases
Here’s a link to an image of the graph as it looks now:
Graph Image
The issue happened at just before midnight on 09/19/2020. The db dates are in UTC, so that is around 09/20/2020 06:55AM.
Here is the db output for the states table during that time frame:
mysql> select state_id,state,entity_id,old_state_id,event_id,created from states where created > '2020-09-19 00:00:00' and created < '2020-09-22 00:00:00' and entity_id = 'input_number.covid19_daily_cases' order by created desc;
+----------+---------+----------------------------------+--------------+----------+---------------------+
| state_id | state | entity_id | old_state_id | event_id | created |
+----------+---------+----------------------------------+--------------+----------+---------------------+
| 8032759 | 39844.0 | input_number.covid19_daily_cases | NULL | 8299470 | 2020-09-21 12:42:35 |
| 8024192 | 39844.0 | input_number.covid19_daily_cases | 7988787 | 8290578 | 2020-09-21 06:55:00 |
| 7988787 | 37081.0 | input_number.covid19_daily_cases | NULL | 8251505 | 2020-09-20 13:26:20 |
| 7979787 | 37081.0 | input_number.covid19_daily_cases | 7977702 | 8242154 | 2020-09-20 06:55:00 |
| 7977702 | 53431 | input_number.covid19_daily_cases | NULL | 8239864 | 2020-09-20 06:08:18 |
| 7972241 | 53431 | input_number.covid19_daily_cases | NULL | 8233977 | 2020-09-20 03:19:05 |
| 7959159 | 53431 | input_number.covid19_daily_cases | NULL | 8220290 | 2020-09-19 20:56:35 |
| 7958036 | 53431 | input_number.covid19_daily_cases | NULL | 8218818 | 2020-09-19 20:46:12 |
| 7946094 | 53431 | input_number.covid19_daily_cases | NULL | 8206403 | 2020-09-19 14:32:56 |
+----------+---------+----------------------------------+--------------+----------+---------------------+
9 rows in set (0.01 sec)
Here is the events table:
mysql> select event_id,event_type,event_data,created from events where event_id in (8299470,8290578,8290578,8242154,8239864,8233977,8220290,8218818,8206403) order by created desc;
+----------+---------------+------------+---------------------+
| event_id | event_type | event_data | created |
+----------+---------------+------------+---------------------+
| 8299470 | state_changed | {} | 2020-09-21 12:42:35 |
| 8290578 | state_changed | {} | 2020-09-21 06:55:00 |
| 8242154 | state_changed | {} | 2020-09-20 06:55:00 |
| 8239864 | state_changed | {} | 2020-09-20 06:08:18 |
| 8233977 | state_changed | {} | 2020-09-20 03:19:05 |
| 8220290 | state_changed | {} | 2020-09-19 20:56:35 |
| 8218818 | state_changed | {} | 2020-09-19 20:46:12 |
| 8206403 | state_changed | {} | 2020-09-19 14:32:56 |
+----------+---------------+------------+---------------------+
8 rows in set (0.01 sec)
I’ve even done a search for that particular value, like 6764970%
(to get both 6764970 and 6764970.0) and it’s just where it should be.
So what am I missing? Where else could it be storing that value? I’ve cleared the browser cache and reloaded the page several times. I’ve rebooted HA multiple times, then checked the db to make sure everything is still correct and it is.