DarwinsBuddy / WienerNetzeSmartmeter

A home-assistant integration supporting WienerNetze Smartmeters as sensors
121 stars 12 forks source link

Energy Dashboard shows feeding without actually feeding in place #219

Closed stefanschramek closed 3 months ago

stefanschramek commented 4 months ago

Hi, as I had some issues the last days - missing data points and if they are shown it was wrong data, I deleted the integration and historical data and started from scratch. Everything showed as correct, but now I realized that it shows that I seemed to feed around 12kwh today. But I do not feed energy at all.

energy

I found this entry - it is around the time when I setup the integration

energy_stat

It seems there is some calculation wrong imho. TIA

maparth commented 4 months ago

+1

2023alpha2023 commented 4 months ago

same issue. I followed the FQA (How can I start over with a fresh data import?), for 2 days this approach was working. But there is a new issue: I have two Zählpunkte: Zählpunkt 1: two entities (normal and statistic) Zählpunkt 2: one entity (just the normal one).

Bildschirmfoto 2024-02-12 um 20 15 06

(blue: consumption, yellow: production: missing: Feed-in, in January this was working)

Furthermore, when I set Zählpunkt 1 in the smart meter portal, in Home Assistent the kWh is only shown for Zählpunkt 1, no data is shown for Zählpunkt 2. When I set Zählpunkt 2 in the smart meter portal, in Home Assistent the kWh is only shown for Zählpunkt 2, no data is shown for Zählpunkt 1

After one das i have a negativve consumption Screenshot_20240213-052636

andreasgily commented 4 months ago

Bildschirmfoto von Google Chrome am 13_02_2024, 12_12_38

I have a similar problem here - I cleaned my database of the old stats data, which worked perfectly - wnsm re-imported all the missing stats after a restart, but now I somehow got a negative value at lunchtime today (there shouldn't be any stats available, only from yesterday). I suspect there is some misinterpretation of the API happening somehow?

adamnet01 commented 4 months ago

The same thing happens to me after reloading the integration. This problem has been occurring since the beginning of this year. Screenshot_20240213_172436_Home Assistant

mgmomo commented 4 months ago

Hi, I have the same problems. I have removed the integration according to the FAQ. After a new setup, there are zero values in the database and it looks like the difference between the last regular total value and the zero value is displayed as a negative bar. With the zero values there is no update on the following days.

image

image

rolandpj commented 4 months ago

I have this issue since Version 1.4.1. Version 1.4.0 was the last version that worked fine

codegain commented 4 months ago

Same here, Version 1.4.0 is the last working version for me. I upgraded to all versions from 1.4.1 to the latest (1.4.6). Some of them import the historical data correctly, but don't update them anymore (= days of just empty data).

And some of the later versions add a huge negative kWh usage right after importing the historical data. I followed the FAQ, purged all the data, sensors, entites etc., restarted and reinstalled the integration.

salzrat commented 4 months ago

I have the same problem. 1.4.6. I suddenly got a -20kwh negative bar, and no input since then. Also followed the FAQ on reimporting, didn't do anything. Still no data after Feb 14, except for some huge negative bars on some days... And I only have one Zählpunkt, no feeding...

salzrat commented 4 months ago

has anybody tried going back to 1.4.0? Does this solve the problem?

stefanschramek commented 4 months ago

has anybody tried going back to 1.4.0? Does this solve the problem?

Not yet - I thought it is just a quick fix and worth to wait for it!

rolandpj commented 4 months ago

I did it a couple of times... upgraded to 1.4.2 and went back to 1.4.3 and went back... worked all the time. But after 1.4.6 i also tried to go back but I am not able to get it running again because statistics entity is not beeing created Unfortunately version selector of HACS does not offer 1.4.0 and it has to be done manually

salzrat commented 4 months ago

so currently no way to get it running again?

reox commented 4 months ago

I never updated on my HA and still use 8a45fc1c68ee9c3d41212831ae9f5c17bdc93cb7 At least that version is working for me. This bug seems to be introduced with one of the commits after that. One could try to git-bisect, however it would be a tedious debugging, as you had to wait a day for new data, right?

salzrat commented 4 months ago

Interesting. So for me 1.4.0 (and I believe 1.4.1, still have to check) produce fresh data. Haven't tried wiping the old data yet. But 1.4.2 produces: ` Logger: homeassistant.loader Source: loader.py:847 First occurred: 12:46:52 (1 occurrences) Last logged: 12:46:52

Unexpected exception importing platform custom_components.wnsm.sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/loader.py", line 847, in get_platform cache[full_name] = self._import_platform(platform_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 864, in _import_platform return importlib.import_module(f"{self.pkg_path}.{platform_name}") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/importlib/init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 994, in exec_module File "", line 488, in _call_with_frames_removed File "/config/custom_components/wnsm/sensor.py", line 26, in from .statistics_sensor import StatisticsSensor File "/config/custom_components/wnsm/statistics_sensor.py", line 7, in from .base_sensor import BaseSensor File "/config/custom_components/wnsm/base_sensor.py", line 31, in class BaseSensor(SensorEntity, ABC): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 414, in init wrap_attr(cls, property_name) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 386, in wrap_attr raise TypeError(f"Can't override {attr_name} in subclass") TypeError: Can't override _attr_state_class in subclass `

reox commented 4 months ago

Yep, there were some regressions introduced in the meantime.

However, I do not understand what is going on... It is some homeassistant thing and I saw this behaviour too when testing: It happenend if the state of the statistics sensor was set to 0. Then, HA assumes that all the statistics were compensated and added this negative number. However, we do not do this - or do we? Do I miss something?

salzrat commented 4 months ago

I have no idea, but the problem is that afterwards, no new values are reported anymore...

reox commented 4 months ago

Oh, wait! https://github.com/DarwinsBuddy/WienerNetzeSmartmeter/commit/821b76d84f148b31695e52c217a55b0249de912f

https://github.com/DarwinsBuddy/WienerNetzeSmartmeter/blob/2aeed69e52595e7157b06a579eeef739f242838a/custom_components/wnsm/statistics_sensor.py#L131

This might be the issue. Can you try to just comment out this line?

salzrat commented 4 months ago

in which version?

codegain commented 4 months ago

@reox I did completely purge the data (described in the FAQ), installed v1.4.6, commented out that line + restart. Then did a fresh historical import of the data (up to 29.2.2024)

So far all historical data has been correctly imported with no negative kwh entries in the energy dashboard. Will report back tomorrow if data is being correctly imported for 1.3.2024.

reox commented 4 months ago

in which version?

In master, i.e. 1.4.6

@reox I did completely purge the data (described in the FAQ), installed v1.4.6, commented out that line + restart. Then did a fresh historical import of the data (up to 29.2.2024)

sounds good!

salzrat commented 4 months ago

Amazing, this works! After deleting as described in the FAQ, all the historic data is is imported correctly! Holding fingers crossed for import tomorrow :)

2023alpha2023 commented 4 months ago

I can also confirm that the purge, as described in the FAQ works. Hopefully longer than one day. I have still an other issue, my second zählerpunkt is not working. This is also strange due to the fact that these zählerpunkt was also working with an old version

codegain commented 4 months ago

So far all historical data has been correctly imported with no negative kwh entries in the energy dashboard. Will report back tomorrow if data is being correctly imported for 1.3.2024.

@reox Can confirm your proposed change in v1.4.6 solves the negative kwh and also imports fresh data. As of today I have data for 1.3.2024. Thanks!

salzrat commented 4 months ago

Same here, works!

2023alpha2023 commented 4 months ago

@salzrat : how die you managed this? I purge the data according to the fqa but i got negative values. I use Version 1.4.6.

salzrat commented 3 months ago

Comment out the line indicated by @reox before reinstallation (in the wnsm installation subdirectory in the homeassistant config directory).

codegain commented 3 months ago

@2023alpha2023 I used the "File editor" Addon (installable via settings -> addons). Then open it and simply navigate to custom_components/wnsm/statistics_sensor.py, find line 131 and add a # before it. Save + restart Home Assistant (or just edit the file the way you're familiar with).

stefanschramek commented 3 months ago

Thank you for your effort, guys!!! Very much appreciated!

2023alpha2023 commented 3 months ago

@2023alpha2023 I used the "File editor" Addon (installable via settings -> addons). Then open it and simply navigate to custom_components/wnsm/statistics_sensor.py, find line 131 and add a # before it. Save + restart Home Assistant (or just edit the file the way you're familiar with).

thank perfekt it works. I have still the second issue. I have two zähler punkte but only 3 entities. The statistic entity für the second zählerpunkt is missing.

W-M-B commented 3 months ago

The same thing happens to me after reloading the integration. This problem has been occurring since the beginning of this year. Screenshot_20240213_172436_Home Assistant

Same here: I had issues in January, upgraded to the latest version. First loading was good, then I had the same issues s other mentioned. I deleted everything according to the faq section. But no improvement: First loading is good. All data later on after initial load is wrong. Currently I cannot use the integration 😞.

rolandpj commented 3 months ago

The same thing happens to me after reloading the integration. This problem has been occurring since the beginning of this year.

Same here: I had issues in January, upgraded to the latest version. First loading was good, then I had the same issues s other mentioned. I deleted everything according to the faq section. But no improvement: First loading is good. All data later on after initial load is wrong. Currently I cannot use the integration 😞.

This seems to be fixed and fix is confirmed by a couple of users.. just waiting for the release :-)