From 99477950688ce06be8b99fa4e6a9a2195ce4f939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Wed, 18 Aug 2021 17:26:54 +0300 Subject: [PATCH] Treat Huawei LTE error code 100006 as unsupported functionality (#54253) Internet says 100006 could mean "parameter error", B2368-F20 is reported to respond with that to lan/HostInfo requests. While at it, handle the special case error codes and the "real" not supported exception in the same block. Closes https://github.com/home-assistant/core/issues/53280 --- homeassistant/components/huawei_lte/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/huawei_lte/__init__.py b/homeassistant/components/huawei_lte/__init__.py index e220975dbf1773..ec9281659f5dfa 100644 --- a/homeassistant/components/huawei_lte/__init__.py +++ b/homeassistant/components/huawei_lte/__init__.py @@ -185,11 +185,6 @@ def _get_data(self, key: str, func: Callable[[], Any]) -> None: _LOGGER.debug("Getting %s for subscribers %s", key, self.subscriptions[key]) try: self.data[key] = func() - except ResponseErrorNotSupportedException: - _LOGGER.info( - "%s not supported by device, excluding from future updates", key - ) - self.subscriptions.pop(key) except ResponseErrorLoginRequiredException: if isinstance(self.connection, AuthorizedConnection): _LOGGER.debug("Trying to authorize again") @@ -206,7 +201,13 @@ def _get_data(self, key: str, func: Callable[[], Any]) -> None: ) self.subscriptions.pop(key) except ResponseErrorException as exc: - if exc.code != -1: + if not isinstance( + exc, ResponseErrorNotSupportedException + ) and exc.code not in ( + # additional codes treated as unusupported + -1, + 100006, + ): raise _LOGGER.info( "%s apparently not supported by device, excluding from future updates",