@@ -93,47 +93,45 @@ def __init__(
9393 self .smile_name = smile_name
9494 self .smile_type = smile_type
9595 self .smile_version = smile_version
96- self .therms_with_offset_func : list [str ] = []
9796 SmileData .__init__ (self )
9897
9998 async def full_xml_update (self ) -> None :
100- """Perform a first fetch of the Plugwise server XML data."""
99+ """Perform a first fetch of all XML data, needed for initialization ."""
101100 self ._domain_objects = await self .request (DOMAIN_OBJECTS )
102101 self ._get_plugwise_notifications ()
103102
104103 def get_all_gateway_entities (self ) -> None :
105- """Collect the Plugwise gateway entities and their data and states from the received raw XML-data.
104+ """Collect the gateway entities from the received raw XML-data.
106105
107- First, collect all the connected entities and their initial data.
108- If a thermostat-gateway, collect a list of thermostats with offset-capability.
109- Collect and add switching- and/or pump-group entities.
110- Finally, collect the data and states for each entity.
106+ Run this functions once to gather the initial configuration,
107+ then regularly run async_update() to refresh the entity data.
111108 """
109+ # Gather all the entities and their initial data
112110 self ._all_appliances ()
113111 if self ._is_thermostat :
112+ if self .smile (ADAM ):
113+ self ._scan_thermostats ()
114+ # Collect a list of thermostats with offset-capability
114115 self .therms_with_offset_func = (
115116 self ._get_appliances_with_offset_functionality ()
116117 )
117- if self .smile (ADAM ):
118- self ._scan_thermostats ()
119118
119+ # Collect and add switching- and/or pump-group devices
120120 if group_data := self ._get_group_switches ():
121121 self .gw_entities .update (group_data )
122122
123+ # Collect the remaining data for all entities
123124 self ._all_entity_data ()
124125
125126 async def async_update (self ) -> PlugwiseData :
126- """Perform an full update: re-collect all gateway entities and their data and states.
127-
128- Any change in the connected entities will be detected immediately.
129- """
127+ """Perform an incremental update for updating the various device states."""
130128 self .gw_data : GatewayData = {}
131129 self .gw_entities : dict [str , GwEntityData ] = {}
132130 self ._zones : dict [str , GwEntityData ] = {}
133131 try :
134132 await self .full_xml_update ()
135133 self .get_all_gateway_entities ()
136- # Set self._cooling_enabled - required for set_temperature() ,
134+ # Set self._cooling_enabled - required for set_temperature,
137135 # also, check for a failed data-retrieval
138136 if "heater_id" in self .gw_data :
139137 heat_cooler = self .gw_entities [self .gw_data ["heater_id" ]]
0 commit comments