Viessmann Component

Great work so far guys, I’ve been wanting to do this myself for a while but never got to it :slight_smile:
I installed the custom_component, but it still seems a little rough around the edges right now; can’t get it to start properly. I’m getting index out of range exceptions in the PyViCare package…

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/sensor/vicare.py", line 80, in update
    self._state = api_method(self._api)
  File "/srv/homeassistant/lib/python3.6/site-packages/PyViCare/PyViCare.py", line 343, in getModes
    return self.getProperty("heating.circuits.0.operating.modes.active")["actions"][0]["fields"][0]["enum"]
IndexError: list index out of range

I guess it’s something specific to my Viessmann setup, so I’ll try to find out later today what seems to be missing!

[edit]Turns out my heating circuit is on index 1, not on 0…
@somos Is this a problem you are aware of?[/edit]

Yep, it’s in the todo in the .py file:

TODO handle multi install / multi devices

I’m doing something else today but I knew this would come.
I’ll start later or feel free to propose the change.

Ok, I wasn’t sure what you meant with multi install/device.
Python is not my forte, I’m a .NET guy :slight_smile:
But I’ll see if I can figure out how this all works.
If I feel confident, I’ll have a go at it.

I just updated the component on github.
Home Assistant will now correctly download the PyVicare dependency when setting up the component.

I also removed the unused “idle” mode from the climate device.

@somos @oischinger
I created pull requests for both PyViCare and HA-ViCare.

Disclaimer: haven’t been able to actually test the HA-ViCare implementation (yet) :slight_smile:
It’s my first change in a HA component, so be gentle please :v

I accidently merged your PR and notices that PyVicare wasn’t updated.
So I reverted it on master and created a new PR until the lib is ready: https://github.com/oischinger/ha_vicare/pull/3

Code looks fine to me.
But I don’t have time to test today.
So I accepter the PR. If you have time to test that’s prefect.
I’ll test and make the pip package tomorrow evening (BE time).

Regards,

Sounds good, guys!
(I’m on BE time as well :slight_smile:)

Sounds VERY GOOD, guys!
(I’m on FR time, same as BE :slight_smile:)

@oischinger I just made some more changes. Was missing an import, etc.
Also updated some stuff to be compliant with the guidelines. Beware: this breaks the existing config: user --> username.

I tried to test by removing the pip installed PyViCare package and putting the updated PyViCare.py file in the sensor/vicare.py directory, but I’m guessing that doesn’t work because the import is done during setup_platform?

What’s the CurrentPower property supposed to reflect?

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/sensor/vicare.py", line 93, in update
    api_method = getattr(ViCareSession, "get" + self.sensorName)
AttributeError: type object 'ViCareSession' has no attribute 'getCurrentPower'

I’m also having trouble with all GasConsumption* properties; they all show up as ‘error’ in the HA dev-state panel.

Oh, PyVicare doesn’t yet have the CurrentPower. The PR was still open. It’s closed now but I need to reference the new requirement from pypi.
The gas consumption stuff is only available for gas heaters it seems.

I had little time recently but once I get back to it I’ll try to create the sensors only when they don’t return ‘error’

Oh ok, I wasn’t aware not all data is getting parsed (yet). I might dig a little deeper into PyViCare when feel like it and have some spare time, there might be more hidden treasures to uncover… :nerd_face:

And yes, it would make sense to only have gas consumption for gas heaters… but I see I forgot to mention I do have one :wink:

@somos When do you think you can update the PyPI package?

Since the PyVicare package was updated I also updated the code at https://github.com/oischinger/ha_vicare

@SomethingAwful : I synced with most of your changes but hesitated to take over all the operation_mode related changes for now. Currently I’d rather stick to not changing the Vicare mode at all when changing the HA operation_mode.

Thanks to vandenberghev’s efforts there is now also a second component climate.vicare_water for the domestic hot water function. The heater component climate.vicare has been renamed to climate.vicare_heating.

Note that the “user” config parameter changed to “username”.

Also the component was no more compatible with Home Assistant 0.87. This has been fixed with the latest changes.

1 Like

First of all I’m new on Homeassistant .
I like it to move my sensors from Domoticz to HomeAssistant.
I’ve an Opentherm GW with an Ethernet Module USR-TCP232-T2.
In Domotics, I apply the ip address and port of the GW, and it works,
Is there someone, that can tell me how this works om HA.
I don’t like it to run the openthermmonitor with their own mqtt,
I rea already so much, but didn’t find this info online.

HI guys. I’m new to all this too. Am I right that I need to perform the following steps?

  • Creating Custom_Components folder in the config folder of HA (where my configuration.yaml is located)
  • open two new files named sensor.py and climate.py
  • copying the code into it
  • restart
  • putting the code into the configuration
  • restart

Thanks a lot,

Flo

Hi Flo,

You’d need a custom_components folder in your HASS config directory.
custom_components then contains 2 subfolders: climate and sensor.
These subfolders both contain a file vicare.py (being the climate component in the climate subfolder, and the sensor component in the sensor subfolder).

You could just skip the sensor part altogether if you don’t need it; it’s mostly for reading/debugging some values. The climate component will work fine on its own.

Ah thanks a lot. At least there is no error in the configuration anylonger according to the assistant.

Nevertheless I have issues to bring it into the UI. The climate instance isn’t found in unused objects and when I want to generate the cars manually with the code shown on GitHub (is just copy and pasted it) it produces me one error after the other :confused:

I got it know. I needed to rename the folders. Now its got all the datas in it but I´m not able to build a card like its in the example. I have to admit that I dont have a clue how to use the raw editor.

I´m able to put together the single entities but receive error message after error message when I paste the GitHub code into the editor.