vaillant-component
vaillant-component copied to clipboard
Hourly updates from VR900?
Hi, I have managed to integrate the values from my VR900 (Gas for heating and water, as well as electricity for those) in my energy dashboard.
However, it seems these values are only updated once per day. Unfortunately, also the time when this is updated changes once in a while, which makes daily values in the energy dashboard quite useless because you often see spikes and valleys due to these changes.
In the Multimatic app, I can see hourly values. Would it be possible to also have the multimatic component provide hourly updates to the energy counters?
Hi,
EMF reports are refreshed every 30min. I don't have any EMF reports myself, so this is pretty hard to test.
But if you say, you can have hourly values in the APP, it should be possible to have it in the integration, I will have a look, but it may take some time to test.
Could you try to call multimatic.request_hvac_update service every ~30min ? The service is requesting an update to vaillant server, so the server will retrieve data from your installation.
Could you tell me how to do that?
You can create an automation like this:
- id: '1652122001949'
trigger:
- platform: time_pattern
hours: /1
condition: []
action:
- service: multimatic.request_hvac_update
data: {}
So I added the automation and in developer tools confirmed that it works and really executes every 60min, but no change. Any way I could debug this further?
No, I will see if I can do different queries to the API.
Hi, any updates to this? While recently updating my homeassistant to the newest version, I noticed that I got multiple readings over the day due to multiple reboots/restarts of homeassistant. So I think there must be something that can be done to get hourly updates...
Well, this is actually quite hard to do, mostly because of the error handling.
There is no hourly update API call out of the box. So the integration will have to guess all the parameters:
- which device is compatible (I would guess that all EMF devices are compatible, but not sure)
- time range, this one is quite easy since it's between hour H and H-1. But then comes the error handling, if the call for 10 to 11 fails, the integration has to remember the next call should be 10 to 12 and you will lose some precision on the energy dashboard
- function, the function for which you want the hourly consumption (cooling, dhw, heating, central heating). The integration can guess it based on the data inside the API (but it has still to be coded)
- energy type (CONSUMED_ELECTRICAL_POWER, CONSUMED_PRIMARY_ENERGY, ENVIRONMENTAL_YIELD, etc;)
- start and offset, I don't know exactly if these parameters can be usefull.
I can also lead to a lot of API calls (and we know that servers are not so stable), for example an heat pump can heat, cool and dhw it means the integration has to do 1 call per energy type (4?) per function (3?) = ~12 api calls
Please, also remember that the API is not documented at all, so I have to figure out what are the format of the parameters and they can influence the result.
Ok, I don't know too much about that, but how is it working now? Do you just connect daily? Or is there a callback from the API?
For now, consumptions sensors are refresh every 30min, but it sounds there is only one refresh per day at vaillant server side.
You should have an entity with an id like sensor.xxx_CONSUMED_ELECTRICAL_POWER
(and others). This is the total consumption from the beginning of your installation. This sensor is configured to work with energy dashboard (so the dashboard can extract the daily consumption).
As I said, this is apparently only refreshed once a day, which is not super accurate, but there is nothing to configure, so the API returns every compatible device and this is only one single API calls.
So how come I once got a result like this, I think when I restarted HA a couple of times due to updates:
Which entities are you using here ? Could you show the history for a specific entity (for 2 days for example) ?
As I said it sounds there is only one refresh per day at vaillant server side
. There is no doc explaining how they are gathering information from the installation nor how often they are doing it, so it's just assumption.
It could also be that your boiler didn't consume anything for one hour
These are my sources:
and here's the central heating eletrical power entity, for example (you can see the time around the updates there are more steps):
Ok, so it sounds like they are sometimes more than one update per day at vaillant server. But we can also see big jumps.
So honestly, I don't know what to do exactly. I can make the "consumption sensor refresh time" configurable, so people can put whatever they want and see if it helps to get accurate value
What is the refresh time in the current version?
This is 30min (and not configurable). There is also a refresh at every HA starts
This is interesting. 30min should be sufficient to record what I was seeing. Is there any difference in the way the integration refreshes when HA starts and in the regular 30min interval?
No, this is exactly the same code call
which one in your code?
Here: https://github.com/thomasgermain/vaillant-component/blob/master/custom_components/multimatic/coordinator.py#L149 to get me EMF report.
You can set the logger level to DEBUG to see when it does the call to the API
Ok, I'll monitor this some more. There do seem to be more frequent updates now, even without restarting. Maybe this is since the update to the new HA 2022.10 and update to the integration...
This may be silly, but could this be caused by some kind of faulty caching? Maybe it's necessary to add http headers to avoid caching? I'm asking this because years ago I had a similar behavior in one of my programs which called a web service.
It worth giving a try, I'll release a version with some cache request header
I installed the integration yesterday and also only had one or two consumption updates that day (and those were after I restarted HA I think).
Yesterday evening I created an automation running every hour to automatically reload the Multimatic integration and since then I have hourly gas consumption values in the energy dashboard.
So the data is there but something goes wrong while fetching it. I first tried the "request_hvac_update" service in the automation but that didn't work. Reloading the integration does.
@robbedenys are you using 1.13.0 ?
Yes, I am using 1.13.0.
I just noticed while comparing the values from the MultiMatic app and those from the HA Energy management, that the values from HA are two hours behind those in Multimatic. So my consumption between 0:00 - 1:00 this morning in multimatic is displayed as 2:00 - 3:00 in HA. The values are correct but everything is shifted two hours.
Having a automation which does the following works for me for having more than one update per day, but I think it messes with made settings like quick veto or something.
alias: "Reload: multimatic"
description: ""
trigger:
- platform: time_pattern
hours: /1
condition: []
action:
- service: homeassistant.reload_config_entry
data: {}
target:
device_id:
- c08629b3e68173000843656f3b33cf89
mode: single
Do you have fresh data everytime the integration is reloaded ?
I can see two main differences between a classic refresh and the reload of the integration:
- a new "technical" session is created (this is handled by HA itself)
- the integration re-authenticates
Yes after maybe 5 minutes after the restart I receive fresh data. Else I got 1 update per day.
So maybe the data slot freezes and can't get updated if not completely freed?
Is there any log I could provide?
I attached a screenshot, before and after.
and you get fresh data for 1h until next reload ? If yes, could you try to stop the automatic integration reload and see when data are not refreshed anymore ?
So maybe the data slot freezes and can't get updated if not completely freed?
Is there any log I could provide?
At this point I don't know exactly where to look at, but I will probably release a new version with more logs