Add permanent_hold attribute to Honeywell climate (#45341)

This commit is contained in:
Charles Garwood 2021-01-20 08:34:14 -05:00 committed by GitHub
parent c03b4d8aee
commit d284c6369e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,6 +53,8 @@ CONF_LOC_ID = "location"
DEFAULT_COOL_AWAY_TEMPERATURE = 88
DEFAULT_HEAT_AWAY_TEMPERATURE = 61
ATTR_PERMANENT_HOLD = "permanent_hold"
PLATFORM_SCHEMA = vol.All(
cv.deprecated(CONF_REGION),
PLATFORM_SCHEMA.extend(
@ -199,6 +201,7 @@ class HoneywellUSThermostat(ClimateEntity):
"""Return the device specific state attributes."""
data = {}
data[ATTR_FAN_ACTION] = "running" if self._device.fan_running else "idle"
data[ATTR_PERMANENT_HOLD] = self._is_permanent_hold()
if self._device.raw_dr_data:
data["dr_phase"] = self._device.raw_dr_data.get("Phase")
return data
@ -306,6 +309,11 @@ class HoneywellUSThermostat(ClimateEntity):
"""Return the list of available fan modes."""
return list(self._fan_mode_map)
def _is_permanent_hold(self) -> bool:
heat_status = self._device.raw_ui_data.get("StatusHeat", 0)
cool_status = self._device.raw_ui_data.get("StatusCool", 0)
return heat_status == 2 or cool_status == 2
def _set_temperature(self, **kwargs) -> None:
"""Set new target temperature."""
temperature = kwargs.get(ATTR_TEMPERATURE)