Added support for Vaillant Thermostat, how to integrate in official release

Hi everybody,

I’m starting to work with Home Assistant and love it ! I have a Vaillant vSmart Thermostat, which is just a rebranded version of Netatmo. However, API calls are not exactly the same as Netatmo so it doesn’t work out of the box.

I already had some custom code to fetch the data, but did not take the time to implement control of the thermostat. It’s working now and integrated in HA. I added a new component (vaillant) and a new climate component (vaillant as well). You can see the changes in the libs in my github repos


Vaillant is not documenting the customizations. I had to extract some information from their android app (for instance the secret key and client id are hardcoded in the app, I can provide them if needed) so I’m not sure this will be useful out of the box, but I can provide as much info as needed if you need it.

If somebody find this interesting, feel free to test and merge my changes in the needed repositories.

9 Likes

Hi Samuel, nice work.
I do also have a vsmart and wanted to integrate it to HA.

I am a total newby and I don’t really know how to enable your components.
I have copied them on their folders and created a climate config but I get errors.

Can you help me?

thanks a million.

M

Hey Samual, happy to read your post. I also have a vsmart from vaillant, good progress you have made. Unfortunately quite a noob on development.

Would like to test what you have made on hassio. Would you be able to send me any further details, also on the Vaillant details. Only running IOS atm.

Thanks!

Hey everybody,

Glad to know that my work can be useful :slight_smile: I merged the current version code in my repo and will test it. You can test via docker, I have a build on docker hub https://hub.docker.com/r/samueldumont/home-assistant

You will need the apikey from vaillant and it’s not “public”. You can find it in the Android app (or I can provide it to you in PM, I don’t want it to be publicly available by a simple search but since it’s not encrypted, I suppose they don’t really care if we use it :stuck_out_tongue: )

The component is working as intended since more than a month (and I could test multiple actions, like enabling away mode, setting the temp, etc) so it could be seen as “stable”. In the end, it’s just different endpoints and way to call the API but the logic is the same.

Here is the config I use

vaillant:
  api_key: na_client_android_vaillant
  secret_key: Find it or ask me
  username: Login used in the app
  password: Password used in the app
  discovery: False

climate:
  - platform: vaillant

After that, it should work :slight_smile:

1 Like

Hi,

I’d really like to get my vsmart setup with HA - but am a complete novice. Is it possible for a step by step?
am i putting your github files into ~/custom_components/climate/?
cheers!

Hi Sampras,

If you want to be able to use the VSmart, add those files:


You need the component, and the climate component (I did this “quick and dirty” so it was easy to take the code for netatmo and adapt it)

I put this directly in homeassistant/components, did not try with “custom_components”, I suppose it should work.

When this is done, add the following lines to the config yaml file:

 vaillant:
  api_key: na_client_android_vaillant
  secret_key: Find it or ask me
  username: Login used in the app
  password: Password used in the app
  discovery: False

climate:
  - platform: vaillant

After that it should work and you will see the thermostat appearing in HA. You’ll be able to set away mode, the temperature, see the graphs, etc.

Hey, thanks for the reply, what do you mean by “adds these files?” Add to what / where. I’ve copied your 2 files into custom_components/climate and named them the same as u. Then I have added the lines to config. I get: Unable to find component vaillant
2017-12-27 21:03:51 ERROR (MainThread) [homeassistant.setup] Setup failed for vaillant: Component not found.
2017-12-27 21:03:51 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of climate.vaillant. Setup failed for dependencies: vaillant
2017-12-27 21:03:51 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform climate.vaillant: Could not setup all dependencies.
Cheers again!

hey, ok looking into this alittle bit further and I’ve found where the other components are stored - on my setup with rpi3, raspbian and HA in a python venv. the components are
/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components
I’ve put the 2 files in there but i now get :
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/vaillant.py”, line 55, in setup
config[DOMAIN][CONF_API_KEY], config[DOMAIN][CONF_SECRET_KEY],
KeyError: ‘vaillant’
2017-12-31 10:52:40 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of climate.vaillant. Setup failed for dependencies: vaillant
2017-12-31 10:52:40 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform climate.vaillant: Could not setup all dependencies.

I can’t discover how to find out what dependancies i’m missing?
Cheers

Hi Sampras,

You have to put this file


in /srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/vaillant.py

and https://github.com/samueldumont/home-assistant/blob/added_vaillant/homeassistant/components/climate/vaillant.py
in /srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/climate/vaillant.py

Then, in your config file:

vaillant:
  api_key: na_client_android_vaillant
  secret_key: the secret key
  username: your username, used in the app
  password: the password, used in the app
  discovery: False

climate:
  - platform: vaillant

After that, it should work. The two files are the only additions to the main codebase, the rest is configuration so I think the issue lies there.

i also getting an error. i installed it in the custom component dir because i don’t have a “/srv/homeassistant/lib/python…: no such file or directory”
running hassio 59.2. on rpi3

2018-01-02 11:33:13 WARNING (MainThread) [homeassistant.setup] Setup of sensor is taking over 10 seconds.
2018-01-02 11:33:14 WARNING (MainThread) [homeassistant.setup] Setup of climate is taking over 10 seconds.
2018-01-02 11:33:33 ERROR (MainThread) [homeassistant.setup] Error during setup of component vaillant
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/homeassistant/setup.py”, line 193, in _async_setup_component
component.setup, hass, processed_config)
File “/usr/lib/python3.6/asyncio/futures.py”, line 331, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.6/asyncio/tasks.py”, line 244, in _wakeup
future.result()
File “/usr/lib/python3.6/asyncio/futures.py”, line 244, in result
raise self._exception
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/vaillant.py”, line 61, in setup
config[DOMAIN][CONF_APP_VERSION], config[DOMAIN][CONF_USER_PREFIX])
TypeError: init() takes from 1 to 6 positional arguments but 8 were given
2018-01-02 11:33:34 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of climate.vaillant. Setup failed for dependencies: vaillant
2018-01-02 11:33:34 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform climate.vaillant: Could not setup all dependencies.
2018-01-02 11:33:56 WARNING (SyncWorker_10) [netdisco.ssdp] Found malformed XML at http://192.168.1.132:9080: status=ok
2018-01-02 11:40:27 ERROR (MainThread) [aiohttp.access] Error in logging
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/aiohttp/helpers.py”, line 554, in get
return inst._cache[self.name]
KeyError: ‘remote’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/aiohttp/helpers.py”, line 521, in log
for key, value in fmt_info:
File “/usr/lib/python3.6/site-packages/aiohttp/helpers.py”, line 513, in
for key, method in self._methods)
File “/usr/lib/python3.6/site-packages/aiohttp/helpers.py”, line 473, in _format_a
ip = request.remote
File “/usr/lib/python3.6/site-packages/aiohttp/helpers.py”, line 556, in get
val = self.wrapped(inst)
File “/usr/lib/python3.6/site-packages/aiohttp/web_request.py”, line 319, in remote
peername = transport.get_extra_info(‘peername’)
File “/usr/lib/python3.6/asyncio/sslproto.py”, line 306, in get_extra_info
return self._ssl_protocol._get_extra_info(name, default)
File “/usr/lib/python3.6/asyncio/sslproto.py”, line 547, in _get_extra_info
return self._transport.get_extra_info(name, default)
AttributeError: ‘NoneType’ object has no attribute ‘get_extra_info’

Hi Tarbax,

From what I can see, it’s because it doesn’t load my fork of the lnetatmo lib, and uses the standard one : I had to change the login to add support for vaillant thermostat (2 supplementary parameters)

What’s strange is that is should be automatically downloaded :

REQUIREMENTS = [
    'https://github.com/samueldumont/netatmo-api-python/archive/'
    'v0.9.2-vaillant.zip#lnetatmo==0.9.2-vaillant'] 

I always use a docker containter and did not test on a “regular” server, but I see that at first launch, it tries to download the lnetatmo lib I specified.

What I could do is change the name of the lib instead of the version, so it wouldn’t impact the currently installed lnetatmo but I thought HA would download automatically my version.

Can you manually install my version ? It’s backward compatible so if you have a netatmo device, it will still work. You can do it with this command :

pip install --upgrade git+git://github.com/samueldumont/netatmo-api-python.git

Hi Samueldumont,

i tried to manually install netatmo api python git but hassio locked root and has a limited CLI.
can it be installed manually?

Hi samueldumont, I think i have the same issue as tarbax!
I read through your github files and found the required section and then manually installed it
using the way you suggested to tarbax see below
:/home/pi $ pip3 install --upgrade git+git://github.com/samueldumont/netatmo-api-python.git

Collecting git+git://github.com/samueldumont/netatmo-api-python.git
Cloning git://github.com/samueldumont/netatmo-api-python.git to /tmp/pip-t4qyn0me-build
Installing collected packages: lnetatmo
Found existing installation: lnetatmo 0.9.2-vaillant
Uninstalling lnetatmo-0.9.2-vaillant:
Successfully uninstalled lnetatmo-0.9.2-vaillant
Running setup.py install for lnetatmo … done
Successfully installed lnetatmo-0.9.2-vaillant
the log entry is now
2018-01-02 16:47:23 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.5/asyncio/tasks.py”, line 239, in _step
result = coro.send(None)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py”, line 399, in async_process_entity
new_entity, self, update_before_add=update_before_add
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py”, line 247, in async_add_entity
yield from entity.async_update_ha_state()
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 231, in async_update_ha_state
attr)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py”, line 333, in _attr_setter
value = getattr(self, name)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/climate/init.py”, line 736, in supported_features
raise NotImplementedError()
NotImplementedError

From reading this : https://github.com/home-assistant/home-assistant/issues/10928
it could have something to do with the version of HA - I’m running the latest
Home Assistant
0.60.0

Which version are you running?

Thanks again

Hi Sampras,

Did you take the last version in my repo :

It contains the needed changed for version 0.60.0. I’m running that one at home so I can confirm it’s working with those changes.

BTW, the state (Idle or running) is not working with Vaillant. This specific element is not present in the results given by the API

i added netatmo.py files in the custom compoments and subfolder climate and now everything is working fine!
just put everything in custom components and it should work.

Thanks for your contribution Samueldumont.

Cooool ! I’m glad that it’s working :slight_smile: I will try to see if we can integrate this in the main codebase. I’ll keep the code updated with future releases anyway so keep an eye on the repo when a new version of HA is released.

1 Like

Hi,
Yes that’s working now :- so for me on a rpi3 with a python virtual env
I put the above files into the /srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/climate/vaillant.py
and the other in
/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/vaillant.py
and manually installed the netatmo, after activating my virtual env
with
pip install --upgrade git+git://github.com/samueldumont/netatmo-api-python.git
then followed config that samueldumont suggested.

Thanks for this samueldumont - Brilliant!

Hello Samuel,

Great job that you did!
I contacted Vaillant a few weeks ago asking for “Google Home”, “Apple HomeKit” or “Amazon Alexa” support and they replied : “no way, we will never do that, just use IFTTT”.
I’m so happy to see that there is an alternative.

I’ve questions for you:

  • Where in the Android app do I find the API key that you’re talking about?
  • There is no need for the IP of the Gateway?
  • Can you please send me the “secret_key”, please?

Thank you so very much !

Hi Olivier,

You can find it if you decompile the APK and search for “na_client_android_vaillant”. The key will be somewhere around that.

I will send it to you by PM so you don’t have to worry to much about finding it.

The IP of the gateway is not needed : the communication is done directly to Netatmo’s API, which sends the control back to the gateway (same way as when you use the app)

Have fun !

Hi Samuel,

Thank you for the feedback.

If I put the vaillant.py in components/climate (and do “pip install --upgrade …” as suggested by sampras):
2018-01-05 10:55:39 ERROR (MainThread) [homeassistant.loader] Unable to find component climate.vaillant
2018-01-05 10:55:45 ERROR (MainThread) [homeassistant.loader] Circular dependency detected: vaillant -> vaillant
2018-01-05 10:55:45 ERROR (MainThread) [homeassistant.setup] Setup failed for vaillant: Unable to resolve component or dependencies.

If I put it in components directly (as suggested by you):
2018-01-05 10:58:21 ERROR (MainThread) [homeassistant.loader] Unable to find component vaillant
2018-01-05 10:58:21 ERROR (MainThread) [homeassistant.setup] Setup failed for vaillant: Component not found.
2018-01-05 10:58:23 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of climate.vaillant. Setup failed for dependencies: vaillant
2018-01-05 10:58:23 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform climate.vaillant: Could not setup all dependencies.

I’m using HA 0.60.0 as well.

Thank you for your help so far.