Fix exception ordering in yeelight for python 3.11 (#88134)

This commit is contained in:
J. Nick Koston 2023-02-14 15:17:22 -06:00 committed by GitHub
parent 9756131473
commit 5f69ae4360
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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