Improve climate turn_on service (#94645)

pull/95408/head
Franck Nijhof 2023-06-27 20:17:13 +02:00 committed by GitHub
parent bbae2061e7
commit d7b7deb95f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -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: