Core: Netatmo component broken in 0.101.3

Created on 11 Nov 2019  路  9Comments  路  Source: home-assistant/core

Home Assistant release with the issue:
0.101.3

Last working Home Assistant release (if known):
0.98.3

Operating environment (Hass.io/Docker/Windows/etc.):
Hassbian on raspberry

Integration:
https://www.home-assistant.io/components/netatmo/

Description of problem:
when upgrading from 0.98.3 -> 0.101.3 netatmo component for camera broken, generated error messages in traceback below.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

netatmo:
  api_key: !secret netatmo_api
  secret_key: !secret netatmo_secret 
  username: !secret netatmo_username 
  password: !secret netatmo_password 
  discovery: true

Traceback (if applicable):

2019-11-10 20:00:31 ERROR (MainThread) [homeassistant.setup] Error during setup of component netatmo
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/local/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.6/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 317, in recv_into
    raise timeout('The read operation timed out')
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 641, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/util/retry.py", line 368, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 389, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 307, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.netatmo.com', port=443): Read timed out. (read timeout=10)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/setup.py", line 176, in _async_setup_component
    component.setup, hass, processed_config  # type: ignore
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/netatmo/__init__.py", line 101, in setup
    "read_station read_camera access_camera "
  File "/srv/homeassistant/lib/python3.6/site-packages/pyatmo.py", line 63, in __init__
    resp = postRequest(_AUTH_REQ, postParams)
  File "/srv/homeassistant/lib/python3.6/site-packages/smart_home/__init__.py", line 18, in postRequest
    resp = requests.post(url, data=params, timeout=timeout)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/api.py", line 116, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.netatmo.com', port=443): Read timed out. (read timeout=10)

Additional information:

netatmo

Most helpful comment

Netatmo servers have been really unstable over the last few weeks. Usually just waiting it out is the key.

I don't have Netatmo cameras, but thermostats - seeing the same issue when the servers is down, I just restart HA a few times, and eventually I hit the sweet-spot where the servers are online.

All 9 comments

I'm using this component on 0.101.3 without issue. Can you connect to https://api.netatmo.com from your home assistant machine?

I can't try now from the home assistant machine. But I tried from another machine in the same network and I get 404 Not Found. I have also tried from a machine in a different network and I get the same result.

Senza nome

You can selftest the values provided by the Netatmo API by running this script with --mode=long.

You can run the script as follows:

python gen_test_data.py --CLIENT_ID <YOUR_CLIENT_ID> --CLIENT_SECRET <YOUR_CLIENT_SECRET> --USERNAME <[email protected]> --PASSWORD <YOUR_SECRET_PASSWORD> --mode=long

The script should be run separately, either within your HA environment or elsewhere with pyatmo installed (pip install pyatmo).

Hi,

i run the script. Here is the result.

Checking` for available cameras...
聽 5d55033152aa5f00182559a3
聽 聽 Presence Camera "Lato ovest gara." (70:ee:50:3c:35:2e)
Traceback (most recent call last):
聽 File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connection.py", line 160, in _new_conn
聽 聽 (self._dns_host, self.port), self.timeout, **extra_kw)
聽 File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/util/connection.py", line 80, in create_connection
聽 聽 raise err
聽 File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/util/connection.py", line 70, in create_connection
聽 聽 sock.connect(sa)
OSError: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
聽 File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 603, in urlopen
聽 聽 chunked=chunked)
聽 File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 355, in _make_request
聽 聽 conn.request(method, url, **httplib_request_kw)
聽 File "/usr/local/lib/python3.6/http/client.py", line 1239, in request
聽 聽 self._send_request(method, url, body, headers, encode_chunked)
聽 File "/usr/local/lib/python3.6/http/client.py", line 1285, in _send_request
聽 聽 self.endheaders(body, encode_chunked=encode_chunked)
聽 File "/usr/local/lib/python3.6/http/client.py", line 1234, in endheaders
聽 聽 self._send_output(message_body, encode_chunked=encode_chunked)
聽 File "/usr/local/lib/python3.6/http/client.py", line 1026, in _send_output
聽 聽 self.send(msg)
聽 File "/usr/local/lib/python3.6/http/client.py", line 964, in send
聽 聽 self.connect()
聽 File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connection.py", line 183, in connect
聽 聽 conn = self._new_conn()
聽 File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connection.py", line 169, in _new_conn
聽 聽 self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x759eaef0>: Failed to establish a new connection: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
聽 File "/srv/homeassistant/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
聽 聽 timeout=timeout
聽 File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/connectionpool.py", line 641, in urlopen
聽 聽 _stacktrace=sys.exc_info()[2])
聽 File "/srv/homeassistant/lib/python3.6/site-packages/urllib3/util/retry.py", line 399, in increment
聽 聽 raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.116', port=80): Max retries exceeded with url: /cc39deeb901ddb2b77dc36a13bb00e52/command/ping (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x759eaef0>: Failed to establish a new connection: [Errno 113] No route to host',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
聽 File "gen_test_data2.py", line 161, in <module>
聽 聽 vpn, local = camera_data.cameraUrls()
聽 File "/srv/homeassistant/lib/python3.6/site-packages/smart_home/Camera.py", line 225, in cameraUrls
聽 聽 resp = postRequest("{0}/command/ping".format(temp_local_url), {})
聽 File "gen_test_data2.py", line 30, in new_postRequest
聽 聽 resp = requests.post(url, data=params, timeout=timeout)
聽 File "/srv/homeassistant/lib/python3.6/site-packages/requests/api.py", line 116, in post
聽 聽 return request('post', url, data=data, json=json, **kwargs)
聽 File "/srv/homeassistant/lib/python3.6/site-packages/requests/api.py", line 60, in request
聽 聽 return session.request(method=method, url=url, **kwargs)
聽 File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
聽 聽 resp = self.send(prep, **send_kwargs)
聽 File "/srv/homeassistant/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
聽 聽 r = adapter.send(request, **kwargs)
聽 File "/srv/homeassistant/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
聽 聽 raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.116', port=80): Max retries exceeded with url: /cc39deeb901ddb2b77dc36a13bb00e52/command/ping (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x759eaef0>: Failed to establish a new connection: [Errno 113] No route to host',))

Any idea?? Thanks

The page has been updated go to https://dev.netatmo.com/en-US/dev
After create your application and get the key

To me this looks more like a network issue than a problem in HA/pyatmo.

Netatmo servers have been really unstable over the last few weeks. Usually just waiting it out is the key.

I don't have Netatmo cameras, but thermostats - seeing the same issue when the servers is down, I just restart HA a few times, and eventually I hit the sweet-spot where the servers are online.

I solved ... I didn't reserved the IP for the cameras in the DHCP server .. when the cameras were restarted the DHCP has assigned a new IP to the cameras ...
I set a DHCP reserve for the cameras and now work perfectly.
Thanks for helping!!

Thanks for reporting back.

Was this page helpful?
0 / 5 - 0 ratings