From 5f69ae436003c75b1eeac2ec488049197e87e9ff Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 14 Feb 2023 15:17:22 -0600 Subject: [PATCH] Fix exception ordering in yeelight for python 3.11 (#88134) --- homeassistant/components/yeelight/device.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/yeelight/device.py b/homeassistant/components/yeelight/device.py index 1455e168a23..0fabe693aa9 100644 --- a/homeassistant/components/yeelight/device.py +++ b/homeassistant/components/yeelight/device.py @@ -168,12 +168,6 @@ class YeelightDevice: self._available = True if not self._initialized: self._initialized = True - except OSError as ex: - if self._available: # just inform once - _LOGGER.error( - "Unable to update device %s, %s: %s", self._host, self.name, ex - ) - self._available = False except asyncio.TimeoutError as ex: _LOGGER.debug( "timed out while trying to update device %s, %s: %s", @@ -181,6 +175,12 @@ class YeelightDevice: self.name, ex, ) + except OSError as ex: + if self._available: # just inform once + _LOGGER.error( + "Unable to update device %s, %s: %s", self._host, self.name, ex + ) + self._available = False except BulbException as ex: _LOGGER.debug( "Unable to update device %s, %s: %s", self._host, self.name, ex