thomasgermain / pymultiMATIC

Python interface with Vaillant multiMATIC
MIT License
56 stars 11 forks source link

How to check the current action: standby vs heating vs cooling vs hotwater vs hotwater boost? #114

Closed wimleers closed 10 months ago

wimleers commented 1 year ago

Hi!

I'm trying to use your awesome pymultiMATIC library to determine what the current action is that the system is applying:

Why? Because I want to be able to correlate the energy consumption that I'm monitoring independently with a Shelly Pro 3 EM with the actions that are taking place. Without that correlation, the energy consumption patterns are impossible to interpret.

I searched through the codebase multiple times now.

Found:

Surely there must be some indicator in the API that shows the current action? Surely this must not be deduced from FlowTemperatureSensor? So far the best I've come up with is:

(I've noticed that active_function is often wrong for minutes: it will still be COOLING when it hasn't been doing anything for minutes based on both energy consumption measured through the Shelly as well as the reported flow temperature!)

thomasgermain commented 1 year ago

Hello,

Interesting project ! I'm glad pymultimatic can help you.

First of all, as far as I know, there is no way to know that. The API will tell you what the system is supposed to do, but not what it is actually doing (e.g. if you ask to heat to 22°C but it is 21.8, I'm pretty it won't actually heat). pymultimatic can only give you what you can see in the mobile application, there is no magic here :smile:

I'll start with the simplest one to detect: hotwater boost. You can call SystemManager#get_quick_mode. But by experience, I would not use the quick mode to trigger hot water. Quick modes are annoying to handle: if you activate one, the previous one (if any) is deactivated. So for example, if there is a SYSTEM_OFF quick mode, setting HOTWATER_BOOST will deactivate SYSTEM_OFF and possibly affect all your zones/room (they will get back to their previous configured mode).

I would use SystemManager#set_hot_water_setpoint_temperature to set the target temperature and SystemMananger#set_hot_water_operating_mode with OperatingModes.ON, so it only affects the hot water.

Since you're talking about cooling, I guess you have a heat pump ? One possible solution to know better what the system is doing could be to call SystemMananger#get_hvac_status and see if there is any BoilerStatus available, but this is not available for all heat pump/boiler. If boiler status is available, it will give you a code and a short description (for example here, starting page 42: https://www.vaillant.co.uk/downloads/aproducts/ecotec-plus-48-64kw/new-2/ecotec-plus-48-64kw-installation-manual-0020261389-02-1423763.pdf). You can also have a look at SystemManager#get_live_reports, sensors are not always the same for all systems and System#get_emf_devices

While not perfect, your deductions about FlowTemperatureSensor looks realistic, only remarks is

As you discovered, sometimes server side can be pretty slow to detect changes happening in the system.

Last point, if you are skilled enough, you may have a look at ebusd: https://github.com/john30/ebusd. There is also an interesting article here: https://fromeijn.nl/connected-vaillant-to-home-assistant/ (this is for home assistant, but if you are able to get the data out of the ebus to usb converter, you can do whatever you want). With ebusd, you might be able to retrieve almost everything happening in the system.

wimleers commented 1 year ago

First of all, as far as I know, there is no way to know that.

🤦

The API will tell you what the system is supposed to do, but not what it is actually doing (e.g. if you ask to heat to 22°C but it is 21.8, I'm pretty it won't actually heat).

This is my impression too 😬

pymultimatic can only give you what you can see in the mobile application, there is no magic here 😄

Of course. Clearly this API was not well thought through :|

But by experience, I would not use the quick mode to trigger hot water.

I'm not triggering this myself. My energy manager (SMA Home Manager 2.0) does this for me 👍 , via EEBus. See https://www.vaillant.com/downloads/doc-2020/0020257203-06-2108806.pdf.

I'm only trying to observe and log the behavior, so I can spot anomalies. To track historical use etc. I want to upload this data to https://pvoutput.org as well, and make it easy for others to reproduce for their setup at home.

Since you're talking about cooling, I guess you have a heat pump ?

Correct!

One possible solution to know better what the system is doing could be to call SystemMananger#get_hvac_status and see if there is any BoilerStatus available, but this is not available for all heat pump/boiler. If boiler status is available, it will give you a code and a short description AHA! I had not yet found this one, because my multiMATIC iOS app does not make any requests to this URL! (I've been using Proxyman on my iPhone to observe what it does). Thanks to this pointer of yours I discovered

"""HVAC (heating, ventilation and Air-conditioning)"""
_HVAC = _FACILITIES + "/hvacstate/v1/overview"
_HVAC_REQUEST_UPDATE = _FACILITIES + "/hvacstate/v1/hvacMessages/update"

Unfortunately all that shows me is:

So … I guess that's just not available for my setup? I have:

it could also be hotwater + heating

Not for me, because it's configured to never do both in parallel. Heatpumps are not as powerful as gas heaters, unless you buy one that's far too big 99% of the time.

As you discovered, sometimes server side can be pretty slow to detect changes happening in the system.

No shit 😂 Just stumbled upon this in your code:

        it can take some times for the update to occur (Most of the
        time, it takes about 1 or 2 minutes before you can see changes, if any)

🙃

Last point, if you are skilled enough, you may have a look at ebusd: https://github.com/john30/ebusd. There is also an interesting article here: https://fromeijn.nl/connected-vaillant-to-home-assistant/ (this is for home assistant, but if you are able to get the data out of the ebus to usb converter, you can do whatever you want). With ebusd, you might be able to retrieve almost everything happening in the system.

I've actually been doing exactly that first. But … it's a nightmare to get to work. Not just the hardware interface, but also ebusd itself (see https://github.com/john30/ebusd/issues/825#issuecomment-1554180386) as well as decyphering the available "fields" for each Vaillant device (see https://github.com/john30/ebusd-configuration/pull/330#issuecomment-1549324679). But … I just purchased a second ebus adapter that hopefully will be more reliable 🙃

P.S.: the truly best option would be to read all this data via EEBus. I tried that too: https://github.com/enbility/devices/discussions/2#discussioncomment-5730584, but while Vaillant "uses EEBus", they are using it just as a transport layer, violating the very purpose of EEBus: interoperability. It literally is impossible to interact with their EEBus implementation at all: https://github.com/enbility/devices/discussions/2#discussioncomment-5731185. The only remaining thing I can still try there is to somehow force the VR921 to be MITM'd … but that's far beyond my comfort zone :| As I was writing this, I found https://www.vaillant.com/downloads/doc-2020/0020257203-06-2108806.pdf, which ironically lists:

1.3 Applications Different potential applications are available with EEBUS. – Heat pump photovoltaic energy management

  • Transparency

"Transparency" makes one hopeful, doesn't it? Except it apparently is just surfacing the live PV info 😬 (That's also why there's spine in the URL for PV info in urls.py: EEBus is built on top of SPINE.)

thomasgermain commented 1 year ago

So … I guess that's just not available for my setup? Indeed, I have something like that when I call the API (yeah, it says errorMessages, but it's not):

"body": {
"errorMessages": [
{
"deviceName": "VC BE 246/5-3",
"type": "STATUS",
"title": "Mode chauffage : Arrêt temporaire après une opération de chauffage",
"statusCode": "S.8",
"description": "...",
"hint": "...",
"timestamp": 1545896904282
}
]
}

Actually you summarized it well, the API is not well designed (and very unstable).

I already had a look at EEBUS (my gas heater is not compatible) and I was astonished how they succeed to close and obfuscate their EEBUS implementation :cry:.

Hopefully, "myVaillant" should roll out soon, only calendar I found is here, on German website: https://www.vaillant.de/heizung/produkte/mobile-apps/myvaillant-app/. I really hope it will be more stable, but I don't think there will be a way to get more data :/. (For me, it's Q4 2023)

Honestly, vaillant ecosystem (=servers + software + mobile app, etc) is the worst choice I made for my home automation.

So, I'm really sorry to not being able to help you more about your project.

wimleers commented 1 year ago

No problem!

I'm still rooting for EEBus at some point… 😬 I'm hoping that at some point, Vaillant comes to its senses and/or is forced to open up this data. It's my device, in my house, I have a right to access that data! 😤

But if you look at the direction in which https://developer.vaillant-group.com/ is going (specifically: https://developer-stage.vaillant-group.com/smart-homes-can-now-include-vaillant-heat-pumps), and the fact that months of me requesting API access I have not even gotten a single response, not even a "no", I'm not at all hopeful.

thomasgermain commented 1 year ago

I'm still rooting for EEBus at some point… 😬 I'm hoping that at some point, Vaillant comes to its senses and/or is forced to open up this data. It's my device, in my house, I have a right to access that data! 😤 Totally agree, this is why I said this is one of my worst choice in my home 😩

But if you look at the direction in which https://developer.vaillant-group.com/ is going (specifically: https://developer-stage.vaillant-group.com/smart-homes-can-now-include-vaillant-heat-pumps), and the fact that months of me requesting API access I have not even gotten a single response, not even a "no", I'm not at all hopeful.

I also subscribed there and I got a answer, but this thing is only for companies and they are still investigating if they will open for anybody

wimleers commented 1 year ago

The irony is: I’d already be satisfied if they just did UDP broadcasts of basic information. Costs them nothing. SMA Home Manager and Tempest Weatherflow do this!

wimleers commented 10 months ago

👍 Makes sense to close!

If you're interested: I have a script that tracks the states mentioned above in a SQLite DB, that is triggered every 5 minutes, and uses a "bot" user account to fetch the data from Vaillant (since it seems to log me out if I use the same account for both the multiMATIC app and the script).

Been fighting with ebusd (even to just keep it up & running, it's rather fickle) to get access to the right data. Nontrivial to figure out. I'll get there. Happy to share if you're interested.

But if you someday figure out something better, please let me know!

/me waves from Ghent 😊