From 8cb101ae85a220c68551ff13772bbddcfddfdf72 Mon Sep 17 00:00:00 2001 From: Ronald van der Meer Date: Tue, 30 Jun 2026 15:47:06 +0200 Subject: [PATCH] Fix Duco state end time being rounded by the integration (#175124) --- homeassistant/components/duco/sensor.py | 4 +--- tests/components/duco/test_sensor.py | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/duco/sensor.py b/homeassistant/components/duco/sensor.py index f4c00f14d181..faad3737c271 100644 --- a/homeassistant/components/duco/sensor.py +++ b/homeassistant/components/duco/sensor.py @@ -83,9 +83,7 @@ SENSOR_DESCRIPTIONS: tuple[DucoSensorEntityDescription, ...] = ( translation_key="time_state_end", device_class=SensorDeviceClass.TIMESTAMP, value_fn=lambda node: ( - dt_util.utc_from_timestamp(node.ventilation.time_state_end).replace( - second=0, microsecond=0 - ) + dt_util.utc_from_timestamp(node.ventilation.time_state_end) if node.ventilation and node.ventilation.time_state_end != 0 else None ), diff --git a/tests/components/duco/test_sensor.py b/tests/components/duco/test_sensor.py index 7def3b9e517d..563ab57fb6b7 100644 --- a/tests/components/duco/test_sensor.py +++ b/tests/components/duco/test_sensor.py @@ -59,7 +59,7 @@ async def test_ventilation_related_sensors_created_for_supported_node_types( ventilation=replace( mock_sensor_nodes[0].ventilation, flow_lvl_tgt=42, - time_state_end=1700000400, + time_state_end=1700000459, ), ) mock_duco_client.async_get_nodes.return_value = [ @@ -79,7 +79,7 @@ async def test_ventilation_related_sensors_created_for_supported_node_types( state = hass.states.get("sensor.living_state_end_time") assert state is not None - assert state.state == "2023-11-14T22:20:00+00:00" + assert state.state == "2023-11-14T22:20:59+00:00" assert hass.states.get("sensor.office_co2_ventilation_state") is None assert hass.states.get("sensor.office_co2_target_flow_level") is None