New Netatmo climate component supporting multiple thermostats/valves

Following the discussion in Testers needed for Netatmo climate (multiple thermostats or valves), I am now opening a new thread to summarise the new Netatmo climate component.

This work is based on the work of gieljnssns and many others, which improves the Netatmo climate component to support multiple thermostats/valves. To try/test this component, you can follow the following steps:

For HA version >= 0.89:

  1. Create a directory netatmo in config/custom_components/.
  2. Put the following files into config/custom_components/netatmo/.
    __init__.py
    climate.py
    And optionally the followings as well, if you have other devices from Netatmo.
    binary_sensor.py
    camera.py
    sensor.py
    services.yaml

For HA version == 0.88:

  1. Create a directory netatmo in config/custom_components/.
  2. Put the following file (__init__.py) in config/custom_components/netatmo.
    https://gist.github.com/shanbs/00ee9131d31792172faa2898d8768f43
  3. Put the following file (climate.py) in config/custom_components/netatmo.
    https://gist.github.com/shanbs/8cad223eed825bc2cc459bdba57fa562

For HA version < 0.88:

  1. Put the following file (netatmo.py) in config/custom_components/
    https://gist.github.com/shanbs/dec77e67c1af9295a2b3402e552e648d
  2. Put the following file (netatmo.py, yes, the same name, but different content, and should be put into the correct places!) in config/custom_components/climate/
    https://gist.github.com/shanbs/2cc14b3a317f578bc22f557fb40480c2

No matter which version of HA:

  1. If you want to specify the home and room list, you should set discovery to False and put:
climate:
  platform: netatmo
  homes:
    - name: home1_name
      rooms:
        - room1_name
        - room2_name
    - name: home2_name
      rooms:
        - room3_name
        - room4_name
  1. Restart home-assistant.

The Pull Request (PR) https://github.com/home-assistant/home-assistant/pull/19407 has been submitted but not yet approved/merged. It would be very helpful if you have any suggestions on how to push the merging.

Known issues:
Sometimes the HTTP request to api.netatmo.com might fail and if it happens during starting HA, the thermostat(s)/valve(s) cannot appear in the frontend. Usually this requires more restarting tries to fix. And there is a testing version of pyatmo file to automatically retry. To use this, you have to replace your file smart_home/Thermostat.py in the installed pyatmo module with the following gist https://gist.github.com/shanbs/e2f7363924a58e871d9aaceaab59125d

All testing results and issue reports are welcome.

Update 2019-01-25: Updated climate/netatmo.py, enabling multiple homes in the case discovery set to false. The configuration format is also changed (updated in the post).

Update 2019-01-29: Updated climate/netatmo.py, optimised the platform setup procedure.

Update 2019-02-27: Added new files and procedures for HA == 0.88.

Update 2019-03-03: PR has been merged into dev branch of HA.

Update 2019-03-07: Added new files and procedures for HA >= 0.89.

7 Likes

Thanks, I think with this it’s unlikely that people mess something up while setting up this component. Like mixing up the netatmo.py files.

Looking at your post I have another suggestion.

I think it would be even easier for people if you add something like

“This file goes to config/custom_components/”

and

“This file goes to config/custom_components/climate/”

in the top section of the netatmo.py files.

Some people will download both files and than they have them both in their download folder, which could mess thing up (50/50 chance).
So I think this should be the first line.

Could save you some support time.

Great idea! I added!

Just finished to test your PR with my account and everything worked as expected, nice work!

My setup:

  • House with 1 thermostat (parents)
  • House with 1 thermostat (grandparents)
  • House with 3 thermostat (mine)

With discovery: true I can see all the 5 thermostats and with discovery: false and setting up the climate components I can show the 3 thermostats in my house.

It’s not my use case but someone may need to setup multiple homes, is it possible? I think that an example or just a warning about the impossibility could be useful

Good point! I updated climate/netatmo.py. Of course, the configuration format is also updated. I changed in the original post:

climate:
  platform: netatmo
  homes:
    - name: home1_name
      rooms:
        - room1_name
        - room2_name
    - name: home2_name
      rooms:
        - room3_name
        - room4_name

Please test and and let me know if it works as expected.

1 Like

I can confirm that the new update works :grinning:

It works! I gave point for your PR

Hello,

I have seen you are still working on having this PR accepted, thank you for your dedication :slight_smile:
In the meantime, can we still simply copy some files in custom components to work with it or it’s better to wait a bit more for the official release ?

I ask because it seems the two links at the start of this post don’t point to the correct files anymore.

Thank you very much

Laurent

I tried both links right now, and both open up the correct files. Please, try again.

Personally I think you should try it out, as you can’t know when the PR will be accepted.

My bad, tried the files and they are working indeed.

Just to note, I have 2 entities for each valves, I don’t remember if it was a knows issue.

Regards,

Laurent

Probably a little bug linked to the fact I have two homes because of my Netatmo camera and discovery true …

If I put discovery false and set the home manually, no more double entities.

BAM… on first reboot it does not work, on second reboot IT WORKS!!

But I have every valve 2 times…? (found by autodiscover)

Seems to work fine with my home with two rooms (living room with two valves and bedroom with one valve). Thanks!

Quick fix for 0.88.0:

save https://gist.github.com/shanbs/dec77e67c1af9295a2b3402e552e648d to:
config/custom_components/netatmo/__init__.py

save https://gist.github.com/shanbs/2cc14b3a317f578bc22f557fb40480c2 to:
config/custom_components/netatmo/climate.py

1 Like

@pier I don’t have 0.88 yet.

What does this fix? Is this component broken in 0.88 without moving the files?

yes, you will get an error and it wont load.

So this will mean most of the custom components (or all) will stop working right after the update?

Could be a lot of work to get them all back running.

Thanks, this indeed fixed the issue.

@Baosong_Shan please add/change/edit this to your first post.

Thanks!

But I’m not sure about the keys thing.
It says I have to remove the keys home and rooms.
How will this affect the discovered rooms?

Hi sometimes ago I updated the custom component for ther excellent job of @Baosong_Shan, but stopped following the thread (and subsequent modification to the component) because my installation was working perfectly.

Now, this morning, with updating to 0.88 all stopped working, has this been fixed already, or not yet? Thank you

2019-02-21 10:18:57 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.netatmo2.climate. Make sure all dependencies are installed

Traceback (most recent call last):

File "/usr/local/lib/python3.7/site-packages/homeassistant/loader.py", line 147, in _load_file

module = importlib.import_module(path)

File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

File "&lt;frozen importlib._bootstrap&gt;", line 1006, in _gcd_import

File "&lt;frozen importlib._bootstrap&gt;", line 983, in _find_and_load

File "&lt;frozen importlib._bootstrap&gt;", line 962, in _find_and_load_unlocked

ModuleNotFoundError: No module named 'custom_components.netatmo2.climate'; 'custom_components.netatmo2' is not a package

Thank you works as expected !

1 Like