From dc90b263573610efe70c61ebbd513e85334e9e6c Mon Sep 17 00:00:00 2001 From: Jens Ihnow Date: Tue, 21 Apr 2026 16:09:24 +0200 Subject: [PATCH] fan: fetch initial preset_mode from bridge on startup The fan entity and the ventilation mode select both register for SENSOR_OPERATING_MODE. The bridge only pushes the current value on first registration, so whichever entity registers second never receives the initial value and preset_mode stays null until the mode changes. Fetching the mode explicitly in async_added_to_hass ensures preset_mode is populated immediately on startup, regardless of registration order. This also prevents the resulting WebSocket error where the tile card reflects the null state and HA rejects it as an invalid preset mode. --- custom_components/comfoconnect/fan.py | 1 + 1 file changed, 1 insertion(+) diff --git a/custom_components/comfoconnect/fan.py b/custom_components/comfoconnect/fan.py index c000fcd..71c6958 100644 --- a/custom_components/comfoconnect/fan.py +++ b/custom_components/comfoconnect/fan.py @@ -90,6 +90,7 @@ async def async_added_to_hass(self) -> None: ) ) await self._ccb.register_sensor(SENSORS.get(SENSOR_OPERATING_MODE)) + self._attr_preset_mode = await self._ccb.get_mode() def _handle_speed_update(self, value: int) -> None: """Handle update callbacks."""