Fix Lyric HVAC mode reset on temperature change (#104910)

* Fix Lyric HVAC mode reset on temperature change

* Reduce code duplication

* Revert additional bugfix

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>

---------

Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
This commit is contained in:
Alex Thompson 2023-12-03 16:13:26 -05:00 committed by GitHub
parent 833805f9be
commit 23cd66c54b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -324,6 +324,15 @@ class LyricClimate(LyricDeviceEntity, ClimateEntity):
"Could not find target_temp_low and/or target_temp_high in"
" arguments"
)
# If the device supports "Auto" mode, don't pass the mode when setting the
# temperature
mode = (
None
if device.changeableValues.mode == LYRIC_HVAC_MODE_HEAT_COOL
else HVAC_MODES[device.changeableValues.heatCoolMode]
)
_LOGGER.debug("Set temperature: %s - %s", target_temp_low, target_temp_high)
try:
await self._update_thermostat(
@ -331,7 +340,7 @@ class LyricClimate(LyricDeviceEntity, ClimateEntity):
device,
coolSetpoint=target_temp_high,
heatSetpoint=target_temp_low,
mode=HVAC_MODES[device.changeableValues.heatCoolMode],
mode=mode,
)
except LYRIC_EXCEPTIONS as exception:
_LOGGER.error(exception)