@@ -129,7 +129,6 @@ def _update_for_cooling(self, entity: GwEntityData) -> None:
129129 and entity ["dev_class" ] == "thermostat"
130130 ):
131131 thermostat = entity ["thermostat" ]
132- sensors = entity ["sensors" ]
133132 temp_dict : ActuatorData = {
134133 "setpoint_low" : thermostat ["setpoint" ],
135134 "setpoint_high" : MAX_SETPOINT ,
@@ -139,15 +138,19 @@ def _update_for_cooling(self, entity: GwEntityData) -> None:
139138 "setpoint_low" : MIN_SETPOINT ,
140139 "setpoint_high" : thermostat ["setpoint" ],
141140 }
142- thermostat .pop ("setpoint" )
141+ thermostat .pop ("setpoint" ) # Add 2 keys, remove 1
143142 temp_dict .update (thermostat )
144143 entity ["thermostat" ] = temp_dict
144+
145+ sensors = entity ["sensors" ]
146+ sensors ["setpoint_low" ] = temp_dict ["setpoint_low" ]
147+ sensors ["setpoint_high" ] = temp_dict ["setpoint_high" ]
148+ # Add 2 more keys, remove 1 when required
145149 if "setpoint" in sensors :
146150 sensors .pop ("setpoint" )
147151 self ._count -= 1
148- sensors ["setpoint_low" ] = temp_dict ["setpoint_low" ]
149- sensors ["setpoint_high" ] = temp_dict ["setpoint_high" ]
150- self ._count += 3 # add 4, remove 1
152+
153+ self ._count += 3 # add 4 total, remove 1, count the conditional remove separately
151154
152155 def _get_location_data (self , loc_id : str ) -> GwEntityData :
153156 """Helper-function for _all_entity_data() and async_update().
0 commit comments