Skip to content

Commit

Permalink
Fix Lyric HVAC mode reset on temperature change
Browse files Browse the repository at this point in the history
  • Loading branch information
apt-itude committed Dec 2, 2023
1 parent 7767bb3 commit d29ae2b
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion homeassistant/components/lyric/climate.py
Expand Up @@ -318,7 +318,28 @@ async def async_set_temperature(self, **kwargs: Any) -> None:
target_temp_low = kwargs.get(ATTR_TARGET_TEMP_LOW)
target_temp_high = kwargs.get(ATTR_TARGET_TEMP_HIGH)

if device.changeableValues.autoChangeoverActive:
if device.changeableValues.mode == LYRIC_HVAC_MODE_HEAT_COOL:
# If the device supports "Auto" mode, don't pass the mode when setting the
# temperature
if target_temp_low is None or target_temp_high is None:
raise HomeAssistantError(
"Could not find target_temp_low and/or target_temp_high in"
" arguments"
)
_LOGGER.debug("Set temperature: %s - %s", target_temp_low, target_temp_high)
try:
await self._update_thermostat(
self.location,
device,
coolSetpoint=target_temp_high,
heatSetpoint=target_temp_low,
)
except LYRIC_EXCEPTIONS as exception:
_LOGGER.error(exception)
await self.coordinator.async_refresh()
elif device.changeableValues.autoChangeoverActive:
# If the device uses "autoChangeoverActive", pass the "heatCoolMode" as the
# mode
if target_temp_low is None or target_temp_high is None:
raise HomeAssistantError(
"Could not find target_temp_low and/or target_temp_high in"
Expand Down

0 comments on commit d29ae2b

Please sign in to comment.