diff --git a/custom_components/programmable_thermostat/climate.py b/custom_components/programmable_thermostat/climate.py index 106934a..6daebae 100755 --- a/custom_components/programmable_thermostat/climate.py +++ b/custom_components/programmable_thermostat/climate.py @@ -273,7 +273,7 @@ async def _async_turn_on(self, mode=None): if not self._is_device_active_function(forced=False) and self.is_active_long_enough(mode=mode): self._set_hvac_action_on(mode=mode) await self.hass.services.async_call(HA_DOMAIN, SERVICE_TURN_ON, data) - await self.async_update_ha_state() + await self.async_write_ha_state() async def _async_turn_off(self, mode=None, forced=False): """Turn heater toggleable device off.""" @@ -293,7 +293,7 @@ async def _async_turn_off(self, mode=None, forced=False): if self._is_device_active_function(forced=forced) and self.is_active_long_enough(mode=mode): self._set_hvac_action_off(mode=mode) await self.hass.services.async_call(HA_DOMAIN, SERVICE_TURN_OFF, data) - await self.async_update_ha_state() + await self.async_write_ha_state() async def async_set_hvac_mode(self, hvac_mode): """Set hvac mode.""" @@ -320,7 +320,7 @@ async def async_set_temperature(self, **kwargs): return self._target_temp = float(temperature) await self.control_system_mode() - await self.async_update_ha_state() + await self.async_write_ha_state() async def _async_sensor_changed(self, event): """Handle temperature changes.""" @@ -329,7 +329,7 @@ async def _async_sensor_changed(self, event): return self._async_update_temp(new_state.state) await self.control_system_mode() - await self.async_update_ha_state() + await self.async_write_ha_state() async def _async_target_changed(self, event): """Handle temperature changes in the program.""" @@ -340,7 +340,7 @@ async def _async_target_changed(self, event): if self._hvac_mode == HVACMode.HEAT_COOL: self._async_restore_program_temp() await self.control_system_mode() - await self.async_update_ha_state() + await self.async_write_ha_state() async def _async_control_thermo(self, mode=None): """Check if we need to turn heating on or off.""" diff --git a/custom_components/programmable_thermostat/const.py b/custom_components/programmable_thermostat/const.py index c264679..81b6ac4 100644 --- a/custom_components/programmable_thermostat/const.py +++ b/custom_components/programmable_thermostat/const.py @@ -1,9 +1,5 @@ """Programmable thermostat's constant """ -from homeassistant.components.climate.const import ( - HVAC_MODE_COOL, - HVAC_MODE_HEAT, - HVAC_MODE_OFF, - HVAC_MODE_HEAT_COOL) +from homeassistant.components.climate import HVACMode #Generic VERSION = '8.3' @@ -25,8 +21,8 @@ #Others MAX_HVAC_OPTIONS = 8 AUTO_MODE_OPTIONS = ['all', 'heating', 'cooling'] -INITIAL_HVAC_MODE_OPTIONS = ['', HVAC_MODE_COOL, HVAC_MODE_HEAT, HVAC_MODE_OFF, HVAC_MODE_HEAT_COOL] -INITIAL_HVAC_MODE_OPTIONS_OPTFLOW = ['null', HVAC_MODE_COOL, HVAC_MODE_HEAT, HVAC_MODE_OFF, HVAC_MODE_HEAT_COOL] +INITIAL_HVAC_MODE_OPTIONS = ['', HVACMode.COOL, HVACMode.HEAT, HVACMode.OFF, HVACMode.HEAT_COOL] +INITIAL_HVAC_MODE_OPTIONS_OPTFLOW = ['null', HVACMode.COOL, HVACMode.HEAT, HVACMode.OFF, HVACMode.HEAT_COOL] REGEX_STRING = r'((?P\d+?):(?=(\d+?:\d+?)))?((?P\d+?):)?((?P\d+?))?$' #Attributes