home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.89k stars 30.12k forks source link

Sonos Integration #24853

Closed stringy92 closed 5 years ago

stringy92 commented 5 years ago

**Home Assistant release with the issue:0.95.4

**Last working Home Assistant release (if known):0.94.4

**Operating environment (Hass.io/Docker/Windows/etc.):Hass.io on Ubuntu

**Component/platform: https://www.home-assistant.io/components/sonos/

**Description of problem: Sonos devices no longer appear within integrations. I have tried to manually configure using IP addresses but the devices do not appear. It leaves no errors in the log with or without manual config

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

Traceback (if applicable):

Additional information:

johga1 commented 5 years ago

I'm having the same issues here. Running Hass.io. Issue introduced in 0.95.0 (best guess), still present in 0.95.1 and 0.95.4.

Tried to remove and add the integration on all 0.95.x releases without any luck. Also tried configuring Sonos in configuration.yaml with manual entries for my speakers.

Sonos version: 10.2 (build 50166071) on all devices. Hass.io running a wired connection. Speakers running wifi connection. Speakers are fully operational using a Sonos controller.

Logger for discovery component (debug):

2019-06-29 21:12:03 INFO (MainThread) [homeassistant.components.discovery] Unknown service discovered: spotify_connect {'host': '192.168.1.221', 'port': 1400, 'hostname': 'sonos7828CA012B54.local.', 'properties': {'VERSION': '1.0', 'CPath': '/spotifyzc'}}
2019-06-29 21:12:03 INFO (MainThread) [homeassistant.components.discovery] Unknown service discovered: spotify_connect {'host': '192.168.1.220', 'port': 1400, 'hostname': 'sonos5CAAFD05C00A.local.', 'properties': {'VERSION': '1.0', 'CPath': '/spotifyzc'}}
2019-06-29 21:12:03 INFO (MainThread) [homeassistant.components.discovery] Unknown service discovered: dlna_dmr {'host': '192.168.1.220', 'port': 1400, 'ssdp_description': 'http://192.168.1.220:1400/xml/device_description.xml', 'name': '192.168.1.220 - Sonos Play:5', 'model_name': 'Sonos Play:5', 'model_number': 'S6', 'serial': None, 'manufacturer': 'Sonos, Inc.', 'udn': 'uuid:RINCON_5CAAFD05C00A01400', 'upnp_device_type': 'urn:schemas-upnp-org:device:ZonePlayer:1'}
2019-06-29 21:12:03 INFO (MainThread) [homeassistant.components.discovery] Unknown service discovered: dlna_dmr {'host': '192.168.1.221', 'port': 1400, 'ssdp_description': 'http://192.168.1.221:1400/xml/device_description.xml', 'name': '192.168.1.221 - Sonos One', 'model_name': 'Sonos One', 'model_number': 'S13', 'serial': None, 'manufacturer': 'Sonos, Inc.', 'udn': 'uuid:RINCON_7828CA012B5401400', 'upnp_device_type': 'urn:schemas-upnp-org:device:ZonePlayer:1'}
2019-06-29 21:12:03 INFO (MainThread) [homeassistant.components.discovery] Unknown service discovered: dlna_dms {'host': '192.168.1.220', 'port': 1400, 'ssdp_description': 'http://192.168.1.220:1400/xml/device_description.xml', 'name': '192.168.1.220 - Sonos Play:5', 'model_name': 'Sonos Play:5', 'model_number': 'S6', 'serial': None, 'manufacturer': 'Sonos, Inc.', 'udn': 'uuid:RINCON_5CAAFD05C00A01400', 'upnp_device_type': 'urn:schemas-upnp-org:device:ZonePlayer:1'}
2019-06-29 21:12:03 INFO (MainThread) [homeassistant.components.discovery] Unknown service discovered: dlna_dms {'host': '192.168.1.221', 'port': 1400, 'ssdp_description': 'http://192.168.1.221:1400/xml/device_description.xml', 'name': '192.168.1.221 - Sonos One', 'model_name': 'Sonos One', 'model_number': 'S13', 'serial': None, 'manufacturer': 'Sonos, Inc.', 'udn': 'uuid:RINCON_7828CA012B5401400', 'upnp_device_type': 'urn:schemas-upnp-org:device:ZonePlayer:1'}
ghost commented 5 years ago

Hey there @amelchio, mind taking a look at this issue as its been labeled with a integration (sonos) you are listed as a codeowner for? Thanks!

This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people.

amelchio commented 5 years ago

Hmmm, Sonos discovery in 0.95.x is a bit time sensitive (fixed by #24880) but I would expect static configuration like this to work:

sonos:
  media_player:
    hosts:
      - 10.0.1.30
      - 10.0.1.31
johga1 commented 5 years ago

No luck configuring hosts in configuration.yaml.

sonos:
  media_player:
    hosts:
      - 192.168.1.220
      - 192.168.1.221

The log only reports unknown service for spotify and dlna for each speaker as in the provided log above in the same way it did before. After that first discovery they (spotify, dlna) are reported as already discovered.

cannfoddr commented 5 years ago

same issue here

dancwilliams commented 5 years ago

I am experiencing the same issue. I have always used the static configuration and mine stopped working in 0.95.0. I was waiting for a few dot releases to go by, but still no lock. My config is below:

sonos:
  media_player:
    hosts:
      - 172.20.20.210
      - 172.20.20.211
      - 172.20.20.212
      - 172.20.20.213
      - 172.20.20.216
      - 172.20.20.217

Added note: I am using HASS.IO on Ubuntu.

amelchio commented 5 years ago

Anyone having this issue without being on Hass.io? Then we can run some tests.

If not, will someone be on the 0.95 beta when it becomes available in a few days? In 0.95 improved logging is available so hopefully we can get it fixed during the beta period.

cannfoddr commented 5 years ago

I am having the issue in a regular docker image. Let me know what you need

zacs commented 5 years ago

Also having the issue with vanilla Docker. In my case, it appears that the failed connections eventually use up the entire capacity of the Docker image's connection pool, and makes HA completely unresponsive. I'll update this bug with the traceback once I get home.

dancwilliams commented 5 years ago

@amelchio

I will load the hassio beta when it hits the street so we can test. Just let me know what you need.

amelchio commented 5 years ago

Okay, let's first check if this is a problem with Home Assistant or the supporting pysonos library. Try these shell commands on the host.

virtualenv --python=python3 discovery-testing
source discovery-testing/bin/activate
pip install pysonos==0.0.13
python -c 'import pysonos; print(pysonos.discovery.discover(all_households=True));'

Repeat the last two lines with 0.0.13, 0.0.17 and 0.0.19 and report the result 😊

amelchio commented 5 years ago

@dancwilliams Thanks. I will get back to you once the 0.96 beta is out and we are sure it behaves the same.

cannfoddr commented 5 years ago

I have tried the pysonos and get exactly the same result with all 3 versions - it finds my 2 active Sonos systems at the correct addresses using one of the three networks connected to my docker:

(discovery-testing) root@80e47d43daec:/usr/src/app# python -c 'import pysonos; print(pysonos.discovery.discover(all_households=True));'
{SoCo("192.168.1.166"), SoCo("192.168.1.149")}

and here is the detail:

(discovery-testing) root@80e47d43daec:/usr/src/app# pip install pysonos==0.0.13
Collecting pysonos==0.0.13
  Using cached https://files.pythonhosted.org/packages/ad/cc/6df453103dc164aa4d2ff156ff415c83e42ace66db5a1f008a8768bb6305/pysonos-0.0.13-py2.py3-none-any.whl
Requirement already satisfied: ifaddr in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.13) (0.1.6)
Requirement already satisfied: xmltodict in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.13) (0.12.0)
Requirement already satisfied: requests in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.13) (2.22.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.13) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.13) (2019.6.16)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.13) (1.25.3)
Requirement already satisfied: idna<2.9,>=2.5 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.13) (2.8)
Installing collected packages: pysonos
  Found existing installation: pysonos 0.0.19
    Uninstalling pysonos-0.0.19:
      Successfully uninstalled pysonos-0.0.19
Successfully installed pysonos-0.0.13
(discovery-testing) root@80e47d43daec:/usr/src/app# python -c 'import pysonos; print(pysonos.discovery.discover(all_households=True));'
{SoCo("192.168.1.166"), SoCo("192.168.1.149")}
(discovery-testing) root@80e47d43daec:/usr/src/app# pip install pysonos==0.0.17
Collecting pysonos==0.0.17
  Using cached https://files.pythonhosted.org/packages/80/61/1379ce49810a325db2e9a377b338850ce6ca5cf700ef2b1eac608f75d24f/pysonos-0.0.17-py2.py3-none-any.whl
Requirement already satisfied: requests in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.17) (2.22.0)
Requirement already satisfied: ifaddr in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.17) (0.1.6)
Requirement already satisfied: xmltodict in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.17) (0.12.0)
Requirement already satisfied: idna<2.9,>=2.5 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.17) (2.8)
Requirement already satisfied: certifi>=2017.4.17 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.17) (2019.6.16)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.17) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.17) (1.25.3)
Installing collected packages: pysonos
  Found existing installation: pysonos 0.0.13
    Uninstalling pysonos-0.0.13:
      Successfully uninstalled pysonos-0.0.13
Successfully installed pysonos-0.0.17
(discovery-testing) root@80e47d43daec:/usr/src/app# python -c 'import pysonos; print(pysonos.discovery.discover(all_households=True));'
{SoCo("192.168.1.166"), SoCo("192.168.1.149")}
(discovery-testing) root@80e47d43daec:/usr/src/app# pip install pysonos==0.0.19
Collecting pysonos==0.0.19
  Using cached https://files.pythonhosted.org/packages/b8/6a/89a9d420cf1d7f4b9b986ce8e023ab0eac2da6268d9fb234b59ce8cf794f/pysonos-0.0.19-py2.py3-none-any.whl
Requirement already satisfied: ifaddr in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.19) (0.1.6)
Requirement already satisfied: xmltodict in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.19) (0.12.0)
Requirement already satisfied: requests in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.19) (2.22.0)
Requirement already satisfied: idna<2.9,>=2.5 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.19) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.19) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.19) (1.25.3)
Requirement already satisfied: certifi>=2017.4.17 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.19) (2019.6.16)
Installing collected packages: pysonos
  Found existing installation: pysonos 0.0.17
    Uninstalling pysonos-0.0.17:
      Successfully uninstalled pysonos-0.0.17
Successfully installed pysonos-0.0.19
(discovery-testing) root@80e47d43daec:/usr/src/app# python -c 'import pysonos; print(pysonos.discovery.discover(all_households=True));'
{SoCo("192.168.1.166"), SoCo("192.168.1.149")}
amelchio commented 5 years ago

So it seems that this part is at least still working. Please try this one next (after the same setup) to verify communication with each player:

time python -c 'import pysonos; print([p.volume for p in pysonos.discovery.discover(all_households=True)]);'

To be clear, what do you see in Home Assistant? No devices at all, or devices that are unavailable? (please use Developer Tools to check).

cannfoddr commented 5 years ago

To be clear if I remove Sonos from integrations and restart home-assistant I can see Sonos discovery pop up in integrations. If I then click configure it goes off and I can see discovery happening and see the addresses of just one of my two Sonos systems in the log.

2019-07-07 20:18:33 INFO (Thread-5) [pysonos.discovery] Sending discovery packets on 172.23.0.3
2019-07-07 20:18:33 INFO (Thread-5) [pysonos.discovery] Sending discovery packets on 192.168.1.22
2019-07-07 20:18:33 INFO (Thread-5) [pysonos.discovery] Sending discovery packets on 172.19.0.7
2019-07-07 20:18:33 INFO (Thread-5) [pysonos.services] Sending GetZoneGroupState [] to 192.168.1.166
2019-07-07 20:18:33 INFO (Thread-5) [pysonos.services] Received status 200 from 192.168.1.166
2019-07-07 20:18:33 INFO (MainThread) [homeassistant.setup] Setting up sonos
2019-07-07 20:18:33 INFO (MainThread) [homeassistant.setup] Setup of domain sonos took 0.0 seconds.
2019-07-07 20:18:33 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.sonos

But I no longer see any players in home-assistant either under the integrations or in the debug view.

Here is the output from the above:

(discovery-testing) root@80e47d43daec:/usr/src/app# pip install pysonos==0.0.13
Collecting pysonos==0.0.13
  Using cached https://files.pythonhosted.org/packages/ad/cc/6df453103dc164aa4d2ff156ff415c83e42ace66db5a1f008a8768bb6305/pysonos-0.0.13-py2.py3-none-any.whl
Requirement already satisfied: ifaddr in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.13) (0.1.6)
Requirement already satisfied: xmltodict in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.13) (0.12.0)
Requirement already satisfied: requests in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.13) (2.22.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.13) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.13) (2019.6.16)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.13) (1.25.3)
Requirement already satisfied: idna<2.9,>=2.5 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.13) (2.8)
Installing collected packages: pysonos
  Found existing installation: pysonos 0.0.19
    Uninstalling pysonos-0.0.19:
      Successfully uninstalled pysonos-0.0.19
Successfully installed pysonos-0.0.13
(discovery-testing) root@80e47d43daec:/usr/src/app# python -c 'import pysonos; print(pysonos.discovery.discover(all_households=True));'
{SoCo("192.168.1.166"), SoCo("192.168.1.149")}
(discovery-testing) root@80e47d43daec:/usr/src/app# time python -c 'import pysonos; print([p.volume for p in pysonos.discovery.discover(all_households=True)]);'
[50, 57]

real    0m2.659s
user    0m0.447s
sys 0m0.040s
(discovery-testing) root@80e47d43daec:/usr/src/app# pip install pysonos==0.0.17
Collecting pysonos==0.0.17
  Using cached https://files.pythonhosted.org/packages/80/61/1379ce49810a325db2e9a377b338850ce6ca5cf700ef2b1eac608f75d24f/pysonos-0.0.17-py2.py3-none-any.whl
Requirement already satisfied: ifaddr in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.17) (0.1.6)
Requirement already satisfied: xmltodict in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.17) (0.12.0)
Requirement already satisfied: requests in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.17) (2.22.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.17) (1.25.3)
Requirement already satisfied: certifi>=2017.4.17 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.17) (2019.6.16)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.17) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.17) (2.8)
Installing collected packages: pysonos
  Found existing installation: pysonos 0.0.13
    Uninstalling pysonos-0.0.13:
      Successfully uninstalled pysonos-0.0.13
Successfully installed pysonos-0.0.17
(discovery-testing) root@80e47d43daec:/usr/src/app# time python -c 'import pysonos; print([p.volume for p in pysonos.discovery.discover(all_households=True)]);'
[50, 57]

real    0m2.013s
user    0m0.431s
sys 0m0.040s
(discovery-testing) root@80e47d43daec:/usr/src/app# pip install pysonos==0.0.19
Collecting pysonos==0.0.19
  Using cached https://files.pythonhosted.org/packages/b8/6a/89a9d420cf1d7f4b9b986ce8e023ab0eac2da6268d9fb234b59ce8cf794f/pysonos-0.0.19-py2.py3-none-any.whl
Requirement already satisfied: ifaddr in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.19) (0.1.6)
Requirement already satisfied: xmltodict in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.19) (0.12.0)
Requirement already satisfied: requests in ./discovery-testing/lib/python3.7/site-packages (from pysonos==0.0.19) (2.22.0)
Requirement already satisfied: certifi>=2017.4.17 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.19) (2019.6.16)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.19) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.19) (1.25.3)
Requirement already satisfied: idna<2.9,>=2.5 in ./discovery-testing/lib/python3.7/site-packages (from requests->pysonos==0.0.19) (2.8)
Installing collected packages: pysonos
  Found existing installation: pysonos 0.0.17
    Uninstalling pysonos-0.0.17:
      Successfully uninstalled pysonos-0.0.17
Successfully installed pysonos-0.0.19
(discovery-testing) root@80e47d43daec:/usr/src/app# time python -c 'import pysonos; print([p.volume for p in pysonos.discovery.discover(all_households=True)]);'
[57, 50]

real    0m2.504s
user    0m0.462s
sys 0m0.046s
zacs commented 5 years ago

This is the trace I get that results in a hung HA, with the Docker image re-pulled in the last 12 hours:

Exception in thread Thread-2506:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 80, in create_connection
    raise err
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 70, in create_connection
    sock.connect(sa)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 355, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1016, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 956, in send
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 183, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 165, in _new_conn
    (self.host, self.timeout))
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPConnection object at 0x7fb7c8c9c828>, 'Connection to 192.168.2.18 timed out. (connect timeout=20)')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 641, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.7/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.2.18', port=1400): Max retries exceeded with url: /ZoneGroupTopology/Control (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7fb7c8c9c828>, 'Connection to 192.168.2.18 timed out. (connect timeout=20)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pysonos/services.py", line 472, in send_command
    timeout=20,
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 116, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 504, in send
    raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='192.168.2.18', port=1400): Max retries exceeded with url: /ZoneGroupTopology/Control (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7fb7c8c9c828>, 'Connection to 192.168.2.18 timed out. (connect timeout=20)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/site-packages/pysonos/discovery.py", line 157, in _discover_thread
    if zone.is_visible or include_invisible:
  File "/usr/local/lib/python3.7/site-packages/pysonos/core.py", line 351, in is_visible
    return self in self.visible_zones
  File "/usr/local/lib/python3.7/site-packages/pysonos/core.py", line 1061, in visible_zones
    self._parse_zone_group_state()
  File "/usr/local/lib/python3.7/site-packages/pysonos/core.py", line 972, in _parse_zone_group_state
    cache=self._zgs_cache)['ZoneGroupState']
  File "/usr/local/lib/python3.7/site-packages/pysonos/services.py", line 206, in _dispatcher
    return self.send_command(action, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pysonos/services.py", line 475, in send_command
    raise SoCoException('Connection error: ' + str(ex))
pysonos.exceptions.SoCoException: Connection error: HTTPConnectionPool(host='192.168.2.18', port=1400): Max retries exceeded with url: /ZoneGroupTopology/Control (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7fb7c8c9c828>, 'Connection to 192.168.2.18 timed out. (connect timeout=20)'))
amelchio commented 5 years ago

@cannfoddr Thanks. That all looks normal so the issue is probably in Home Assistant code. Let us await the 0.96 beta (should be out today) where debugging will be easier.

@zacs That does not look normal. Did it also work for you with 0.94.x and break with 0.95.0? How does static configuration work for you?

amelchio commented 5 years ago

To move this along, the next step is to test the 0.96 beta (when available) with these logger settings and post relevant logs:

logger:
  default: info
  logs:
    homeassistant.components.discovery: debug
    homeassistant.components.ssdp: debug
    homeassistant.components.sonos: debug
    pysonos: info

Thanks!

cannfoddr commented 5 years ago

Just updated my Docker to 0.96.0b0 and enabled the logging as per the above. I am now seeing something a little more useful in the logs:

2019-07-11 10:39:04 DEBUG (Thread-3) [homeassistant.components.sonos.media_player] Reached _discovered_player, soco=<SoCo object at ip 192.168.1.166>
2019-07-11 10:39:04 DEBUG (Thread-3) [homeassistant.components.sonos.media_player] Adding new entity
2019-07-11 10:39:05 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 356, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.kitchen. Platform sonos does not generate unique IDs
2019-07-11 10:39:11 DEBUG (MainThread) [homeassistant.components.ssdp] Scanning
2019-07-11 10:39:11 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 226, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    self.entity_id, state, attr, self.force_update, self._context)
  File "/usr/src/app/homeassistant/core.py", line 929, in async_set
    context)
  File "/usr/src/app/homeassistant/core.py", line 696, in __init__
    "State max length is 255 characters.").format(entity_id))
2019-07-11 10:40:05 DEBUG (Thread-3) [homeassistant.components.sonos.media_player] Reached _discovered_player, soco=<SoCo object at ip 192.168.1.166>
2019-07-11 10:40:05 DEBUG (Thread-3) [homeassistant.components.sonos.media_player] Adding new entity
2019-07-11 10:40:05 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
2019-07-11 10:40:05 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 356, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.kitchen. Platform sonos does not generate unique IDs
2019-07-11 10:40:05 DEBUG (Thread-3) [homeassistant.components.sonos.media_player] Reached _discovered_player, soco=<SoCo object at ip 192.168.1.149>
2019-07-11 10:40:05 DEBUG (Thread-3) [homeassistant.components.sonos.media_player] Adding new entity
2019-07-11 10:40:05 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 356, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.living_room_2. Platform sonos does not generate unique IDs
2019-07-11 10:40:12 DEBUG (MainThread) [homeassistant.components.ssdp] Scanning
2019-07-11 10:40:12 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 226, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    self.entity_id, state, attr, self.force_update, self._context)
  File "/usr/src/app/homeassistant/core.py", line 929, in async_set
    context)
  File "/usr/src/app/homeassistant/core.py", line 696, in __init__
    "State max length is 255 characters.").format(entity_id))
homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity id: sensor.microserver_host_data. State max length is 255 characters.
2019-07-11 10:40:31 INFO (SyncWorker_7) [homeassistant.components.tado] Querying mytado.com for zone 1 Heating
2019-07-11 10:40:31 INFO (SyncWorker_7) [homeassistant.components.tado] Querying mytado.com for device 61216 Veronique and Adrian's Home
2019-07-11 10:40:43 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 226, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    self.entity_id, state, attr, self.force_update, self._context)
  File "/usr/src/app/homeassistant/core.py", line 929, in async_set
    context)
  File "/usr/src/app/homeassistant/core.py", line 696, in __init__
    "State max length is 255 characters.").format(entity_id))
homeassistant.exceptions.InvalidStateError: Invalid state encountered for entity id: sensor.microserver_host_data. State max length is 255 characters.
2019-07-11 10:41:00 INFO (MainThread) [homeassistant.components.automation] Executing update_battery_status_group_members
2019-07-11 10:41:00 INFO (MainThread) [homeassistant.helpers.script] Script update_battery_status_group_members: Running script
2019-07-11 10:41:00 INFO (MainThread) [homeassistant.helpers.script] Script update_battery_status_group_members: Executing step call service
2019-07-11 10:41:02 INFO (SyncWorker_5) [homeassistant.components.tado] Querying mytado.com for zone 1 Heating
2019-07-11 10:41:02 INFO (SyncWorker_5) [homeassistant.components.tado] Querying mytado.com for device 61216 Veronique and Adrian's Home
2019-07-11 10:41:05 DEBUG (Thread-3) [homeassistant.components.sonos.media_player] Reached _discovered_player, soco=<SoCo object at ip 192.168.1.166>
2019-07-11 10:41:05 DEBUG (Thread-3) [homeassistant.components.sonos.media_player] Adding new entity
2019-07-11 10:41:05 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 356, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.kitchen. Platform sonos does not generate unique IDs
2019-07-11 10:41:05 DEBUG (Thread-3) [homeassistant.components.sonos.media_player] Reached _discovered_player, soco=<SoCo object at ip 192.168.1.149>
2019-07-11 10:41:05 DEBUG (Thread-3) [homeassistant.components.sonos.media_player] Adding new entity
2019-07-11 10:41:05 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 356, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.living_room_2. Platform sonos does not generate unique IDs

I just logged in remotely to see the UI and I now have devices showing under Sonos!!!

amelchio commented 5 years ago

That's progress ... I think. It seems that some initial logs are missing though?

cannfoddr commented 5 years ago

I've just gone and tried to rename the Sonos media players under the integrations section and I have been able to rename them to something unique at the device and entity level. I am seeing some slightly odd behaviour when I do this (maybe a reset of some kind) but it does seem to work.

just doing another restart to see if everything comes back with the new naming.

cannfoddr commented 5 years ago

let me trawl the logs - just done a full remove and re-add for Sonos via the integrations:

Discovery and load:

2019-07-11 13:02:51 DEBUG (MainThread) [homeassistant.components.ssdp] Discovered sonos at http://192.168.1.149:1400/xml/device_description.xml
2019-07-11 13:02:51 DEBUG (MainThread) [homeassistant.components.ssdp] Discovered sonos at http://192.168.1.166:1400/xml/device_description.xml
2019-07-11 13:02:51 INFO (SyncWorker_1) [homeassistant.loader] Loaded sonos from homeassistant.components.sonos

something Spotify upnp:

2019-07-11 13:03:31 INFO (MainThread) [homeassistant.components.discovery] Unknown service discovered: spotify_connect {'host': '192.168.1.149', 'port': 1400, 'hostname': 'sonos000E58119EF0.local.', 'properties': {'VERSION': '1.0', 'CPath': '/spotifyzc'}}
2019-07-11 13:03:31 INFO (MainThread) [homeassistant.components.discovery] Unknown service discovered: spotify_connect {'host': '192.168.1.166', 'port': 1400, 'hostname': 'sonos000E58F1C3FE.local.', 'properties': {'VERSION': '1.0', 'CPath': '/spotifyzc'}}

Sonos integration setup:

2019-07-11 13:06:37 INFO (MainThread) [homeassistant.setup] Setting up sonos
2019-07-11 13:06:37 INFO (MainThread) [homeassistant.setup] Setup of domain sonos took 0.0 seconds.
2019-07-11 13:06:37 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.sonos
2019-07-11 13:06:37 DEBUG (MainThread) [homeassistant.components.sonos.media_player] Reached async_setup_entry, config={}
2019-07-11 13:06:37 DEBUG (MainThread) [homeassistant.components.sonos.media_player] Adding discovery job
2019-07-11 13:06:37 DEBUG (SyncWorker_4) [homeassistant.components.sonos.media_player] Starting discovery thread

an exception:

2019-07-11 13:06:37 DEBUG (Thread-6) [homeassistant.components.sonos.media_player] Reached _discovered_player, soco=<SoCo object at ip 192.168.1.166>
2019-07-11 13:06:37 DEBUG (Thread-6) [homeassistant.components.sonos.media_player] Adding new entity
2019-07-11 13:06:37 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new media_player.sonos entity: media_player.kitchen
2019-07-11 13:06:38 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pysonos/data_structures_entry.py", line 49, in from_didl_string
    cls = _DIDL_CLASS_TO_CLASS[item_class]
KeyError: 'object.item.audioItem.musicTrack.recentShow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 363, in _async_add_entity
    await entity.async_added_to_hass()
  File "/usr/src/app/homeassistant/components/sonos/media_player.py", line 281, in async_added_to_hass
    await self.async_seen()
  File "/usr/src/app/homeassistant/components/sonos/media_player.py", line 346, in async_seen
    await self.hass.async_add_executor_job(self._attach_player)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/sonos/media_player.py", line 395, in _attach_player
    self._set_favorites()
  File "/usr/src/app/homeassistant/components/sonos/media_player.py", line 376, in _set_favorites
    self._favorites = [f for f in favorites if f.reference.resources]
  File "/usr/src/app/homeassistant/components/sonos/media_player.py", line 376, in <listcomp>
    self._favorites = [f for f in favorites if f.reference.resources]
  File "/usr/local/lib/python3.7/site-packages/pysonos/data_structures.py", line 857, in reference
    getattr(self, 'resource_meta_data'))[0]
  File "/usr/local/lib/python3.7/site-packages/pysonos/data_structures_entry.py", line 51, in from_didl_string
    raise DIDLMetadataError("Unknown UPnP class: %s" % item_class)
pysonos.exceptions.DIDLMetadataError: Unknown UPnP class: object.item.audioItem.musicTrack.recentShow

Kitchen SONOS:

2019-07-11 13:07:38 DEBUG (Thread-6) [homeassistant.components.sonos.media_player] Reached _discovered_player, soco=<SoCo object at ip 192.168.1.166>
2019-07-11 13:07:38 DEBUG (Thread-6) [homeassistant.components.sonos.media_player] Adding new entity
2019-07-11 13:07:38 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 356, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.kitchen. Platform sonos does not generate unique IDs

Living Room SONOS:

2019-07-11 13:09:37 DEBUG (Thread-6) [homeassistant.components.sonos.media_player] Reached _discovered_player, soco=<SoCo object at ip 192.168.1.149>
2019-07-11 13:09:37 DEBUG (Thread-6) [homeassistant.components.sonos.media_player] Adding new entity
2019-07-11 13:09:37 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new media_player.sonos entity: media_player.living_room_2
2019-07-11 13:09:38 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pysonos/data_structures_entry.py", line 49, in from_didl_string
    cls = _DIDL_CLASS_TO_CLASS[item_class]
KeyError: 'object.item.audioItem.musicTrack.recentShow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 363, in _async_add_entity
    await entity.async_added_to_hass()
  File "/usr/src/app/homeassistant/components/sonos/media_player.py", line 281, in async_added_to_hass
    await self.async_seen()
  File "/usr/src/app/homeassistant/components/sonos/media_player.py", line 346, in async_seen
    await self.hass.async_add_executor_job(self._attach_player)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/sonos/media_player.py", line 395, in _attach_player
    self._set_favorites()
  File "/usr/src/app/homeassistant/components/sonos/media_player.py", line 376, in _set_favorites
    self._favorites = [f for f in favorites if f.reference.resources]
  File "/usr/src/app/homeassistant/components/sonos/media_player.py", line 376, in <listcomp>
    self._favorites = [f for f in favorites if f.reference.resources]
  File "/usr/local/lib/python3.7/site-packages/pysonos/data_structures.py", line 857, in reference
    getattr(self, 'resource_meta_data'))[0]
  File "/usr/local/lib/python3.7/site-packages/pysonos/data_structures_entry.py", line 51, in from_didl_string
    raise DIDLMetadataError("Unknown UPnP class: %s" % item_class)
pysonos.exceptions.DIDLMetadataError: Unknown UPnP class: object.item.audioItem.musicTrack.recentShow

more discovery:

2019-07-11 13:13:37 DEBUG (Thread-6) [homeassistant.components.sonos.media_player] Reached _discovered_player, soco=<SoCo object at ip 192.168.1.149>
2019-07-11 13:13:37 DEBUG (Thread-6) [homeassistant.components.sonos.media_player] Adding new entity
2019-07-11 13:13:38 DEBUG (Thread-6) [homeassistant.components.sonos.media_player] Reached _discovered_player, soco=<SoCo object at ip 192.168.1.166>
2019-07-11 13:13:38 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 356, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.living_room_2. Platform sonos does not generate unique IDs
2019-07-11 13:13:38 DEBUG (Thread-6) [homeassistant.components.sonos.media_player] Adding new entity
2019-07-11 13:13:38 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 356, in _async_add_entity
    raise HomeAssistantError(msg)
homeassistant.exceptions.HomeAssistantError: Entity id already exists: media_player.kitchen. Platform sonos does not generate unique IDs

In summary:

I have 2 Sonos media player entities - both of which are showing as unavailable

image

The integrations page shows Sonos:

image

Media Player cards are unavailable:

image

I'm back to default naming for now - don't want to mess with this

amelchio commented 5 years ago

Unknown UPnP class: object.item.audioItem.musicTrack.recentShow

I think this is the problem 👍. Will fix tonight.

amelchio commented 5 years ago

BTW, you should be able to avoid the problem by deleting all podcast episodes from Sonos Favorites.

dancwilliams commented 5 years ago

As soon as I removed the one podcast episode I had in Sonos Favorites my devices started popping back up.

amelchio commented 5 years ago

The fix is now available in 0.96 beta 1.

cannfoddr commented 5 years ago

Was all looking quite good I had both players showing with correct status. But they are now both showing as unavailable. I am seeing connection errors in the logs with "No route to Host":

2019-07-12 20:48:21 DEBUG (Thread-3) [homeassistant.components.sonos.media_player] Reached _discovered_player, soco=<SoCo object at ip 192.168.1.166>
2019-07-12 20:48:21 DEBUG (Thread-3) [homeassistant.components.sonos.media_player] Seen <Entity Kitchen: paused>
2019-07-12 20:48:21 DEBUG (Thread-3) [homeassistant.components.sonos.media_player] Reached _discovered_player, soco=<SoCo object at ip 192.168.1.149>
2019-07-12 20:48:21 DEBUG (Thread-3) [homeassistant.components.sonos.media_player] Seen <Entity Living Room: paused>
2019-07-12 20:48:24 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 80, in create_connection
    raise err
  File "/usr/local/lib/python3.7/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 "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 355, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/lib/python3.7/http/client.py", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1290, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1239, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 183, in connect
    conn = self._new_conn()
  File "/usr/local/lib/python3.7/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 0x7f9bf985cb50>: 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 "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 641, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.7/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.149', port=1400): Max retries exceeded with url: /MediaRenderer/AVTransport/Control (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9bf985cb50>: 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 "/usr/local/lib/python3.7/site-packages/pysonos/services.py", line 472, in send_command
    timeout=20,
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 116, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.149', port=1400): Max retries exceeded with url: /MediaRenderer/AVTransport/Control (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9bf985cb50>: 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 "/usr/src/app/homeassistant/components/sonos/media_player.py", line 346, in async_seen
    await self.hass.async_add_executor_job(self._attach_player)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/sonos/media_player.py", line 399, in _attach_player
    self._shuffle = self.soco.shuffle
  File "/usr/local/lib/python3.7/site-packages/pysonos/core.py", line 425, in shuffle
    return PLAY_MODES[self.play_mode][0]
  File "/usr/local/lib/python3.7/site-packages/pysonos/core.py", line 403, in play_mode
    ('InstanceID', 0),
  File "/usr/local/lib/python3.7/site-packages/pysonos/services.py", line 206, in _dispatcher
    return self.send_command(action, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pysonos/services.py", line 475, in send_command
    raise SoCoException('Connection error: ' + str(ex))
pysonos.exceptions.SoCoException: Connection error: HTTPConnectionPool(host='192.168.1.149', port=1400): Max retries exceeded with url: /MediaRenderer/AVTransport/Control (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9bf985cb50>: Failed to establish a new connection: [Errno 113] No route to host'))
2019-07-12 20:48:36 DEBUG (MainThread) [homeassistant.components.ssdp] Scanning
2019-07-12 20:48:36 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity.py", line 226, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/app/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    self.entity_id, state, attr, self.force_update, self._context)
  File "/usr/src/app/homeassistant/core.py", line 929, in async_set
    context)
  File "/usr/src/app/homeassistant/core.py", line 696, in __init__
    "State max length is 255 characters.").format(entity_id))
amelchio commented 5 years ago

Fixes are now released in 0.96.0. If anyone is still having trouble, please file new issues.