From 3fc34244acd8ccc2609c1153c34c30e387bedbb5 Mon Sep 17 00:00:00 2001 From: Mick Vleeshouwer Date: Sun, 27 Apr 2025 20:42:51 +0200 Subject: [PATCH] Fix hvac_mode property to handle missing CORE_ON_OFF state in Atlantic Electrical Heater in Overkiz (#143330) --- .../overkiz/climate/atlantic_electrical_heater.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/overkiz/climate/atlantic_electrical_heater.py b/homeassistant/components/overkiz/climate/atlantic_electrical_heater.py index 059e64ef55d..4a05a94b635 100644 --- a/homeassistant/components/overkiz/climate/atlantic_electrical_heater.py +++ b/homeassistant/components/overkiz/climate/atlantic_electrical_heater.py @@ -58,9 +58,12 @@ class AtlanticElectricalHeater(OverkizEntity, ClimateEntity): @property def hvac_mode(self) -> HVACMode: """Return hvac operation ie. heat, cool mode.""" - return OVERKIZ_TO_HVAC_MODES[ - cast(str, self.executor.select_state(OverkizState.CORE_ON_OFF)) - ] + if OverkizState.CORE_ON_OFF in self.device.states: + return OVERKIZ_TO_HVAC_MODES[ + cast(str, self.executor.select_state(OverkizState.CORE_ON_OFF)) + ] + + return HVACMode.OFF async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None: """Set new target hvac mode."""