mypyllant-component icon indicating copy to clipboard operation
mypyllant-component copied to clipboard

Energy consumption is always underrated (one missing value per day)

Open theodiefenthal opened this issue 7 months ago • 1 comments
trafficstars

Before submitting a new issue

Problem description

The vaillant API reports energy consumption values in buckets of one hour, e.g.

    {
      "startDate": "2025-03-28T18:00:00+01:00",
      "endDate": "2025-03-28T19:00:00+01:00",
      "value": 0.0
    },
    {
      "startDate": "2025-03-28T19:00:00+01:00",
      "endDate": "2025-03-28T20:00:00+01:00",
      "value": 33.8123415046492
    },

It takes vaillant API some time to report the value of a bucket. If e.g. it now is 09:20, I will not see any value for the 09:00-10:00 bucket. Vaillant reports the value as "null". Only after some latency, the value of the prior bucket can be queried. That is, e.g. at 10:20 i might be able to query the bucket 09:00-10:00.

The plugin here does not simply report the last bucket but instead reports the daily aggregate. That is, it queries vaillant bucket API with the following range of buckets:

                start = dt.now(system.timezone).replace(
                    microsecond=0, second=0, minute=0, hour=0
                )
                end = start + timedelta(days=1)

That will always lead to the last bucket of a day not being reported to home assistant. The last bucket 23:00-24:00 will only have its values available some time after the end of the day (be it seconds or minutes). But the next plugin run will always query starting at 00:00 of the same day, hence the bucket 23:00-24:00 will never be included in any sum reported to home assistant.

I am not entirely sure how to solve this though. My feeling is that reporting the Vaillant API values as unmodified as possible would be nice (Report always only the last bucket, do not aggregate yourself), but then if the plugin doesn't run for an hour, we also miss some values whereas the current solution is more stable in a sense that if the plugin was down e.g. from 12:00-14:00, the next time it reports a value it contains the missing ones as well if they happened on the same day. I did not dive to deep into the vaillant API, but in my vaillant app, I can also get a "year view" with the used energy from the total year. => that might be a better reference as a continuously reported counter, missing one bucket only once a year if that yearly counter is also updated once an hour...

theodiefenthal avatar Mar 29 '25 08:03 theodiefenthal

I'm not sure if this can solve the problem you are discussing, but using an automation you can fetch energy data when you desire (at a time of your choice). Look here https://github.com/signalkraft/mypyllant-component/issues/296#issuecomment-2745146540

gio-dot avatar Mar 29 '25 11:03 gio-dot

@theodiefenthal still an issue?

boelle avatar May 13 '25 09:05 boelle

yes, this issue requires code adjustments and there hasn't been a new release since I opened it.

theodiefenthal avatar May 13 '25 22:05 theodiefenthal

Isn't the problem and the cause described in the documentation?

https://signalkraft.com/mypyllant-component/#energy-efficiency-sensors-are-delayed-incomplete-behave-oddly-around-midnight

It looks like a problem that isn't solvable with the current state of homeassistant and the Vaillant API ...

Wolfgang

wolfma61 avatar Jul 25 '25 13:07 wolfma61

@signalkraft poke

boelle avatar Oct 26 '25 09:10 boelle