Closed maia closed 4 months ago
it should do a re-import of all historic data if you delete the integration and also delete the statistics, then re-install the integration.
Thanks. I was hoping for something easier and I was wondering if that is an issue related to the install – because if yes, then a fresh install won't really help.
I've now had a third day reporting a negative usage amount (which is impossible, as I do not generate energy), and then no new data since.
I would like to suggest to implement a service that one can trigger to re-import the data? There must be an easier way than to uninstall, delete all sensor data manually, reboot, reinstall each time the API returns wrong data for a brief moment.
PS: This here seems to be related: https://github.com/DarwinsBuddy/WienerNetzeSmartmeter/issues/216#issuecomment-1922181563
I now had another day of -3.89kWh negative consumption, with only this value set for 12:00-13:00 and no other values for the other hours for the day. Interestingly this amount is exactly the sum of my hourly usage on the prior day (which at least displays proper values for each hour from 12:00 to 24:00).
This problem sounds like that the statistics sensor and the meter are reporting into the same statistics. If they do, the values cancel each other out and you see these negative records.
Do you still have the two sensors? One with _statistics
appended and one without? Does you _statistics
sensor has a value? It should say no value available, because otherwise the statistics module gets confused...
@reox I deactivated the two sensors of the place I've moved out a few years ago and kept the two sensors for the current place I live at. And I've used the _statistics
sensor in the energy panel configuration:
Is that a wrong setup?
ah, thanks for the hint. This might be a regression of https://github.com/DarwinsBuddy/WienerNetzeSmartmeter/commit/821b76d84f148b31695e52c217a55b0249de912f
@DarwinsBuddy could that be the case? I think the problem is, if the sensor state is set to 0, the statistics module will interpret this as negative consumption.
Thanks @reox for mentioning me. I did not have the time to follow up on issues yet. I just looked over your conversation and I agree it has to be correlated with my latest commits.
Two things are possible:
though I'd also first look into 1., but can probably earliest look into it on Sunday (if even).
@maia thank you so much for your time to report everything so clearly. it's really helpful. re: a service to trigger re-import that's possible I guess, though I'd be missing a thing right now to imagine it: @reox Is there a way (other than calling the purge entities service) to get rid of all the data of an entity programmatically managed by the recorder?
@reox Is there a way (other than calling the purge entities service) to get rid of all the data of an entity programmatically managed by the recorder?
This is definitely possible via the GUI but I'm not sure if a API exists. I cannot find anything here: https://github.com/home-assistant/core/blob/dev/homeassistant/components/recorder/statistics.py
@reox Is there a way (other than calling the purge entities service) to get rid of all the data of an entity programmatically managed by the recorder?
This is definitely possible via the GUI but I'm not sure if a API exists. I cannot find anything here: https://github.com/home-assistant/core/blob/dev/homeassistant/components/recorder/statistics.py
Seems like there is a possibility to call services within a custom component, but there is no possibility in doing this "on upgrading the integration".
I could think of a way of enabling this via the config flow. Though it would not be much of a difference compared to what's described in the FAQs.
I've managed to get wnsm to run two days ago after figuring out that I may not use a "Spitzname" in the Wiener Netze dashboard, as that confuses the HA integration. Finally the import worked fine and everything looked okay. But on the next day the data was completely messed up, it shows -188 kWh for that day, with only a single measurement at 12:00. The Wiener Netze dashboard looks fine.
Is there a way to trigger a reimport of the available data? Is this a common issue for the day that the integration is setup? Is there a workaround? Thanks. (I don't have any logs for that day as I rebooted HA twice since)