I am trying to modify some statistics because of a rogue value and while I have the correct queries for statistics and statistics_short_term, something weird for states is happening. Here's my query:
SELECT * FROM states
WHERE (metadata_id > 8328 AND metadata_id < 8334) AND state > 17659
I get results with state like 2.00025078125 in my result set. I do NOT want to modify those. Any idea why this might be? Tried adding .0 behind 17659 but that didn't solve the problem.
No, haven't seen it when I searched for solutions. I did find one possible solution after I posted, through dev tool -> statistics -> ramp icon. That did not correct everything, weirdly enough. I will look at that integration.
Oh wow. State is float in statistics and statistics_short_term but NOT in the states table! Character actually I must have implicitly assumed that would also be a float. That's something I wouldn't expect semantically. I just tried another solution to modify the data in the table but the problem is still not corrected so I will look at that integration mentioned.
A clean, controlled restart when you have finished your data modifications is recommended. Check the error logs afterwards for any hints of problems. Check again after 24 hours in case housekeeping/data backup gets heartburn.
Not till you are satisfied all is well should you even vaguely consider wiping any added backups you have made during this dangerous process.
Very true. Now to continue this quest. I looked at the plugin but it is not widely used or so, not sure if I should add it so easily in terms of security. So I have modified my query as above, applied queries to statistics and statistics_short_term for sum and state columns after disabling the sensors by disabling the corresponding integration. Then directly restarted HA. It's weird, something seems to be adding back the deviation to the statistics. And it starts after reenabling the integration. So it must be something the integration does. Thanks for your help guys.