Bump asyncsleepiq to 1.7.2 (#182224)

This commit is contained in:
derekcentrico
2026-09-14 21:42:17 +02:00
committed by GitHub
parent 15b89b53a3
commit 4531ed5634
5 changed files with 28 additions and 3 deletions
@@ -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"]
}
+1 -1
View File
@@ -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
+13
View File
@@ -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")