mirror of
https://github.com/home-assistant/core.git
synced 2026-09-26 09:23:17 -04:00
Bump asyncsleepiq to 1.7.2 (#182224)
This commit is contained in:
@@ -7,6 +7,7 @@ from asyncsleepiq import (
|
||||
AsyncSleepIQ,
|
||||
SleepIQAPIException,
|
||||
SleepIQBed,
|
||||
SleepIQConnectionException,
|
||||
SleepIQLoginException,
|
||||
SleepIQTimeoutException,
|
||||
)
|
||||
@@ -76,6 +77,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: SleepIQConfigEntry) -> b
|
||||
|
||||
try:
|
||||
await gateway.login(email, password)
|
||||
except SleepIQConnectionException as err:
|
||||
raise ConfigEntryNotReady(
|
||||
str(err) or "Transient connection failure during authentication"
|
||||
) from err
|
||||
except SleepIQLoginException as err:
|
||||
_LOGGER.error("Could not authenticate with SleepIQ server")
|
||||
raise ConfigEntryAuthFailed(err) from err
|
||||
|
||||
@@ -4,7 +4,12 @@ from collections.abc import Mapping
|
||||
import logging
|
||||
from typing import Any, override
|
||||
|
||||
from asyncsleepiq import AsyncSleepIQ, SleepIQLoginException, SleepIQTimeoutException
|
||||
from asyncsleepiq import (
|
||||
AsyncSleepIQ,
|
||||
SleepIQConnectionException,
|
||||
SleepIQLoginException,
|
||||
SleepIQTimeoutException,
|
||||
)
|
||||
import probatio
|
||||
|
||||
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
|
||||
@@ -116,6 +121,8 @@ async def try_connection(hass: HomeAssistant, user_input: dict[str, Any]) -> str
|
||||
gateway = AsyncSleepIQ(client_session=client_session)
|
||||
try:
|
||||
await gateway.login(user_input[CONF_USERNAME], user_input[CONF_PASSWORD])
|
||||
except SleepIQConnectionException:
|
||||
return "cannot_connect"
|
||||
except SleepIQLoginException:
|
||||
return "invalid_auth"
|
||||
except SleepIQTimeoutException:
|
||||
|
||||
@@ -12,5 +12,5 @@
|
||||
"integration_type": "hub",
|
||||
"iot_class": "cloud_polling",
|
||||
"loggers": ["asyncsleepiq"],
|
||||
"requirements": ["asyncsleepiq==1.7.1"]
|
||||
"requirements": ["asyncsleepiq==1.7.2"]
|
||||
}
|
||||
|
||||
Generated
+1
-1
@@ -603,7 +603,7 @@ asyncinotify==4.4.4
|
||||
asyncpysupla==0.0.5
|
||||
|
||||
# homeassistant.components.sleepiq
|
||||
asyncsleepiq==1.7.1
|
||||
asyncsleepiq==1.7.2
|
||||
|
||||
# homeassistant.components.sftp_storage
|
||||
asyncssh==2.23.1
|
||||
|
||||
@@ -10,6 +10,7 @@ from asyncsleepiq import (
|
||||
SleepData,
|
||||
SleepIQAPIException,
|
||||
SleepIQBed,
|
||||
SleepIQConnectionException,
|
||||
SleepIQFoundation,
|
||||
SleepIQLoginException,
|
||||
SleepIQSleeper,
|
||||
@@ -82,6 +83,18 @@ async def test_entry_setup_timeout_error(
|
||||
assert not await hass.config_entries.async_setup(entry.entry_id)
|
||||
|
||||
|
||||
async def test_entry_setup_connection_error(
|
||||
hass: HomeAssistant, mock_asyncsleepiq: MagicMock
|
||||
) -> None:
|
||||
"""Test that a transient connection failure retries instead of triggering reauth."""
|
||||
mock_asyncsleepiq.login.side_effect = SleepIQConnectionException(
|
||||
"Connection failure: DNS resolution failed"
|
||||
)
|
||||
entry = await setup_platform(hass, None)
|
||||
assert not await hass.config_entries.async_setup(entry.entry_id)
|
||||
assert entry.state is ConfigEntryState.SETUP_RETRY
|
||||
|
||||
|
||||
async def test_update_interval(hass: HomeAssistant, mock_asyncsleepiq) -> None:
|
||||
"""Test update interval."""
|
||||
await setup_platform(hass, "sensor")
|
||||
|
||||
Reference in New Issue
Block a user