From 2ac0aea765906d7e538df0a47b4bbc783849e8fe Mon Sep 17 00:00:00 2001
From: muchtall <github@john.holmstadt.com>
Date: Fri, 20 Aug 2021 05:50:28 -0500
Subject: [PATCH] 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>
---
 homeassistant/components/lyric/climate.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/homeassistant/components/lyric/climate.py b/homeassistant/components/lyric/climate.py
index a13f0381499..955afe140c9 100644
--- a/homeassistant/components/lyric/climate.py
+++ b/homeassistant/components/lyric/climate.py
@@ -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()
-- 
GitLab