krahabb / meross_lan

Home Assistant integration for Meross devices
MIT License
450 stars 47 forks source link

Issues with long term statistics since 2024.10 #496

Closed override80 closed 1 month ago

override80 commented 1 month ago

Since home assistant la test update, i am getting the error attached on a specific mss310 plug.

Screenshot_20241005-072610_Home Assistant

Any idea of what could be wrong?

PS the sensor is the W consumption ine

override80 commented 1 month ago

I'm also getting this one @krahabb :

image

it seems that it's happening when the consumption drops to zero, if it helps

krahabb commented 1 month ago

I'm starting debugging a bit of issues with HA core 2024.10...this is nevertheless very strange since nothing changed in meross_lan for the matter about mss310 sensors...and the native unit should still be W unless you've changed that in your entity configuration/customization.

I'll let you know

krahabb commented 1 month ago

Hello @override80, Sadly enough..after testing over HA core 2024.10 and also upgrading to the new HA core on my 'production' instance I didn't encounter any particular issue with the mss310's data (lucky that I own it myself so I could check)

Nevertheless, while testing and checking the upgrade of my production instance I've seen many issues in the STATISTICS management page related to different entities of my instance, very similar to yours where some entities experienced a sudden change of unit from what is stored in statistics (while I'm pretty sure they didn't since they're mostly 'template' entities which I didn't touch). Now, I could guess this is more of a recorder 'migration' issue (migrations seems to be ubiquitus happening at every new HA core release). Tbh, I didn't check the HA core issue threads for clues about this kind of issue but it might be worth the effort, especially in order to find some fixes/workaround. I guess, in order to not loose the data, it is mandatory to manually edit the db...

override80 commented 1 month ago

Hi @krahabb , do you think it could be related to this: https://github.com/home-assistant/core/pull/127243? I see different issues on core related to missing units in statics when data drops to 0 for long. It's weird that it is only happening on meross plugs and not - for example - on solar panel sensor (which drops to 0 as well during night).

krahabb commented 1 month ago

I've digged a bit into https://github.com/home-assistant/core/pull/127243 and it really looks like it...somehow the 2024.10 release is a bit picky. I guess there's a design error somewhere since the sensor definition (in meross_lan but I guess in many other reported similar issues) does not change in code .. What I don't understand is if that PR made it to the official 2024.10 release or is still to be deployed to the public..we'll see Maybe there's more to it (that need fixing..) but I'm strongly convinced now the issue lies in HA core

override80 commented 1 month ago

Yeah, looks like there are tons of open issues about this. This one also seems relevant, and this. This PR should have fixed it, but to my understanding it deals only with unavailable/unknown states and not with the sensor being 0 for a certain amount of time.

override80 commented 1 month ago

@krahabb In the end i fixed it by deleting the home assistant DB and starting ftom scratch. Or maybe it was 2024.10.2... In any case, definitively not related to meross_man itself.

Thanks for your cooperation!