Elmax -Handle 422 busy error with a retry approach (#91926)

This commit is contained in:
Alberto Geniola 2023-04-24 18:51:40 +02:00 committed by GitHub
parent e2d2aeadaa
commit f104bba683
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 3 deletions

View file

@ -11,6 +11,7 @@ from elmax_api.exceptions import (
ElmaxBadLoginError, ElmaxBadLoginError,
ElmaxBadPinError, ElmaxBadPinError,
ElmaxNetworkError, ElmaxNetworkError,
ElmaxPanelBusyError,
) )
from elmax_api.http import Elmax from elmax_api.http import Elmax
from elmax_api.model.actuator import Actuator from elmax_api.model.actuator import Actuator
@ -124,6 +125,10 @@ class ElmaxCoordinator(DataUpdateCoordinator[PanelStatus]):
raise ConfigEntryAuthFailed("Refused username/password") from err raise ConfigEntryAuthFailed("Refused username/password") from err
except ElmaxApiError as err: except ElmaxApiError as err:
raise UpdateFailed(f"Error communicating with ELMAX API: {err}") from err raise UpdateFailed(f"Error communicating with ELMAX API: {err}") from err
except ElmaxPanelBusyError as err:
raise UpdateFailed(
"Communication with the panel failed, as it is currently busy"
) from err
except ElmaxNetworkError as err: except ElmaxNetworkError as err:
raise UpdateFailed( raise UpdateFailed(
"A network error occurred while communicating with Elmax cloud." "A network error occurred while communicating with Elmax cloud."

View file

@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/elmax", "documentation": "https://www.home-assistant.io/integrations/elmax",
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"loggers": ["elmax_api"], "loggers": ["elmax_api"],
"requirements": ["elmax_api==0.0.2"] "requirements": ["elmax_api==0.0.4"]
} }

View file

@ -647,7 +647,7 @@ eliqonline==1.2.2
elkm1-lib==2.2.1 elkm1-lib==2.2.1
# homeassistant.components.elmax # homeassistant.components.elmax
elmax_api==0.0.2 elmax_api==0.0.4
# homeassistant.components.emulated_roku # homeassistant.components.emulated_roku
emulated_roku==0.2.1 emulated_roku==0.2.1

View file

@ -509,7 +509,7 @@ elgato==4.0.1
elkm1-lib==2.2.1 elkm1-lib==2.2.1
# homeassistant.components.elmax # homeassistant.components.elmax
elmax_api==0.0.2 elmax_api==0.0.4
# homeassistant.components.emulated_roku # homeassistant.components.emulated_roku
emulated_roku==0.2.1 emulated_roku==0.2.1