core icon indicating copy to clipboard operation
core copied to clipboard

ViCare consumption values not the same as in ViCare app or on Viessmann devive

Open FPF92 opened this issue 1 year ago • 56 comments

The problem

Hello,

I have the problem that the consumption values are incorrect or at least are not the same as in my ViCare app.

  • sensor.e3_vitocal_dhw_energy_consumption
  • sensor.e3_vitocal_heating_energy_consumption_today
  • sensor.e3_vitocal_energy_consumption_today

For example: heating energy shows 11.2kWh and in the iOS ViCare app 6.18kWh for electric heating energy and 38,9 kWh thermic energy.

Can somebody help me?

thank you

What version of Home Assistant Core has the issue?

2024.10.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

ViCare

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

FPF92 avatar Oct 19 '24 19:10 FPF92

Hi @FPF92

We use GitHub for tracking issues with Home Assistant Core itself, not for providing support - so if you could provide more details like logs or any other helpful diagnostics data or error details or steps how to reproduce or your configuration, than we can handle it as an issue report, else it is a support request and you should try our Community Forum or join our Discord chat server.

Thanks! 👍

mib1185 avatar Oct 19 '24 20:10 mib1185

I can understand that you would like to have an information about the bug and the logs.

I assume that the logs are not helpful. How should I provide information of the difference in the values of the ViCare app and the HA Integration.

Perhaps there is a wrong mapping of the API.

FPF92 avatar Oct 20 '24 05:10 FPF92

I assume that the logs are not helpful.

the debug logs might show us, what values are fetched from the device. in combination with screenshots from the app, we might be able to compare both

mib1185 avatar Oct 20 '24 11:10 mib1185

Hey there @cfenner, mind taking a look at this issue as it has been labeled with an integration (vicare) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of vicare can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign vicare Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


vicare documentation vicare source (message by IssueLinks)

home-assistant[bot] avatar Oct 20 '24 11:10 home-assistant[bot]

HA just displays what we get from the API. Can you share the diagnostics file so we can get more insights?

If you have a difference with the API values and the ViCare app I would indeed suggest to raise this in https://community.viessmann.de

CFenner avatar Oct 20 '24 20:10 CFenner

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

I have the same problem since Nov 6. And the problem persists with HA 2024.10.4/.11.0/.11.1.

Looking at the logs (with debug enabled) you see:

2024-11-09 15:04:49.653 DEBUG (SyncWorker_45) [homeassistant.components.vicare.utils] Found entity energy_dhw_summary_consumption_heating_currentday
2024-11-09 15:04:49.655 DEBUG (SyncWorker_45) [homeassistant.components.vicare.utils] Found entity energy_dhw_summary_consumption_heating_currentmonth
2024-11-09 15:04:49.656 DEBUG (SyncWorker_45) [homeassistant.components.vicare.utils] Found entity energy_dhw_summary_consumption_heating_currentyear
2024-11-09 15:04:49.656 DEBUG (SyncWorker_45) [homeassistant.components.vicare.utils] Found entity energy_summary_dhw_consumption_heating_lastsevendays
2024-11-09 15:04:49.653 DEBUG (SyncWorker_45) [homeassistant.components.vicare.utils] Found entity energy_dhw_summary_consumption_heating_currentday
2024-11-09 15:04:49.655 DEBUG (SyncWorker_45) [homeassistant.components.vicare.utils] Found entity energy_dhw_summary_consumption_heating_currentmonth
2024-11-09 15:04:49.656 DEBUG (SyncWorker_45) [homeassistant.components.vicare.utils] Found entity energy_dhw_summary_consumption_heating_currentyear
2024-11-09 15:04:49.656 DEBUG (SyncWorker_45) [homeassistant.components.vicare.utils] Found entity energy_summary_dhw_consumption_heating_lastsevendays

There is nothing else in the log that aids debugging. While I have the odd warning about timeouts on sensor updates it also shows for sensors that show actual values

024-11-09 15:06:55.904 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating vicare binary_sensor took longer than the scheduled update interval 0:00:30
2024-11-09 15:06:55.905 WARNING (MainThread) [homeassistant.components.number] Updating vicare number took longer than the scheduled update interval 0:00:30
2024-11-09 15:06:55.905 WARNING (MainThread) [homeassistant.components.sensor] Updating vicare sensor took longer than the scheduled update interval 0:00:30
2024-11-09 15:06:55.909 WARNING (MainThread) [homeassistant.helpers.entity] Update of climate.vicare_heating_2 is taking over 10 seconds
2024-11-09 15:06:55.910 WARNING (MainThread) [homeassistant.helpers.entity] Update of water_heater.vicare_water_2 is taking over 10 seconds
2024-11-09 15:06:55.912 WARNING (MainThread) [homeassistant.helpers.entity] Update of binary_sensor.vicare_circulation_pump_active_2 is taking over 10 seconds
2024-11-09 15:06:55.912 WARNING (MainThread) [homeassistant.helpers.entity] Update of number.warmepumpe_warmwasser_hystereseschalter_ein is taking over 10 seconds
2024-11-09 15:06:55.912 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.vicare_return_temperature is taking over 10 seconds

Unfortunately, there is no name/id for the sensor so I cannot tell if this is for the energy sensors or not.

Other tips how to triage?

thestonewell avatar Nov 09 '24 14:11 thestonewell

heatpump.log

Let me add though. There are some entries that look suspicious:

2024-11-09 15:29:32.090 DEBUG (SyncWorker_39) [homeassistant.components.vicare.utils] Found entity power consumption today
2024-11-09 15:29:32.090 DEBUG (SyncWorker_39) [homeassistant.components.vicare.utils] Feature not supported power consumption this week: 'HeatPump' object has no attribute 'getPowerConsumptionThisWeek'
2024-11-09 15:29:32.090 DEBUG (SyncWorker_39) [homeassistant.components.vicare.utils] Feature not supported power consumption this month: 'HeatPump' object has no attribute 'getPowerConsumptionThisMonth'
2024-11-09 15:29:32.090 DEBUG (SyncWorker_39) [homeassistant.components.vicare.utils] Feature not supported power consumption this year: 'HeatPump' object has no attribute 'getPowerConsumptionThisYear'

Feels like an API change to me...

thestonewell avatar Nov 09 '24 14:11 thestonewell

Well. I could resolve it by going to https://viguide.viessmann.com/installations and login in with my ViCare app details. While it says it is just for partners, you can also use it as private person.

Turns out the logs showed a reset/status change of the communication module on 6 Nov - the day the APIs would report no values anymore.

After restarting the communication module magically all values are reported again. I trust you can restart from the device panel as well.

thestonewell avatar Nov 09 '24 15:11 thestonewell

@thestonewell thanks mate, that was it. Neither the app nor the page said anything about an error but the power consumption was 0 everywhere. I restarted the gateway as you said and it works now. what a weird thing 😅

bneumann avatar Nov 10 '24 09:11 bneumann

@bneumann, don't celebrate too early: it worked for the rest of yesterday. This morning though the power consumption metrics got stuck again.

Using the PyViCare library directly I can see that the values from the API calls exactly resemble what you see in HA.

Attaching my device dump for reference: E3_Vitocal.json

        {
            "apiVersion": 1,
            "commands": {},
            "deviceId": "0",
            "feature": "heating.power.consumption.summary.heating",
            "gatewayId": "################",
            "isEnabled": true,
            "isReady": true,
            "properties": {
                "currentDay": {
                    "type": "number",
                    "unit": "kilowattHour",
                    "value": 0.7
                },
            },
            "timestamp": "2024-11-10T08:52:44.025Z",
            "uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/0/features/heating.power.consumption.summary.heating"
        },

currentDay is stuck again at 0.7. Same as it was before the device restart.

@CFenner , this feels to be an issue at Viessmann end not your library. Any idea how to engage with them and report it is bug their end?

thestonewell avatar Nov 10 '24 09:11 thestonewell

community.viessmann.com

But Support is not very active there.

CFenner avatar Nov 10 '24 09:11 CFenner

See https://community.viessmann.de/t5/The-Viessmann-API/API-Power-Consumption-empty/td-p/481779

thestonewell avatar Nov 10 '24 10:11 thestonewell

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@thestonewell, it works for now after restarting the communication module. the diagnostic info downloaded in HA was showing data from last year before the restart.

but only for a day, then daily restarts of communication module is needed.

Thank you.

drifter75 avatar Nov 30 '24 13:11 drifter75

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

I did some digging into the app because the power levels are displayed correctly there. I found that they are not using their own endpoints. Instead they have this here endpoint now: https://api.viessmann.com/iot/v1/analytics-api/dataLake/chronos/v0/thermal_energy which has a POST method and you can send data to it like in my case and my app:

{
    "device_id": "0",
    "end_datetime": "2025-01-01T00:00:00",
    "gateway_id": "<YOUR GATEWAY ID>",
    "properties": [
        "electricity.consumption.total",
        "electricity.consumption.usage.domesticHotWater",
        "electricity.consumption.usage.domesticHotWater.percent",
        "electricity.consumption.usage.cooling",
        "electricity.consumption.usage.cooling.percent",
        "electricity.consumption.usage.centralHeating",
        "electricity.consumption.usage.centralHeating.percent",
        "electricity.consumption.device.electricHeater.percent",
        "electricity.consumption.device.electricHeater",
        "electricity.consumption.device.compressor.percent",
        "electricity.consumption.device.compressor",
        "thermal.output.total",
        "thermal.output.usage.cooling",
        "thermal.output.usage.cooling.percent",
        "thermal.output.usage.domesticHotWater",
        "thermal.output.usage.domesticHotWater.percent",
        "thermal.output.usage.centralHeating",
        "thermal.output.usage.centralHeating.percent"
    ],
    "resolution": "1d",
    "start_datetime": "2024-12-01T00:00:00"
}

This returns a lot of information about your electricity and compressor usage. There is also a very interesting web socket connection that continously gets information pushed to the app, but I wasn't able to figure out how to use it for my own cause.

Anyways, is this the right forum for this?

bneumann avatar Dec 25 '24 17:12 bneumann

@CFenner would this be a potential solution for https://github.com/home-assistant/core/issues/130273 ? Both ways, probably that should be included here? https://github.com/openviess/PyViCare Or how do we get the values into the HA integration?

x4N70pHyLL avatar Dec 28 '24 21:12 x4N70pHyLL

It is possible. Its a bit more tricky to setup though because you need an access token that gets created with your app credentials. The app access token has higher priviliges which in turn gives you more information compared to the public API endpoints, e.g. current power consumption. These are also more reliable, meaning I don't have any outages like described in this issue.

MojoOli avatar Jan 02 '25 19:01 MojoOli

It is possible. Its a bit more tricky to setup though because you need an access token that gets created with your app credentials. The app access token has higher priviliges which in turn gives you more information compared to the public API endpoints, e.g. current power consumption. These are also more reliable, meaning I don't have any outages like described in this issue.

Since when are you using it, does it seem reliable so far? How would you set it up? Sound like it would be quite some work to do to integrate it in the HA ViCare Integration?

x4N70pHyLL avatar Jan 02 '25 21:01 x4N70pHyLL

Since when are you using it, does it seem reliable so far?

Using it since 2 days now, didnt have any issues. Made a custom component and disabled the official one for now. Its pretty much tailored to my setup atm.

MojoOli avatar Jan 02 '25 22:01 MojoOli

I did some digging into the app because the power levels are displayed correctly there. I found that they are not using their own endpoints. Instead they have this here endpoint now: https://api.viessmann.com/iot/v1/analytics-api/dataLake/chronos/v0/thermal_energy which has a POST method and you can send data to it like in my case and my app:

{
    "device_id": "0",
    "end_datetime": "2025-01-01T00:00:00",
    "gateway_id": "<YOUR GATEWAY ID>",
    "properties": [
        "electricity.consumption.total",
        "electricity.consumption.usage.domesticHotWater",
        "electricity.consumption.usage.domesticHotWater.percent",
        "electricity.consumption.usage.cooling",
        "electricity.consumption.usage.cooling.percent",
        "electricity.consumption.usage.centralHeating",
        "electricity.consumption.usage.centralHeating.percent",
        "electricity.consumption.device.electricHeater.percent",
        "electricity.consumption.device.electricHeater",
        "electricity.consumption.device.compressor.percent",
        "electricity.consumption.device.compressor",
        "thermal.output.total",
        "thermal.output.usage.cooling",
        "thermal.output.usage.cooling.percent",
        "thermal.output.usage.domesticHotWater",
        "thermal.output.usage.domesticHotWater.percent",
        "thermal.output.usage.centralHeating",
        "thermal.output.usage.centralHeating.percent"
    ],
    "resolution": "1d",
    "start_datetime": "2024-12-01T00:00:00"
}

This returns a lot of information about your electricity and compressor usage. There is also a very interesting web socket connection that continously gets information pushed to the app, but I wasn't able to figure out how to use it for my own cause.

Anyways, is this the right forum for this?

Thanks for the hint :-) For me the props are slightly different... to get my daily energy usage I've implemented a node-red flow with this body for the post request based on your tips:

const atoken = flow.get('access_token')
msg.headers = {
    Authorization: "Bearer "+ atoken
}

const today = new Date();
today.setHours(0, 0, 0, 0);
const tomorrow = new Date(today);
tomorrow.setDate(tomorrow.getDate() + 1);


msg.payload = {
    "device_id": flow.get('deviceID'),
    "gateway_id":  flow.get('gatewaySerial'),
    "properties": [
        "heating.power.consumption.total",
        "heating.power.consumption.heating",
        "heating.power.consumption.dhw",
        "heating.power.consumption.cooling"
    ],
    "resolution": "1d",
    "start_datetime": today,
    "end_datetime": tomorrow
}

return msg;

This seems to be where my vicare requests the energy data.

flecmart avatar Jan 08 '25 08:01 flecmart

That's interesting. Has anyone found the data points for the Energy Cockpit in the App? (Where it shows the "instantanious" electric power going in and the thermal power going out)

I think that this would probably be against the TOS of Viessmann in some kind of way, since these endpoints are not officially documented, right?

benniju avatar Jan 08 '25 09:01 benniju

Yeah its GET https://api.viessmann.com/iot/v2/features/installations/[installation ID]/gateways/[gateway ID]/devices/[device ID]/features/heating.power.consumption.current. These APIs are also not locked behind the API limit btw.

MojoOli avatar Jan 08 '25 10:01 MojoOli

Nice find, that's even better than the ones I found. How did you get them? Because I was actually looking for exactly that kind of endpoints and didn't see them in my trace

bneumann avatar Jan 08 '25 15:01 bneumann

Well I tried your body and got in the response sth like UNKNOWN PROPERTIES. So I just guessed that in it might be the same property names as the ones in the documented api endpoints 😄

flecmart avatar Jan 08 '25 15:01 flecmart

Oh right! Now that you mentioned it I recall that I got the same response but didn't think further. But if it's just some undocumented props we could actually patch the component right?

bneumann avatar Jan 08 '25 15:01 bneumann

Nice find, that's even better than the ones I found. How did you get them? Because I was actually looking for exactly that kind of endpoints and didn't see them in my trace

When you are on the statistics page in the App, there is a websocket running. In the requests/responses you will find these feature names.

MojoOli avatar Jan 08 '25 15:01 MojoOli

Well I tried your body and got in the response sth like UNKNOWN PROPERTIES. So I just guessed that in it might be the same property names as the ones in the documented api endpoints 😄

Do you mean adding heating.power.consumption.current to the thermal_energy request? If so, that one only works via the specific REST call or if you implement the websocket.

MojoOli avatar Jan 08 '25 17:01 MojoOli

No I just meant the properties suggested by @bneumann earlier did not work for me in the thermal energy request but the ones I was using with the documented iot api were working, e.g. heating.power.consumption.total

flecmart avatar Jan 08 '25 22:01 flecmart