Viessmann Component


#22

A lot happening here.
I read the first post and didn’t realize that other people were working in //.
I wrote a python library:


Most of the functions are there but not all API endpoints work with my installation. It’s interesting to notice that the “Comfort temperature” and the “holiday schedule” are still in the API. I didn’t try the holiday feature yet but you can configure a comfort temperature and activate/deactivate it.

It’s already on PyPi. I’ll start writing a module in the coming days. I don’t really want to go trough MQTT and now I have my lib ready so…

Also, in the case of my installation I would need a climate and a water heater component.

@oischinger not all sensors are present.
The easiest way to check using https://www.getpostman.com
You easily browse the API and list the endpoints active for your installation.


#23

@somos Your library is exactly what would be needed for a “proper” home assistant component and it greatly simplifies the code and worked right away.
I updated the custom component to use PyViCare instead of directly calling the vicare API:

@eldios Are you already working on a climate component or should I start writing something?


#24

@oischinger thanks for the feedback
I think you should start writing a Viessmann platform with 3 components:

  • Climate for the heating
  • Water heating
  • Sensor for the external and room temperature
    But I’m not a HA expert yet.
    I was planning to write the component but you already started something so happy to contribute if you want.

#25

Nope I only had time to do some quick tests, so please go on and continue on your repo.

I also think it’s a good idea yo keep your repo as a reference and send you patches and PRs to try to centralize efforts.

At least that’s what I’ll do :slight_smile:


#26

As an experiment I created a climate component and it turned out to be quite simple to create such a component.
Now here comes the “but”:
My Viessmann heater is for the whole house. It doesn’t even have a room sensor and I can’t really show a meaningful “current temperature” by any data from the ViCare API (Maybe it would make more sense to use some Zigbee temperature sensor from my living room?)

In the end one wouldn’t be able to do more than

  • set the target temperature
  • set the modes

Seems like the climate component has lots of features for AC devices which just make no sense for us. I was hoping for some support for programming start/stop schedules and so on.

Anyway I will experiment a little more with the climate component and see what we can achieve.


#27

@oischinger I’ll take your copy from your repo and also test it out.

In my case I have a Nest thermostat in the living room so I can couple the room temperature taken by that and plan the heating schedule from the heaters accordingly… I guess…

Anyway the more we have, the merrier :smiley:

@somos opened a PR and an issues on your repo. :slight_smile:


#28

Here’s my take on a climate component:

See this commit on GitHub

  • The on/off changes the mode between dhwAndHeating and standby.
  • The current temperature is the room sensors temperature if available or else the boiler temperature
  • The target temperature is always the temperature for the current program (this means that in reduced you cannot set the temperature for normal)
  • You can select all programs reported by getPrograms in the dropdown. Not all of them work and you cannot turn off e.g. “comfort” once you enabled it. We really need to think about what options we want in that dropdown and will maybe have to create our own logic for turning on/off stuff
  • Holiday mode toggle turns on holiday program or switches back to normal. This does however not work since I couldn’t figure out how to program the holiday start/end dates

I don’t really like the outcome. It works but the user experience is not really great. Mostly because the climate component of HA seems to be designed for AC devices and the Viessmann heater has totally different configuration parameters.

Personally I believe that creating a couple of sensors and switches plus some nice Lovelace config could work out much better.

What do you think?


#29

Yes, I have been trying to wrap my head around this as well and I don’t feel the climate component is optimal. My unit is a Vitocal 343G (a geothermal heat pump) so while controlling modes etc is probably the same as a gas heater, I would be interested to monitor some additional parameters that are specific to a heat pump setup (brine temperature, for example, to monitor how the well temperature changes over season, as well as COP -the coefficient of performance, or how efficient the energy extraction from the well is). I believe these parameters are available through ViCare but I havn’t been able to confirm it yet (I’m a manager since a few years back and the tie really restricts the blood flow to the brain so my coding skills isn’t what they used to be.Now you know why managers mostly behave like morons :slight_smile: ).


#30

that’s a good use case but I guess we should focus on making the component stable first before introducing more features.

I do think that eventually we’ll want to cover all possible use cases tho’ … so thanks for bringing it up @hevi


#31

I have updated the custom component.
It now support sensors for consumption data and supports the following operation modes of a climate component:

  • auto = reduced/normal
  • eco = eco
  • heat = comfort
  • off = standby

I still need to experiment a little more with switching the operation modes but it seems to work somehow.

I have also uploaded an example lovelace config which show some sensors in a history_graph:


#32
OK, so I have managed to put the vicare.py in my custom_components directory and I realize I also need to put the pyvicare stuff somewhere for it to work. After a couple hours of googling I tried my luck trying to brig it in with pip but it dosn't seem to recognize the package (which was pretty much expected). So, where do I put the pyvicare stuff for the platform to load?

Now, before you answer -take a few moments and picture your grandmother. Then picture yourself explaining to her how to get this thing installed, because when it comes to python, I am at the same or lower level as your grandmother.
</python virgin question>


#33

Pyvicare should be installed automatically on HA startup. It is a dependency to the component.
Did you create both, custom_components/sensor/vicare.py and custom_components/climate/vicare.py ?

By the way, I would not recommend custom components to my grandmother.
The stable stuff in HA would probably keep her budy :wink:

Regards, Hans?


#34

I could see in the log that it did not recognize pyvicare module. I run the HA docker container on a Synology NAS, but after some figuring I managed to connect to the container using bash and execute “pip install PyViCare” and that resolved it. Somehow it did not load automagically for my setup…


#35

Just for fun I hooked up Postman to my ViCare account this eavning to see if there where any special properties exposed for geothermal heat-pumps but there was really not much of value IMHO. For GTHP, the only additional parameter I found that would be of interest is the read only compressor parameter (boolean on/off). Everything related to gas and boiler just return error in HA, so setting the component up for different types of heaters should just be a matter of filtering out what sensors to add in the setup_platform def, depending on heater type. Perhaps it can be automagically determined (tried to look for some sort of capability/product topology parameter in the API but did not find one), or the type of heater can just be passed as parameter, so no big deal, really.

I’ll see if I can


#36

@hevi Do you get any of the information that you are looking for in one of the Viessmann apps?
I also cannot find some data that is available in the app. Maybe I just couldn’t figure out where to look for it.

I’ll check what could be the reason for Pyvicare not being installed automatically. Maybe I am missing something in the component definition.


#37

really nice work on the component … i added it in… i had to manually load the pyvicare module the same as @hevi - but thats the least of the evils.
i have a question regarding the consumption sensors
there is gasconsumptionheatingdays, gasconsumptionheatingtoday, and then for weeks, thisweek, months, thismonth - and then the same for gasconsumption for water.
using my brain (doesnt happen often) i guess heatingtoday = gas used sofar today. then heating days is the total used for the heating as an array this week per day and then so on. so this week = total of consumption of days up till now, and then weeks = array for this month… etc etc …
am i right that the array is read from right to left - so array[0] = current month, array[1] = month before … and the same for the week/days?

2 other questions

  1. how often does this do a check? or is this configurable?
  2. it is strange that the consumption figures for me are exactly the same for waterheating as for heating… so i am wondring if i have the heating and the water set together (heating and hot water active together) … then these figures can be ignored? i.e… i dont get seperate values but everything lumped together …

#38

The consumption sensors are in the very same format as the Viessman API returns it. Your readings of this data are correct. Unfortunately this data is not very useful in Home assistant. E.g. you cannot create a graph out of those arrays. On the other hand: maybe with a custom lovelace card using e.g. google graph one could create a nice chart. Also it might be useful for some automations, e.g. using yesterdays consumption.

Currently all sensors are updated in Home assistants default scan_interval (every 30 seconds). We should propably change this to something more meaningful.

I also noticed the heating and hot water issue. It seems that both values return only the heating part (at least the numbers match with the heating data which I can see in my Viessmann app). The hot water consumption data seems to be not reported at all.


#39

hi.
if i can help in any way… i will.
i will check the code and see what i can understand :slight_smile:my vicare app doesnt report consumption… so thats baller… and i cant login to vitrol plus app anymore even after resetting my password :slight_smile:
the arrays is important as i can create template sensors for then the various days of the week and fill them accordingly… and as u say create automations based on these
currenly i throw everything into an influx DB and graph it in there… and put this graph if i want it into my GUI…


#40

one thing i am getting a lot of …

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/climate/vicare.py", line 42, in update
    _room_temperature = self._api.getRoomTemperature()
  File "/srv/homeassistant/lib/python3.6/site-packages/PyViCare/PyViCare.py", line 337, in getRoomTemperature
    return self.getProperty("heating.circuits.0.sensors.temperature.room")["properties"]["value"]["value"]
  File "/srv/homeassistant/lib/python3.6/site-packages/PyViCare/PyViCare.py", line 211, in getProperty
    j=self.__get(url)
  File "/srv/homeassistant/lib/python3.6/site-packages/PyViCare/PyViCare.py", line 144, in __get
    r=self.oauth.get(url).json()
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 546, in get
    return self.request('GET', url, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests_oauthlib/oauth2_session.py", line 425, in request
    headers=headers, data=data, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/adapters.py", line 498, in send

seems there is an error with getroomtemperature … do any of you guys see this… i guess its correct, as for my device i have no temperature feelers in the rooms… so what would u suggest here… manually edit line 42 … or have a swtich somewhere where i can say this is not expected for this unit…


#41

Well, I lost both my JSON and my Postman virginity last night so I am pretty much at infant level here, just beginning to figuring out the magic world of cloud connected apps (my field of expertise, before I turned to the dark side and started managing engineers, was bootloader, driver and bsp development which is pretty useless knowledge for this problem).

So far I have only used Postman to extract a response from “https://api.viessmann-platform.io/operational-data/v1/installations/[id]/gateways/[serial#]/devices/0/features”, but I don’t yet have the understanding needed to know exactly what I am looking at here…

The parameters I would like to extract and led me to try my luck with Postman are actually not in the ViCare app -I was just kind of hoping they had been implemented in the backend but omitted in the app.

With that said, I just have to say I am already getting vastly more valuable data from ha_vicare than from the app! Just by plotting the temperature of my hotwater tank, the supply temp and room temp I have gained a much better understanding of how I should tweak the system and set my schedule to generate hot water etc. to be as efficient and economic as possible.