From 2c492d71f7fe38319b46093bd2c684b6a66c43ff Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 11 May 2021 23:55:10 -0500 Subject: [PATCH 1/6] Handle transport errors when updating media via events (#50480) Co-authored-by: Jason Lawrence --- .../components/sonos/media_player.py | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/sonos/media_player.py b/homeassistant/components/sonos/media_player.py index 11f59f2f432..f1780920336 100644 --- a/homeassistant/components/sonos/media_player.py +++ b/homeassistant/components/sonos/media_player.py @@ -498,9 +498,14 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity): if new_status == "TRANSITIONING": return - self._play_mode = ( - variables["current_play_mode"] if variables else self.soco.play_mode - ) + if variables and "transport_state" in variables: + self._play_mode = variables["current_play_mode"] + track_uri = variables["current_track_uri"] + music_source = self.soco.music_source_from_uri(track_uri) + else: + self._play_mode = self.soco.play_mode + music_source = self.soco.music_source + self._uri = None self._media_duration = None self._media_image_url = None @@ -514,13 +519,6 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity): update_position = new_status != self._status self._status = new_status - if variables: - track_uri = variables["current_track_uri"] - music_source = self.soco.music_source_from_uri(track_uri) - else: - # This causes a network round-trip so we avoid it when possible - music_source = self.soco.music_source - if music_source == MUSIC_SRC_TV: self.update_media_linein(SOURCE_TV) elif music_source == MUSIC_SRC_LINE_IN: @@ -556,7 +554,7 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity): self._media_title = source self._source_name = source - def update_media_radio(self, variables: dict) -> None: + def update_media_radio(self, variables: dict | None) -> None: """Update state when streaming radio.""" self._clear_media_position() From 17c1031973a96ed267797c90df5244dfb81c05e9 Mon Sep 17 00:00:00 2001 From: jjlawren Date: Tue, 11 May 2021 23:55:32 -0500 Subject: [PATCH 2/6] Hotfix for Sonos favorites race condition (#50495) --- homeassistant/components/sonos/media_player.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/sonos/media_player.py b/homeassistant/components/sonos/media_player.py index f1780920336..022beef3219 100644 --- a/homeassistant/components/sonos/media_player.py +++ b/homeassistant/components/sonos/media_player.py @@ -454,7 +454,8 @@ class SonosMediaPlayerEntity(SonosEntity, MediaPlayerEntity): async def async_reconnect_player(self) -> None: """Set basic information when player is reconnected.""" - await self.hass.async_add_executor_job(self._reconnect_player) + async with self.data.topology_condition: + await self.hass.async_add_executor_job(self._reconnect_player) def _reconnect_player(self) -> None: """Set basic information when player is reconnected.""" From 99044f5454c6e11ca73a049d600e0e778b6f1f31 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Wed, 12 May 2021 07:27:11 +0200 Subject: [PATCH 3/6] Include _StopScript.__cause__ in trace (#50441) Co-authored-by: Paulus Schoutsen --- homeassistant/helpers/script.py | 3 +++ tests/helpers/test_script.py | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/homeassistant/helpers/script.py b/homeassistant/helpers/script.py index 5a7fdcd1767..1deb5a5073f 100644 --- a/homeassistant/helpers/script.py +++ b/homeassistant/helpers/script.py @@ -193,6 +193,9 @@ async def trace_action(hass, script_run, stop, variables): try: yield trace_element + except _StopScript as ex: + trace_element.set_error(ex.__cause__ or ex) + raise ex except Exception as ex: trace_element.set_error(ex) raise ex diff --git a/tests/helpers/test_script.py b/tests/helpers/test_script.py index a0207edcbdd..2045f8cdbbc 100644 --- a/tests/helpers/test_script.py +++ b/tests/helpers/test_script.py @@ -622,7 +622,7 @@ async def test_delay_template_invalid(hass, caplog): assert_action_trace( { "0": [{"result": {"event": "test_event", "event_data": {}}}], - "1": [{"error_type": script._StopScript}], + "1": [{"error_type": vol.MultipleInvalid}], }, expected_script_execution="aborted", ) @@ -683,7 +683,7 @@ async def test_delay_template_complex_invalid(hass, caplog): assert_action_trace( { "0": [{"result": {"event": "test_event", "event_data": {}}}], - "1": [{"error_type": script._StopScript}], + "1": [{"error_type": vol.MultipleInvalid}], }, expected_script_execution="aborted", ) @@ -1138,7 +1138,7 @@ async def test_wait_continue_on_timeout( } if continue_on_timeout is False: expected_trace["0"][0]["result"]["timeout"] = True - expected_trace["0"][0]["error_type"] = script._StopScript + expected_trace["0"][0]["error_type"] = asyncio.TimeoutError expected_script_execution = "aborted" else: expected_trace["1"] = [ From 8a3514ed44f9e13e04d34f6f27124de3fa8f5b3e Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 12 May 2021 00:09:22 +0200 Subject: [PATCH 4/6] update denonavr version 0.10.8 (#50476) --- homeassistant/components/denonavr/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/denonavr/manifest.json b/homeassistant/components/denonavr/manifest.json index ed6b94e207a..c684c8b0dc5 100644 --- a/homeassistant/components/denonavr/manifest.json +++ b/homeassistant/components/denonavr/manifest.json @@ -3,7 +3,7 @@ "name": "Denon AVR Network Receivers", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/denonavr", - "requirements": ["denonavr==0.10.7"], + "requirements": ["denonavr==0.10.8"], "codeowners": ["@scarface-4711", "@starkillerOG"], "ssdp": [ { diff --git a/requirements_all.txt b/requirements_all.txt index 1e3328a6c3a..c8951f78950 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -479,7 +479,7 @@ defusedxml==0.6.0 deluge-client==1.7.1 # homeassistant.components.denonavr -denonavr==0.10.7 +denonavr==0.10.8 # homeassistant.components.devolo_home_control devolo-home-control-api==0.17.3 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index f199871ff9f..52c9d3de192 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -264,7 +264,7 @@ debugpy==1.2.1 defusedxml==0.6.0 # homeassistant.components.denonavr -denonavr==0.10.7 +denonavr==0.10.8 # homeassistant.components.devolo_home_control devolo-home-control-api==0.17.3 From c477c311902a9eb2b74eed384c03118e1b2dabfb Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 11 May 2021 22:15:36 -0700 Subject: [PATCH 5/6] Bump aiohue to 2.3.1 (#50506) --- homeassistant/components/hue/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/hue/manifest.json b/homeassistant/components/hue/manifest.json index de00d31f2c7..76d02d2b9fc 100644 --- a/homeassistant/components/hue/manifest.json +++ b/homeassistant/components/hue/manifest.json @@ -3,7 +3,7 @@ "name": "Philips Hue", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/hue", - "requirements": ["aiohue==2.3.0"], + "requirements": ["aiohue==2.3.1"], "ssdp": [ { "manufacturer": "Royal Philips Electronics", diff --git a/requirements_all.txt b/requirements_all.txt index c8951f78950..263c6dc8e1d 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -182,7 +182,7 @@ aiohomekit==0.2.61 aiohttp_cors==0.7.0 # homeassistant.components.hue -aiohue==2.3.0 +aiohue==2.3.1 # homeassistant.components.imap aioimaplib==0.7.15 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 52c9d3de192..8543f74a4f8 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -119,7 +119,7 @@ aiohomekit==0.2.61 aiohttp_cors==0.7.0 # homeassistant.components.hue -aiohue==2.3.0 +aiohue==2.3.1 # homeassistant.components.apache_kafka aiokafka==0.6.0 From 421e1b99566190ee8b007750654c75e858ebd4aa Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 11 May 2021 22:27:42 -0700 Subject: [PATCH 6/6] Bumped version to 2021.5.3 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index 51f762ad026..f246d7407fa 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 2021 MINOR_VERSION = 5 -PATCH_VERSION = "2" +PATCH_VERSION = "3" __short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}" __version__ = f"{__short_version__}.{PATCH_VERSION}" REQUIRED_PYTHON_VER = (3, 8, 0)