Strange behaviour with Sonos speakers

Hi,

I’m running Hassio 130 on HassOS 2.2 from an SD card on an Asus Tinkerboard plugged in through ethernet, also tried on an RPi3 with latest release version of HASSOS and HASSIO, also through ethernet.

My Sonos speakers show up as changing their status between off, paused, unavailable every minute.

I also get my logbook and syslog filled with errors related to this and maybe unrelated, but my system crashes every few hours since this is going on.

Cheers,
Peter

03

2018-09-14 21:55:48 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2018-09-14 21:55:49 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.nappali fails
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/urllib3/connection.py”, line 171, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File “/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py”, line 79, in create_connection
raise err
File “/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py”, line 69, in create_connection
sock.connect(sa)
TimeoutError: [Errno 110] Operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 600, in urlopen
chunked=chunked)
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 354, 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 “/usr/local/lib/python3.6/site-packages/urllib3/connection.py”, line 196, in connect
conn = self._new_conn()
File “/usr/local/lib/python3.6/site-packages/urllib3/connection.py”, line 180, in _new_conn
self, “Failed to establish a new connection: %s” % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0xb21f2d10>: Failed to establish a new connection: [Errno 110] Operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/requests/adapters.py”, line 445, in send
timeout=timeout
File “/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File “/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py”, line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=‘192.168.10.24’, port=1400): Max retries exceeded with url: /ZoneGroupTopology/Control (Caused by NewConnectionError(’<urllib3.connection.HTTPConnection object at 0xb21f2d10>: Failed to establish a new connection: [Errno 110] Operation timed out’,))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 224, in async_update_ha_state
yield from self.async_device_update()
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 353, in async_device_update
yield from self.hass.async_add_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 “/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/sonos.py”, line 502, in update
self._subscribe_to_player_events()
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/sonos.py”, line 479, in _subscribe_to_player_events
device.update_groups()
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/sonos.py”, line 708, in update_groups
elif self.soco.group:
File “/usr/local/lib/python3.6/site-packages/soco/core.py”, line 997, in group
for group in self.all_groups:
File “/usr/local/lib/python3.6/site-packages/soco/core.py”, line 986, in all_groups
self._parse_zone_group_state()
File “/usr/local/lib/python3.6/site-packages/soco/core.py”, line 935, in _parse_zone_group_state
cache_timeout=5)[‘ZoneGroupState’]
File “/usr/local/lib/python3.6/site-packages/soco/services.py”, line 790, in GetZoneGroupState
return self.send_command(‘GetZoneGroupState’, *args, **kwargs)
File “/usr/local/lib/python3.6/site-packages/soco/services.py”, line 477, in send_command
data=body.encode(‘utf-8’)
File “/usr/local/lib/python3.6/site-packages/requests/api.py”, line 112, in post
return request(‘post’, url, data=data, json=json, **kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/api.py”, line 58, in request
return session.request(method=method, url=url, **kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/sessions.py”, line 512, in request
resp = self.send(prep, **send_kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/sessions.py”, line 622, in send
r = adapter.send(request, **kwargs)
File “/usr/local/lib/python3.6/site-packages/requests/adapters.py”, line 513, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host=‘192.168.10.24’, port=1400): Max retries exceeded with url: /ZoneGroupTopology/Control (Caused by NewConnectionError(’<urllib3.connection.HTTPConnection object at 0xb21f2d10>: Failed to establish a new connection: [Errno 110] Operation timed out’,))
2018-09-14 21:56:21 WARNING (MainThread) [homeassistant.components.media_player] Updating sonos media_player took longer than the scheduled update interval 0:00:10
2018-09-14 21:56:23 WARNING (MainThread) [homeassistant.helpers.entity] Update of media_player.nappali is taking over 10 seconds

Did you ever fix this? I’m getting the same errors with a lot of platforms too

I think Sonos + Netgear Orbi + Hassio of RPi created an endless connect-disconnect loop for Sonos somehow. After adding a bridge and connecting up one more speaker to ethernet, I managed to reduce Sonos disconnects-reconnects from every second to every 9 minutes. Sometimes even longer stability. This had a great impact on HA stability. As long as Sonos was struggling, HA was crashing every half hour or so as well.
What I’ve learned from it:
1, I hate Netgear Orbi even more than before. Disabling daisy chaining can help with stability.
2, Sonos introduced some connectivity bug a few releases ago, which is hurting, it’s better to rely less on its mesh nowadays :frowning: Which was its best feature.
3, If you have at least one speaker connected to ethernet or have a bridge, it helps to remove the wifi config from your sonos. It seems to be switching back and forth between WiFi and its mesh otherwise.
4, HA is not that mature and isn’t too hard to kill. If any component (like Sonos) is failing on http requests a lot, it’ll run out threads and will start crashing all over the place, failing in random components. Ouch.
5, To make my smart home reliable, I’ll need to clean up any instability in my LAN setup, otherwise it’ll cause HA to crash
6, Not sure, but I had a feeling that having SSL enabled on HA made things much worse somehow

Hope it helps.

Cheers,
Peter

For me it was something with HTTPS. Duckdns chrashed or something. Restarted that, pulled the plug on the pi and everything was working again.

Thanks for the response though

I did think of HTTPS/SSL + DuckDNS as the culprit, as my troubles started (or got much worse) right after enabling HTTP. But even if I restarted, it only lasted for a few hours, so just a restart did not solve it for me in the long run. Eventually giving up on SSL and configuring Sonos somehow solved it.
Maybe it was two unrelated issues (1, Sonos connecting dropping every second 2, HA instability with HTTPS). I’m just happy it’s somehow working now. Although my system just crashed, won’t get past starting and I have to rebuild it again :roll_eyes:

I really must agree on nr 4.

Also issues with Sonos.

The logs keeps filling up with “took longer” The openzwave log is increasing, but the UI or automations are not working anymore.

The software should be more robust, or some kind of option to at least have the UI respond, and the light toggles and automations.

And maybe implement something to ignore not responding devices.

I must add that i have some stabillity issues with Sonos on it’s on (music sometimes pausing), but a media_player device in Hass should never cause the complete Hass is unresponsive!