From c5239c6176d7a8acf1eeeb29026baea944624ac2 Mon Sep 17 00:00:00 2001 From: William Sutton Date: Tue, 9 Jul 2019 15:18:05 -0400 Subject: [PATCH] Add radiotherm CT80 current humidity support (#25024) * Added CT80 Current Humidity Support Added a check for if device is a CT80, and if so, queries the humidity object to get the current measured humidity reading. * Update climate.py Removed whitespace on line 229 * Update climate.py Added humidity property. Version on local machine had that from previous tinkering. * Update climate.py Removed whitespace * Update climate.py Fixed tstat error handling for humidity data. --- homeassistant/components/radiotherm/climate.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/homeassistant/components/radiotherm/climate.py b/homeassistant/components/radiotherm/climate.py index f5627ea1779..e1feb6f4024 100644 --- a/homeassistant/components/radiotherm/climate.py +++ b/homeassistant/components/radiotherm/climate.py @@ -102,6 +102,7 @@ class RadioThermostat(ClimateDevice): self.device = device self._target_temperature = None self._current_temperature = None + self._current_humidity = None self._current_operation = HVAC_MODE_OFF self._name = None self._fmode = None @@ -176,6 +177,11 @@ class RadioThermostat(ClimateDevice): """Return the current temperature.""" return self._current_temperature + @property + def current_humidity(self): + """Return the current temperature.""" + return self._current_humidity + @property def hvac_mode(self): """Return the current operation. head, cool idle.""" @@ -216,6 +222,16 @@ class RadioThermostat(ClimateDevice): current_temp = data['temp'] + if self._is_model_ct80: + try: + humiditydata = self.device.tstat.humidity['raw'] + except radiotherm.validate.RadiothermTstatError: + _LOGGER.warning('%s (%s) was busy (invalid value returned)', + self._name, self.device.host) + return + current_humidity = humiditydata['humidity'] + self._current_humidity = current_humidity + # Map thermostat values into various STATE_ flags. self._current_temperature = current_temp self._fmode = CODE_TO_FAN_MODE[data['fmode']]