From d7b7deb95f1c8a41d2314338d622ae2c2c534e82 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 27 Jun 2023 20:17:13 +0200 Subject: [PATCH] Improve climate turn_on service (#94645) --- homeassistant/components/climate/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/homeassistant/components/climate/__init__.py b/homeassistant/components/climate/__init__.py index c5bc22ebc0c..e62cb1143b5 100644 --- a/homeassistant/components/climate/__init__.py +++ b/homeassistant/components/climate/__init__.py @@ -534,6 +534,14 @@ class ClimateEntity(Entity): await self.hass.async_add_executor_job(self.turn_on) return + # If there are only two HVAC modes, and one of those modes is OFF, + # then we can just turn on the other mode. + if len(self.hvac_modes) == 2 and HVACMode.OFF in self.hvac_modes: + for mode in self.hvac_modes: + if mode != HVACMode.OFF: + await self.async_set_hvac_mode(mode) + return + # Fake turn on for mode in (HVACMode.HEAT_COOL, HVACMode.HEAT, HVACMode.COOL): if mode not in self.hvac_modes: