From 089d0f1d7f3912d3b8916ab6e07fc7bd79e953b6 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sun, 17 May 2026 21:43:04 +0000 Subject: [PATCH 1/2] Fix WeatherFlow websocket crash when data payload is None --- homeassistant/components/weatherflow_cloud/coordinator.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/homeassistant/components/weatherflow_cloud/coordinator.py b/homeassistant/components/weatherflow_cloud/coordinator.py index 1b200f439b1e86..1976c466ac9830 100644 --- a/homeassistant/components/weatherflow_cloud/coordinator.py +++ b/homeassistant/components/weatherflow_cloud/coordinator.py @@ -185,6 +185,8 @@ def _create_listen_message(self, device_id: int) -> RapidWindListenStartMessage: async def _handle_websocket_message(self, data: RapidWindWS) -> None: """Handle rapid wind websocket data.""" + if data is None: + return device_id = data.device_id station_id = self.device_to_station_map[device_id] @@ -204,6 +206,8 @@ def _create_listen_message(self, device_id: int) -> ListenStartMessage: async def _handle_websocket_message(self, data: ObservationTempestWS) -> None: """Handle observation websocket data.""" + if data is None: + return device_id = data.device_id station_id = self.device_to_station_map[device_id] From d6709b02517699ec81a55dc425335f29345861cd Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sun, 17 May 2026 21:51:11 +0000 Subject: [PATCH 2/2] Update type annotations to accept None data payload --- homeassistant/components/weatherflow_cloud/coordinator.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/weatherflow_cloud/coordinator.py b/homeassistant/components/weatherflow_cloud/coordinator.py index 1976c466ac9830..c1ccece20feb13 100644 --- a/homeassistant/components/weatherflow_cloud/coordinator.py +++ b/homeassistant/components/weatherflow_cloud/coordinator.py @@ -183,7 +183,7 @@ def _create_listen_message(self, device_id: int) -> RapidWindListenStartMessage: """Create rapid wind listen message.""" return RapidWindListenStartMessage(device_id=str(device_id)) - async def _handle_websocket_message(self, data: RapidWindWS) -> None: + async def _handle_websocket_message(self, data: RapidWindWS | None) -> None: """Handle rapid wind websocket data.""" if data is None: return @@ -204,7 +204,9 @@ def _create_listen_message(self, device_id: int) -> ListenStartMessage: """Create observation listen message.""" return ListenStartMessage(device_id=str(device_id)) - async def _handle_websocket_message(self, data: ObservationTempestWS) -> None: + async def _handle_websocket_message( + self, data: ObservationTempestWS | None + ) -> None: """Handle observation websocket data.""" if data is None: return