Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
de1799d4
Commit
de1799d4
authored
5 years ago
by
Florent Thoumie
Committed by
Fabian Affolter
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
iaqualink: better handling of failures (#28514)
parent
60d7f730
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
homeassistant/components/iaqualink/__init__.py
+18
-1
18 additions, 1 deletion
homeassistant/components/iaqualink/__init__.py
with
18 additions
and
1 deletion
homeassistant/components/iaqualink/__init__.py
+
18
−
1
View file @
de1799d4
...
@@ -4,6 +4,7 @@ from functools import wraps
...
@@ -4,6 +4,7 @@ from functools import wraps
import
logging
import
logging
from
typing
import
Any
,
Dict
from
typing
import
Any
,
Dict
import
aiohttp.client_exceptions
import
voluptuous
as
vol
import
voluptuous
as
vol
from
iaqualink
import
(
from
iaqualink
import
(
...
@@ -26,6 +27,7 @@ from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
...
@@ -26,6 +27,7 @@ from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from
homeassistant.config_entries
import
ConfigEntry
from
homeassistant.config_entries
import
ConfigEntry
from
homeassistant.const
import
CONF_PASSWORD
,
CONF_USERNAME
from
homeassistant.const
import
CONF_PASSWORD
,
CONF_USERNAME
from
homeassistant.core
import
callback
from
homeassistant.core
import
callback
from
homeassistant.exceptions
import
ConfigEntryNotReady
from
homeassistant.helpers.aiohttp_client
import
async_get_clientsession
from
homeassistant.helpers.aiohttp_client
import
async_get_clientsession
from
homeassistant.helpers.dispatcher
import
(
from
homeassistant.helpers.dispatcher
import
(
async_dispatcher_connect
,
async_dispatcher_connect
,
...
@@ -90,8 +92,14 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> None
...
@@ -90,8 +92,14 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> None
try
:
try
:
await
aqualink
.
login
()
await
aqualink
.
login
()
except
AqualinkLoginException
as
login_exception
:
except
AqualinkLoginException
as
login_exception
:
_LOGGER
.
error
(
"
Exception r
ai
s
ed
while attempting
to login: %s
"
,
login_exception
)
_LOGGER
.
error
(
"
F
ai
l
ed to login: %s
"
,
login_exception
)
return
False
return
False
except
(
asyncio
.
TimeoutError
,
aiohttp
.
client_exceptions
.
ClientConnectorError
,
)
as
aio_exception
:
_LOGGER
.
warning
(
"
Exception raised while attempting to login: %s
"
,
aio_exception
)
raise
ConfigEntryNotReady
systems
=
await
aqualink
.
get_systems
()
systems
=
await
aqualink
.
get_systems
()
systems
=
list
(
systems
.
values
())
systems
=
list
(
systems
.
values
())
...
@@ -133,7 +141,16 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> None
...
@@ -133,7 +141,16 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> None
async
def
_async_systems_update
(
now
):
async
def
_async_systems_update
(
now
):
"""
Refresh internal state for all systems.
"""
"""
Refresh internal state for all systems.
"""
prev
=
systems
[
0
].
last_run_success
await
systems
[
0
].
update
()
await
systems
[
0
].
update
()
success
=
systems
[
0
].
last_run_success
if
not
success
and
prev
:
_LOGGER
.
warning
(
"
Failed to refresh iAqualink state
"
)
elif
success
and
not
prev
:
_LOGGER
.
warning
(
"
Reconnected to iAqualink
"
)
async_dispatcher_send
(
hass
,
DOMAIN
)
async_dispatcher_send
(
hass
,
DOMAIN
)
async_track_time_interval
(
hass
,
_async_systems_update
,
UPDATE_INTERVAL
)
async_track_time_interval
(
hass
,
_async_systems_update
,
UPDATE_INTERVAL
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment