mirror of
https://github.com/home-assistant/core.git
synced 2026-09-08 06:31:35 +01:00
Keep Duco filter time pollable after missing result (#180985)
This commit is contained in:
@@ -51,7 +51,6 @@ class DucoCoordinator(DataUpdateCoordinator[DucoData]):
|
||||
|
||||
config_entry: DucoConfigEntry
|
||||
board_info: BoardInfo
|
||||
_supports_time_filter_remain: bool
|
||||
_configured_node_names: dict[int, str]
|
||||
|
||||
def __init__(
|
||||
@@ -70,7 +69,6 @@ class DucoCoordinator(DataUpdateCoordinator[DucoData]):
|
||||
)
|
||||
self.client = client
|
||||
self._configured_node_names = {}
|
||||
self._supports_time_filter_remain = True
|
||||
|
||||
async def _async_load_node_names(self) -> None:
|
||||
"""Load configured Duco node names during setup."""
|
||||
@@ -178,12 +176,11 @@ class DucoCoordinator(DataUpdateCoordinator[DucoData]):
|
||||
|
||||
# Heat recovery info only backs the optional filter timer sensor, so
|
||||
# failures on this supplemental endpoint should not make the primary
|
||||
# node entities unavailable.
|
||||
# node entities unavailable. A None result leaves the sensor absent
|
||||
# but keeps the helper pollable so data can appear on a later refresh.
|
||||
time_filter_remain = None
|
||||
if self._supports_time_filter_remain:
|
||||
with suppress(DucoError):
|
||||
time_filter_remain = await self.client.async_get_time_filter_remaining()
|
||||
self._supports_time_filter_remain = time_filter_remain is not None
|
||||
with suppress(DucoError):
|
||||
time_filter_remain = await self.client.async_get_time_filter_remaining()
|
||||
|
||||
ventilation_temperatures = (
|
||||
self.data.ventilation_temperatures if self.data else None
|
||||
|
||||
@@ -251,14 +251,14 @@ async def test_lan_info_failures_keep_node_entities_available(
|
||||
assert state.state == "-60"
|
||||
|
||||
|
||||
async def test_time_filter_remaining_missing_skips_sensor_creation(
|
||||
async def test_time_filter_remaining_missing_is_retried(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
mock_duco_client: AsyncMock,
|
||||
mock_sensor_nodes: list[Node],
|
||||
freezer: FrozenDateTimeFactory,
|
||||
) -> None:
|
||||
"""Test the filter timer sensor is not created when unsupported."""
|
||||
"""Test a missing filter timer does not create the sensor but is retried."""
|
||||
mock_duco_client.async_get_nodes.return_value = mock_sensor_nodes
|
||||
|
||||
mock_duco_client.async_get_time_filter_remaining = AsyncMock(
|
||||
@@ -273,7 +273,10 @@ async def test_time_filter_remaining_missing_skips_sensor_creation(
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
assert hass.states.get(FILTER_REMAINING_ENTITY_ID) is None
|
||||
assert mock_duco_client.async_get_time_filter_remaining.await_count == 2
|
||||
state = hass.states.get(FILTER_REMAINING_ENTITY_ID)
|
||||
assert state is not None
|
||||
assert state.state == "180"
|
||||
|
||||
|
||||
async def test_empty_ventilation_temperatures_are_retried(
|
||||
|
||||
Reference in New Issue
Block a user