A breaking change announced with release of HA 2022.6 revealed a need to update a couple of my scripts.
BREAKING CHANGE - The
sonos.join
andsonos.unjoin
services will be removed in 2022.8 in favor of the standardmedia_player.join
andmedia_player.unjoin
services.
I’ve been successful at editing one script. A script that previously used sonos.unjoin
has been update to use media_player.unjoin
. It’s working without an issue. A second script, one that joins three Sonos units, is giving me intermittent errors. The script is;
service: media_player.join
data:
group_members:
- media_player.kitchen_sonos
- media_player.livingroom_sonos
target:
entity_id: media_player.breakfast_sonos
Here’s what’s in the logs;
Logger: homeassistant.components.websocket_api.http.connection
Source: components/sonos/helpers.py:81
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 7:44:06 AM (2 occurrences)
Last logged: 7:45:01 AM
[281472558628000] Error calling SonosSpeaker.unjoin on Breakfast Sonos: HTTPConnectionPool(host='192.168.86.84', port=1400): Read timed out. (read timeout=9.5)
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 449, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 444, in _make_request
httplib_response = conn.getresponse()
File "/usr/local/lib/python3.9/http/client.py", line 1377, in getresponse
response.begin()
File "/usr/local/lib/python3.9/http/client.py", line 320, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.9/http/client.py", line 281, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/lib/python3.9/socket.py", line 704, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 440, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 785, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 550, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.9/site-packages/urllib3/packages/six.py", line 770, in reraise
raise value
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 451, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 340, in _raise_timeout
raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='192.168.86.84', port=1400): Read timed out. (read timeout=9.5)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sonos/helpers.py", line 67, in wrapper
result = funct(self, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/sonos/speaker.py", line 883, in unjoin
self.soco.unjoin()
File "/usr/local/lib/python3.9/site-packages/soco/core.py", line 1759, in unjoin
self.avTransport.BecomeCoordinatorOfStandaloneGroup([("InstanceID", 0)])
File "/usr/local/lib/python3.9/site-packages/soco/services.py", line 207, in _dispatcher
return self.send_command(action, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/soco/services.py", line 487, in send_command
response = requests.post(
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 117, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 529, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 645, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 532, in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='192.168.86.84', port=1400): Read timed out. (read timeout=9.5)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 193, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1704, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1741, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 290, in service_handler
await script_entity.async_turn_on(
File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 398, in async_turn_on
await coro
File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 428, in _async_run
return await self.script.async_run(script_vars, context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1513, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 405, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 449, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 472, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1704, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1741, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 680, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 964, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 717, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 1024, in async_unjoin_player
await self.hass.async_add_executor_job(self.unjoin_player)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/sonos/media_player.py", line 767, in unjoin_player
self.speaker.unjoin()
File "/usr/src/homeassistant/homeassistant/components/sonos/helpers.py", line 81, in wrapper
raise SonosUpdateError(message) from err
homeassistant.components.sonos.exception.SonosUpdateError: Error calling SonosSpeaker.unjoin on Breakfast Sonos: HTTPConnectionPool(host='192.168.86.84', port=1400): Read timed out. (read timeout=9.5)
Please help me understand what may be causing this error so that I may correct the problem.
It’s worth noting the Livingroom Sonos is a pair of speakers configured in stereo.