7
7
from homeassistant .core import callback
8
8
from homeassistant .helpers import config_validation as cv
9
9
from pyhoma .client import TahomaClient
10
- from pyhoma .exceptions import BadCredentialsException , TooManyRequestsException
10
+ from pyhoma .exceptions import (
11
+ BadCredentialsException ,
12
+ MaintenanceException ,
13
+ TooManyRequestsException ,
14
+ )
11
15
import voluptuous as vol
12
16
13
17
from .const import CONF_UPDATE_INTERVAL , DEFAULT_UPDATE_INTERVAL , MIN_UPDATE_INTERVAL
@@ -57,6 +61,8 @@ async def async_step_user(self, user_input=None):
57
61
errors ["base" ] = "invalid_auth"
58
62
except (TimeoutError , ClientError ):
59
63
errors ["base" ] = "cannot_connect"
64
+ except MaintenanceException :
65
+ errors ["base" ] = "server_in_maintenance"
60
66
except Exception as exception : # pylint: disable=broad-except
61
67
errors ["base" ] = "unknown"
62
68
_LOGGER .exception (exception )
@@ -81,6 +87,9 @@ async def async_step_import(self, import_config: dict):
81
87
except (TimeoutError , ClientError ):
82
88
_LOGGER .error ("cannot_connect" )
83
89
return self .async_abort (reason = "cannot_connect" )
90
+ except MaintenanceException :
91
+ _LOGGER .error ("server_in_maintenance" )
92
+ return self .async_abort (reason = "server_in_maintenance" )
84
93
except Exception as exception : # pylint: disable=broad-except
85
94
_LOGGER .exception (exception )
86
95
return self .async_abort (reason = "unknown" )
0 commit comments