From 0c9f9486bfc0ca51eeaf2774f223c0677edf4588 Mon Sep 17 00:00:00 2001
From: Oliver <10700296+ol-iver@users.noreply.github.com>
Date: Sun, 11 Feb 2024 08:29:40 +0100
Subject: [PATCH] Update `denonavr` to `0.11.6` (#110231)

* Update `denonavr` to `0.11.5`

* Handle `AvrProcessingError` exception

* Remove obsolete `_telnet_was_healthy` property from receiver

* Update `denonavr` to `0.11.6`
---
 .../components/denonavr/manifest.json         |  2 +-
 .../components/denonavr/media_player.py       | 30 +++++++++----------
 requirements_all.txt                          |  2 +-
 requirements_test_all.txt                     |  2 +-
 4 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/homeassistant/components/denonavr/manifest.json b/homeassistant/components/denonavr/manifest.json
index 0ba8caed6c5..9188009bde5 100644
--- a/homeassistant/components/denonavr/manifest.json
+++ b/homeassistant/components/denonavr/manifest.json
@@ -6,7 +6,7 @@
   "documentation": "https://www.home-assistant.io/integrations/denonavr",
   "iot_class": "local_push",
   "loggers": ["denonavr"],
-  "requirements": ["denonavr==0.11.4"],
+  "requirements": ["denonavr==0.11.6"],
   "ssdp": [
     {
       "manufacturer": "Denon",
diff --git a/homeassistant/components/denonavr/media_player.py b/homeassistant/components/denonavr/media_player.py
index 125fec7caaa..f5050af357d 100644
--- a/homeassistant/components/denonavr/media_player.py
+++ b/homeassistant/components/denonavr/media_player.py
@@ -21,6 +21,7 @@ from denonavr.exceptions import (
     AvrCommandError,
     AvrForbiddenError,
     AvrNetworkError,
+    AvrProcessingError,
     AvrTimoutError,
     DenonAvrError,
 )
@@ -201,6 +202,16 @@ def async_log_errors(
                     self._receiver.host,
                 )
                 self._attr_available = False
+        except AvrProcessingError:
+            available = True
+            if self.available:
+                _LOGGER.warning(
+                    (
+                        "Update of Denon AVR receiver at host %s not complete. "
+                        "Device is still available"
+                    ),
+                    self._receiver.host,
+                )
         except AvrForbiddenError:
             available = False
             if self.available:
@@ -274,8 +285,6 @@ class DenonDevice(MediaPlayerEntity):
             and MediaPlayerEntityFeature.SELECT_SOUND_MODE
         )
 
-        self._telnet_was_healthy: bool | None = None
-
     async def _telnet_callback(self, zone: str, event: str, parameter: str) -> None:
         """Process a telnet command callback."""
         # There are multiple checks implemented which reduce unnecessary updates of the ha state machine
@@ -306,24 +315,13 @@ class DenonDevice(MediaPlayerEntity):
         """Get the latest status information from device."""
         receiver = self._receiver
 
-        # We can only skip the update if telnet was healthy after
-        # the last update and is still healthy now to ensure that
-        # we don't miss any state changes while telnet is down
-        # or reconnecting.
-        if (
-            telnet_is_healthy := receiver.telnet_connected and receiver.telnet_healthy
-        ) and self._telnet_was_healthy:
+        # We skip the update if telnet is healthy.
+        # When telnet recovers it automatically updates all properties.
+        if receiver.telnet_connected and receiver.telnet_healthy:
             return
 
-        # if async_update raises an exception, we don't want to skip the next update
-        # so we set _telnet_was_healthy to None here and only set it to the value
-        # before the update if the update was successful
-        self._telnet_was_healthy = None
-
         await receiver.async_update()
 
-        self._telnet_was_healthy = telnet_is_healthy
-
         if self._update_audyssey:
             await receiver.async_update_audyssey()
 
diff --git a/requirements_all.txt b/requirements_all.txt
index 629cf201f76..8d819f4b931 100644
--- a/requirements_all.txt
+++ b/requirements_all.txt
@@ -704,7 +704,7 @@ deluge-client==1.7.1
 demetriek==0.4.0
 
 # homeassistant.components.denonavr
-denonavr==0.11.4
+denonavr==0.11.6
 
 # homeassistant.components.devialet
 devialet==1.4.5
diff --git a/requirements_test_all.txt b/requirements_test_all.txt
index cd306a65840..139baf8d95f 100644
--- a/requirements_test_all.txt
+++ b/requirements_test_all.txt
@@ -579,7 +579,7 @@ deluge-client==1.7.1
 demetriek==0.4.0
 
 # homeassistant.components.denonavr
-denonavr==0.11.4
+denonavr==0.11.6
 
 # homeassistant.components.devialet
 devialet==1.4.5
-- 
GitLab