Fix Lyric cool mode (#54856)

* fixing Cool mode in lyric

* Use climate integration constants

I believe this fixes this issue: https://github.com/home-assistant/core/pull/51760#discussion_r650372737

* Run through black

* Delint

Co-authored-by: Yadu Raghu <yraghu55@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
muchtall 2021-08-20 05:50:28 -05:00 committed by GitHub
parent e5f914bbdb
commit 2ac0aea765
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -190,6 +190,8 @@ class LyricClimate(LyricDeviceEntity, ClimateEntity):
"""Return the temperature we try to reach."""
device = self.device
if not device.hasDualSetpointStatus:
if self.hvac_mode == HVAC_MODE_COOL:
return device.changeableValues.coolSetpoint
return device.changeableValues.heatSetpoint
return None
@ -266,7 +268,14 @@ class LyricClimate(LyricDeviceEntity, ClimateEntity):
temp = kwargs.get(ATTR_TEMPERATURE)
_LOGGER.debug("Set temperature: %s", temp)
try:
await self._update_thermostat(self.location, device, heatSetpoint=temp)
if self.hvac_mode == HVAC_MODE_COOL:
await self._update_thermostat(
self.location, device, coolSetpoint=temp
)
else:
await self._update_thermostat(
self.location, device, heatSetpoint=temp
)
except LYRIC_EXCEPTIONS as exception:
_LOGGER.error(exception)
await self.coordinator.async_refresh()