Testers needed for Netatmo climate (multiple thermostats or valves)

I changed the name in customization.yaml

1 Like

I am in no way a Python programmer, but I have now a fix that gets rid of the ‘Unknown’ also for Valves. If you insert the below lines just after line 352 in the Script done by Baosong_shan then at least it works for me.

So look for these lines: (Line 351 and 352)

        if roomstatus['thermostat_type'] == 'NATherm1':
            self.boilerstatus = self.homestatus.boilerStatus(rid=roomstatus['module_id'])

And then insert the below lines just under there:

        elif roomstatus['thermostat_type'] == 'NRV':
            if self.homestatus.rooms[key]['heating_power_request'] > 0:
                self.boilerstatus = True
            else:
                self.boilerstatus = False

Restart HASS and you should get rid of the Unknown. Hope it works for you also

1 Like

You are a fantastic Python programmer! I update the code accordingly, the only difference is that I added a check if the boiler status is None, because for people who have a thermostat, they don’t want the boiler status to be rewritten by a valve.

elif roomstatus['thermostat_type'] == 'NRV' and self.boilerstatus == None:

But again, imagine one have one boiler with many valves, each room should show the boiler status or the valve status? Please advise.

2 Likes

I think you should show the valve status. Depending on which mode the valves are set (Eco of Comfort) they should only send a heat signal if the conditions allow it. In Eco only if a manual temperature is set, in comfort if the set temperature is not reached.
I hope to test these scenario’s soon. I’ve got 3 more valves on the way to install in the same room as the thermostat. That way I can have a valve switch on the boiler without heating the living-room (thermostat) as well.

OK, updated again:

  • For room using a thermostat, showing the boiler status;
  • For room using a valve, showing the valve status (“heat” if boiler and valve both on, otherwise “idle”);
  • For room using both, it depends… The reason is that this is already beyond netatmo2.py code, but also related to lnetatmo library. Of course it is also modifiable, but please test and advise first…
3 Likes

Great work!!!

I think that is the best option. I prefer seeing whether the valve is open or not over whether the boiler is on at that time for that valve.

This week I should receive the valves for my living room (where the thermostat is located). I’m not as much interested in the status of those valves as the main device is the thermostat. I will rather use them so I can switch the valves to Comfort mode and heat up a room when needed while preventing the living room turning into a sauna. :wink:

Great work, no more “Unknown”!!
We really need this component to be included in upcoming HA versions! :wink:

1 Like

This morning the therrmostat disappeared, don’t know what happened (they are corectly connected in the netatmo app). Will try to put the more recent code available from @Baosong_Shan

Thank you so much! Finally all my smart home devices can be controlled from within Home Assistant - your modified component works like a charm with my two valves!

Can someone summarize how to implement this?
Where to find the correct cod etc?

Thank you so much!

hello,
the custom componet works well, but in my Home Assistant log I find some errors:

2018-11-28 16:29:47 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.netatmo_ingresso fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/local/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/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/climate/netatmo2.py", line 267, in update
    self._data.update()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 324, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/climate/netatmo2.py", line 338, in update
    self.homestatus = lnetatmo.HomeStatus(self.auth, home=self.home)
  File "/config/deps/lib/python3.6/site-packages/netatmo_home/Thermostat.py", line 125, in __init__
    self.rawData = resp['body']['home']
KeyError: 'home'

https://gist.github.com/shanbs/526b6cd424e7f1f872cbd320887a2f4a

1 Like

Yes, this was due a bad response returned from api.netatmo.com, and there is no exception handling code for this. It seems to me this happened around GMT 15:30 today.

1 Like

I seems that yesterday the netatmo server was not reachable for a couple of hours.
Now it works fine again.
@Baosong_Shan do you plan to request this for an hass.io integration?

I guess you also need to config the configuration.yaml? And so, what to write?

Thanks mate!

Yes I have several errors in my log, do you think that you can add some exception handling code in netatmo2.py component?
thanks

In your config you have to add this:

netatmo2:
  api_key: !secret netatmo2_api_key
  secret_key: !secret netatmo2_secret_key
  username: !secret netatmo2_username
  password: !secret netatmo2_password
  discovery: False

climate:
  - platform: netatmo2 

It would be nice if some documentation for this component would be added in the netatmo section.
Also it would be great if this was added to ha native.

Hello i have this error:

2018-11-29 00:01:31 ERROR (MainThread) [homeassistant.components.climate] Error while setting up platform netatmo2
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py”, line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/lib/python3.5/asyncio/tasks.py”, line 400, in wait_for
return fut.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/homeassistant/.homeassistant/custom_components/climate/netatmo2.py”, line 72, in setup_platform
for room_id in room_data.get_room_ids():
File “/home/homeassistant/.homeassistant/custom_components/climate/netatmo2.py”, line 320, in get_room_ids
self.setup()
File “/home/homeassistant/.homeassistant/custom_components/climate/netatmo2.py”, line 331, in setup
self.homestatus = lnetatmo.HomeStatus(self.auth, home=self.home)
File “/srv/homeassistant/lib/python3.5/site-packages/netatmo_home/Thermostat.py”, line 125, in init
self.rawData = resp[‘body’][‘home’]

I think first step is to commit to the next dev version. I have no experience for that at all, but I can imagine there will be more work to be done to meet all the requirements. I should have more time next week, will try. After that, I will try hass.io I think, but I have even less knowledge for it.

By the way, since this code was based many other people’s, what should I do then? Should I contact them and get their permission? Maybe this question is stupid, but really I have no experience…

1 Like

I added some protection and will test with my own HA first. Will update once this is done. Also I added some small features, like supporting to turn Netatmo on or off.

2 Likes