diff --git a/custom_components/programmable_thermostat/climate.py b/custom_components/programmable_thermostat/climate.py index 5b1e2ba..77b7604 100755 --- a/custom_components/programmable_thermostat/climate.py +++ b/custom_components/programmable_thermostat/climate.py @@ -38,7 +38,10 @@ from .const import ( VERSION, DOMAIN, - PLATFORM + PLATFORM, + ATTR_HEATER_IDS, + ATTR_COOLER_IDS, + ATTR_SENSOR_ID ) from .config_schema import( CLIMATE_SCHEMA, @@ -614,3 +617,14 @@ def hvac_action(self): Need to be one of CURRENT_HVAC_*. """ return self._hvac_action + + @property + def extra_state_attributes(self): + """Return entity specific state attributes to be saved. """ + attributes = {} + + attributes[ATTR_HEATER_IDS] = self.heaters_entity_ids + attributes[ATTR_COOLER_IDS] = self.coolers_entity_ids + attributes[ATTR_SENSOR_ID] = self.sensor_entity_id + + return attributes diff --git a/custom_components/programmable_thermostat/const.py b/custom_components/programmable_thermostat/const.py index c7383a4..2342d49 100644 --- a/custom_components/programmable_thermostat/const.py +++ b/custom_components/programmable_thermostat/const.py @@ -28,3 +28,8 @@ 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] REGEX_STRING = r'((?P\d+?):(?=(\d+?:\d+?)))?((?P\d+?):)?((?P\d+?))?$' + +#Attributes +ATTR_HEATER_IDS = "heater_ids" +ATTR_COOLER_IDS = "cooler_ids" +ATTR_SENSOR_ID = "sensor_id"