Viessmann Component

Things that I did (have installed HA in Python venv on my raspi 4 4GB):

Updating PyViCare to 0.1.10:
Login via shell then change user to homeassistant, and enter Python venv:

sudo -u homeassistant -H -s
cd /srv/homeassistant
source bin/activate

Now update PyViCare:

pip3 install --upgrade PyViCare
exit

Now clone ha_vicare custom component (https://github.com/oischinger/ha_vicare) from git:

cd ~
sudo git clone https://github.com/oischinger/ha_vicare.git

Now move downloaded folder into homeassistant custom component folder:

mv ha_vicare/vicare /home/homeassistant/.homeassistant/custom_components

Then restart HA and it will automatically choose the custom component instead of the official.

@oischinger: I saw, that SCAN_INTERVAL = 900 secs. which was introduced 8 days ago, is still alive in code. Is that correct? I thought, that from version 0.1.10, PyViCare will manage that the Viessmann api will not be fired with requests. Thanks for a short statement.

@Tommmii
Installing it is super-simple: Just download the files in here: https://github.com/oischinger/ha_vicare/tree/master/vicare and put them under HOME_ASSISTANT_CONFIG_DIR/custom_components/vicare

On startup you will get a log entry in Home Assistant that vicare is a custom component and might not have been tested, etc.
You will also notice it because the update frequency of the ViCare data is higher if you plot it on a graoh :wink:

Thanks for the hint with the SCAN_INTERVAL=900. I fixed that now on master.

Note that you should not have to manually update to pyvicare 0.1.10. In my case Home assistent did that for me because I added it to manifest.json

Ah okay, thanks for information. I didn’t knew, that HA will update to version concerning manifest.json :slight_smile:

Is adding vicare: to the yaml configuration needed, or is the custom component added via the Integrations page ?

well, something isn’t working as expected, values don’t update.

➜  vicare pwd
/config/custom_components/vicare
➜  vicare ls -lha
total 44K    
drwxr-xr-x    3 root     root        4.0K Mar 25 11:21 .
drwxr-xr-x    3 root     root        4.0K Mar 25 10:17 ..
-rw-r--r--    1 root     root          17 Mar 24 21:38 .gitignore
-rw-r--r--    1 root     root        2.7K Mar 24 21:38 __init__.py
drwxr-xr-x    2 root     root        4.0K Mar 25 11:21 __pycache__
-rw-r--r--    1 root     root       11.5K Mar 24 21:38 climate.py
-rw-r--r--    1 root     root         222 Mar 24 21:38 manifest.json
-rw-r--r--    1 root     root        5.9K Mar 24 21:38 water_heater.py
➜  vicare 
➜  vicare ha core restart & tail -f /config/home-assistant.log
[1] 1047
⣾ Processing... 
⣯ Processing... 2020-03-25 12:40:35 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for vicare which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
⣯ Processing... 2020-03-25 12:40:53 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.vicare_heatcurve_target_temperature fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/template/sensor.py", line 224, in async_update
    self._state = self._template.async_render()
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 221, in async_render
    return compiled.render(kwargs).strip()
  File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/local/lib/python3.7/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 1, in top-level template code
TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'
Processing... Done.
Command completed successfully.

[1]  + 1047 done       ha core restart

My yaml config :

vicare:
  username: !secret vicare_email
  password: !secret vicare_password
  heating_type: gas
  scan_interval: 60

This is a failure of a sensor that is not from my integration: sensor.vicare_heatcurve_target_temperature

Does the integration also fail?

Yours didn’t refresh, but then I saw above that the 900s interval was still hardcoded.
Updated to the newer version, seems ok now.

I did get the sensor.vicare_heatcurve_target_temperature from you, indirectly :

The sensor.vicare_heatcurve_target_temperature seems to not cope well with None-values, which occur when there was no update from the servers yet.
The template can be written differently. Once I find some time I’ll upload some better yaml examples for monitoring with individual sensors.

1 Like

So far so good, on the custom component, 24hours with scan_interval: 60 and no ban from VSMN.

Same here. Works good so far…

I created a PR towards the next home assistant release. So expect this to be integrated soon.

I also documented the scan_interval feature explaining a little bit Viessman’s rate limits and the consequences here:

2 Likes

Good work , thank you !!

Just letting you know ; something went wrong with the formatting of the Configuration chapter on the Github docs page.

I cant get the sensors to show up i used the config:

sensor:
 platform: template
 sensors:
   vicare_outside_temperature:
        friendly_name: "Vanjska Temperatura"
        unit_of_measurement: '°C'
        value_template: "{{ state_attr('climate.vicare_heating', 'outside_temperature') }}" 

   vicare_inside_temperature:
        friendly_name: "unutrasnja Temperatura"
        unit_of_measurement: '°C'
        value_template: "{{ state_attr('climate.vicare_heating', 'temperature') }}"

type is:
heating_type: heatpump

No logs, no errors just gets stuck on no data. Any idea what i could have done wrong?

Temparature display works without problems and heating pump also… so no idea what i am missing.

I can just write you for vicare. They kicked me out (maybe you too ?)

4 weeks ago they wrote me an email that they will check the API IFC because to many calls -_- 1 week ago they said they gonna turn it down.

we all got that email, no one got permanently banned. 24 hour ban is the max they handed out.

@Sangoku , do you have the vicare: integration configured ?

ofc.
How water and hearing are working.
only part that remains broken is the template.

Update. Just checked error logs and we have some winners. here is whole log.

Here is in text form. makes more sense :slight_smile:

2020-03-29 17:05:44 WARNING (SyncWorker_4) [ViCare] Token expired, renewing
2020-03-29 17:05:44 WARNING (SyncWorker_0) [ViCare] Token expired, renewing
2020-03-29 18:05:47 WARNING (SyncWorker_2) [ViCare] Token expired, renewing
2020-03-29 18:05:47 WARNING (SyncWorker_4) [ViCare] Token expired, renewing
2020-03-29 19:05:51 WARNING (SyncWorker_2) [ViCare] Token expired, renewing
2020-03-29 19:05:51 WARNING (SyncWorker_3) [ViCare] Token expired, renewing
2020-03-29 20:05:54 WARNING (SyncWorker_0) [ViCare] Token expired, renewing
2020-03-29 20:05:54 WARNING (SyncWorker_1) [ViCare] Token expired, renewing
2020-03-29 21:05:57 WARNING (SyncWorker_3) [ViCare] Token expired, renewing
2020-03-29 22:06:01 WARNING (SyncWorker_4) [ViCare] Token expired, renewing
2020-03-29 22:06:01 WARNING (SyncWorker_1) [ViCare] Token expired, renewing
2020-03-29 23:06:05 WARNING (SyncWorker_0) [ViCare] Token expired, renewing
2020-03-29 23:06:05 WARNING (SyncWorker_3) [ViCare] Token expired, renewing
2020-03-30 00:06:09 WARNING (SyncWorker_2) [ViCare] Token expired, renewing
2020-03-30 00:06:09 WARNING (SyncWorker_0) [ViCare] Token expired, renewing
2020-03-30 01:06:13 WARNING (SyncWorker_1) [ViCare] Token expired, renewing
2020-03-30 01:06:13 WARNING (SyncWorker_0) [ViCare] Token expired, renewing
2020-03-30 02:06:15 WARNING (SyncWorker_1) [ViCare] Token expired, renewing
2020-03-30 03:06:19 WARNING (SyncWorker_0) [ViCare] Token expired, renewing
2020-03-30 04:06:23 WARNING (SyncWorker_1) [ViCare] Token expired, renewing
2020-03-30 05:06:27 WARNING (SyncWorker_3) [ViCare] Token expired, renewing
2020-03-30 05:06:27 WARNING (SyncWorker_0) [ViCare] Token expired, renewing
2020-03-30 06:06:31 WARNING (SyncWorker_2) [ViCare] Token expired, renewing
2020-03-30 06:06:31 WARNING (SyncWorker_3) [ViCare] Token expired, renewing
2020-03-30 07:06:35 WARNING (SyncWorker_3) [ViCare] Token expired, renewing
2020-03-30 07:06:35 WARNING (SyncWorker_2) [ViCare] Token expired, renewing
2020-03-30 08:06:39 WARNING (SyncWorker_1) [ViCare] Token expired, renewing
2020-03-30 08:06:39 WARNING (SyncWorker_0) [ViCare] Token expired, renewing
2020-03-30 09:06:42 WARNING (SyncWorker_4) [ViCare] Token expired, renewing
2020-03-30 09:06:42 WARNING (SyncWorker_3) [ViCare] Token expired, renewing
2020-03-30 10:06:45 WARNING (SyncWorker_0) [ViCare] Token expired, renewing
2020-03-30 10:06:45 WARNING (SyncWorker_2) [ViCare] Token expired, renewing
2020-03-30 11:06:48 WARNING (SyncWorker_2) [ViCare] Token expired, renewing
2020-03-30 11:06:48 WARNING (SyncWorker_0) [ViCare] Token expired, renewing
2020-03-30 12:06:51 WARNING (SyncWorker_1) [ViCare] Token expired, renewing
2020-03-30 13:06:55 WARNING (SyncWorker_3) [ViCare] Token expired, renewing
2020-03-30 13:06:55 WARNING (SyncWorker_1) [ViCare] Token expired, renewing
2020-03-30 13:21:56 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 179, in state_attributes
    self.precision,
  File "/usr/src/homeassistant/homeassistant/helpers/temperature.py", line 23, in display_temp
    raise TypeError(f"Temperature is not a number: {temperature}")
TypeError: Temperature is not a number: error
2020-03-30 13:36:57 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 179, in state_attributes
    self.precision,
  File "/usr/src/homeassistant/homeassistant/helpers/temperature.py", line 23, in display_temp
    raise TypeError(f"Temperature is not a number: {temperature}")
TypeError: Temperature is not a number: error
2020-03-30 13:51:58 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 179, in state_attributes
    self.precision,
  File "/usr/src/homeassistant/homeassistant/helpers/temperature.py", line 23, in display_temp
    raise TypeError(f"Temperature is not a number: {temperature}")
TypeError: Temperature is not a number: error
2020-03-30 14:06:59 WARNING (SyncWorker_0) [ViCare] Token expired, renewing
2020-03-30 14:06:59 WARNING (SyncWorker_1) [ViCare] Token expired, renewing
2020-03-30 14:07:00 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 179, in state_attributes
    self.precision,
  File "/usr/src/homeassistant/homeassistant/helpers/temperature.py", line 23, in display_temp
    raise TypeError(f"Temperature is not a number: {temperature}")
TypeError: Temperature is not a number: error
2020-03-30 14:22:00 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 179, in state_attributes
    self.precision,
  File "/usr/src/homeassistant/homeassistant/helpers/temperature.py", line 23, in display_temp
    raise TypeError(f"Temperature is not a number: {temperature}")
TypeError: Temperature is not a number: error
2020-03-30 14:37:01 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 179, in state_attributes
    self.precision,
  File "/usr/src/homeassistant/homeassistant/helpers/temperature.py", line 23, in display_temp
    raise TypeError(f"Temperature is not a number: {temperature}")
TypeError: Temperature is not a number: error
2020-03-30 14:52:02 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/water_heater/__init__.py", line 179, in state_attributes
    self.precision,
  File "/usr/src/homeassistant/homeassistant/helpers/temperature.py", line 23, in display_temp
    raise TypeError(f"Temperature is not a number: {temperature}")
TypeError: Temperature is not a number: error

And here is the config from viessman, all of it:


vicare:
  username: !secret viessman_email 
  password: !secret viessman_password
  name: Grijanje
  heating_type: heatpump
  
sensor:
 platform: template
 sensors:
   vicare_outside_temperature:
        friendly_name: "Vanjska Temperatura"
        unit_of_measurement: '°C'
        value_template: "{{ state_attr('climate.vicare_heating', 'outside_temperature') }}" 

   vicare_inside_temperature:
        friendly_name: "unutrasnja Temperatura"
        unit_of_measurement: '°C'
        value_template: "{{ state_attr('climate.vicare_heating', 'temperature') }}"

Hello,
I have a vitoconnect 100 wifi.
Did you manage to get the preset_mode to work ?
I choose eco or comfort from the lovelace thermostat or service set_preset_mode nothing happens.
thanks you

Doesn´t work for me either.

your config is very similar to mine,
notable differences are you have a Name in the vicare integration, and you have no water_heater configured.

Here’s mine, that works just fine these last days :

vicare:
  username: !secret vicare_email
  password: !secret vicare_password
  heating_type: gas
  scan_interval: 120
#
water_heater:
  platform: vicare
#
sensor:
  - platform: template
    sensors:
      vicare_outside_temperature:
          friendly_name: "Vicare outside"
          unit_of_measurement: '°C'
          value_template: "{{ state_attr('climate.vicare_heating', 'outside_temperature') }}"
      vicare_desired_temperature:
          friendly_name: "Vicare target"
          unit_of_measurement: '°C'
          value_template: "{{ state_attr('climate.vicare_heating', 'temperature') }}"
      vicare_heatcurve_target_temperature:
        friendly_name: "Vicare heatcurve target "
        unit_of_measurement: '°C'
        value_template: "{{ state_attr('climate.vicare_heating', 'temperature') + state_attr('climate.vicare_heating', 'heating_curve_shift') - state_attr('climate.vicare_heating', 'heating_curve_slope') * (state_attr('climate.vicare_heating', 'outside_temperature') - state_attr('climate.vicare_heating', 'temperature')) * (1.4347 + 0.021 * (state_attr('climate.vicare_heating', 'outside_temperature') - state_attr('climate.vicare_heating', 'temperature')) + 247.9 * 0.000001 * (state_attr('climate.vicare_heating', 'outside_temperature') - state_attr('climate.vicare_heating', 'temperature')) * (state_attr('climate.vicare_heating', 'outside_temperature') - state_attr('climate.vicare_heating', 'temperature'))) }}"
      metno_outside_temperature:
        friendly_name: "Met.no outside"
        unit_of_measurement: '°C'
        value_template: "{{ state_attr('weather.home', 'temperature') }}"

Perhaps try to adjust those 2 main differences ?