signalkraft / mypyllant-component

Home Assistant component for the myVAILLANT API, controls Vaillant devices such as aroTHERM heatpumps and ecoTEC boilers
https://signalkraft.com/mypyllant-component/
MIT License
109 stars 19 forks source link

Daily energy consumption totals incorrect #40

Open ccle610 opened 8 months ago

ccle610 commented 8 months ago

Before submitting a new issue

Problem description

The totals are reset to zero at 0:30. No more values are recorded until 1:30 am. The values from 0:00 to 1:30 are lost for the day. As a test, the system was set to standby during this time, then the values fit.

Logs

The problem cannot be recorded in log files
signalkraft commented 8 months ago

The values aren't recorded incrementally, like you're describing.

The API returns the totals for the current day, so every hour (when the totals are updated by the integration) I just get the latest total value for that day. AFAIK there is no way to miss any energy values this way. But there may well be something wrong with timezones, or the way the values get reset within Home Assistant. I'm using total_increasing for the energy sensors.

I may be able to help, if you can provide more information (screenshots comparing the vaillant app and what you're seeing in HA).

ccle610 commented 8 months ago

HA_Energy MyVaillant

Thx for answering . . . and ok, I'll understood the Problem now ;-) Today the HP was not set to standby, so the difference is clearly visible on the Screenshots attached. I stay in Germany MEZ: UTC+1 and indeed, the gap is smaller since Wintertime startet. Formaly the consumption totals startet app. 3:00 AM - There is no settings in "myVaillant App" to set Timezone - but Germany was selected when I start the App first time.

Beside: Yesterday myVaillant App shows a Consuption of 8.8 kWh - in HA it was 8 kWh Maybe a Sensor can be created, showing the Values of Yesterday? So my Grafana will show more realistic graphs ;-)

rapton commented 6 months ago

I have also a problem in the logs. In Home Assistant it stop working at 00:35 - Happy New Year ;) The app says 0 value. I think this is the problem and why the state is "unknown".

Thanks for the great integration!

Bild 01 01 24 um 01 13

Bildschirmfoto 2024-01-01 um 01 14 05

`2024-01-01 00:53:59.673 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform mypyllant Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 509, in async_add_entities await asyncio.gather(*tasks) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 754, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1025, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 745, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 845, in _async_write_ha_state state, attr = self._async_generate_attributes() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 786, in _async_generate_attributes state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 751, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 501, in state value = self.native_value ^^^^^^^^^^^^^^^^^ File "/config/custom_components/mypyllant/sensor.py", line 776, in native_value return round(self.heat_energy_generated / self.energy_consumed, 1)


ZeroDivisionError: division by zero
2024-01-01 00:53:59.764 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up mypyllant platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 369, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 509, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 754, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1025, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 745, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 845, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 786, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 751, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 501, in state
    value = self.native_value
            ^^^^^^^^^^^^^^^^^
  File "/config/custom_components/mypyllant/sensor.py", line 776, in native_value
    return round(self.heat_energy_generated / self.energy_consumed, 1)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
ZeroDivisionError: division by zero`
beda162 commented 4 months ago

Hello everyone, I have the same problem. I came from Multimatic Integration and switched to MyVaillant. Since then, the values have differed significantly every day (HA and MyVaillant app). Sometimes there are 3-4kWh missing daily in HA. The Multimatic integration had added up the values in each case. Now the values are "reset" daily.

What is the smartest way to restore the status so that the values between the app and HA are consistent?

Many thanks (especially to the developer who makes it possible to read out the WP / HP in HA)!

mr-tichyt commented 4 months ago

Hello,

I have exactly the same problem and I think it may really be related to some issue with timezones.

If you check the image below, the first graph is my Shelly Energy meter on the main and the second is what the heat pump says. There is basically nothing else consuming power (<50W). You can see the same graph pattern, but about 4.5 hours delayed. Why? My timezone is CET+1 on both the device and HA.

Any ideas?

Screenshot 2024-03-06 at 18 25 58

mr-tichyt commented 4 months ago

...and also to add, if I check my energy dashboard, the difference between what Shelly measured and what the heat pump reports as consumption differs exactly by what was consumed by the heat pump in the last 4.5 hours of every day...

beda162 commented 4 months ago

In my case, both the Raspberry with HA and the Vaillant system have the same time / time zone setting (Europe/Berlin).

mr-tichyt commented 4 months ago

If you compare the heat pump current power graph with flow temperature, does it match or is it also shifted by some time as for me? The power readings are completely off in my case and I assume it will break the consumption alignment for a day...

signalkraft commented 3 months ago

I posted a more thorough explanation about this problem at the very bottom off this page.

TilmannBach commented 3 months ago

@signalkraft thanks very much for this detailed explanation on the docs page! this helps me alot to understand the problem.

Am I right: we cannot do something against this problem? Is there a discussion at Vaillant or in HomeAssistant to upvote?

ccle610 commented 3 months ago

So I think, there is nothing to do here. I will close this Issue for this reason. Thank you for explaining, Signalkraft!

beda162 commented 3 months ago

I would leave the bug open. It's a problem that many people will stumble across during the heating period. Perhaps you can at least write the lost values to the following day so that the overall balance is at least consistent again.