@@ -97,43 +97,42 @@ def __init__(
9797 SmileData .__init__ (self )
9898
9999 async def full_xml_update (self ) -> None :
100- """Perform a first fetch of the Plugwise server XML data."""
100+ """Perform a first fetch of all XML data, needed for initialization ."""
101101 self ._domain_objects = await self .request (DOMAIN_OBJECTS )
102102 self ._get_plugwise_notifications ()
103103
104104 def get_all_gateway_entities (self ) -> None :
105- """Collect the Plugwise gateway entities and their data and states from the received raw XML-data.
105+ """Collect the gateway entities from the received raw XML-data.
106106
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.
107+ Run this functions once to gather the initial configuration,
108+ then regularly run async_update() to refresh the entity data.
111109 """
110+ # Gather all the entities and their initial data
112111 self ._all_appliances ()
113112 if self ._is_thermostat :
113+ if self .smile (ADAM ):
114+ self ._scan_thermostats ()
115+ # Collect a list of thermostats with offset-capability
114116 self .therms_with_offset_func = (
115117 self ._get_appliances_with_offset_functionality ()
116118 )
117- if self .smile (ADAM ):
118- self ._scan_thermostats ()
119119
120+ # Collect and add switching- and/or pump-group devices
120121 if group_data := self ._get_group_switches ():
121122 self .gw_entities .update (group_data )
122123
124+ # Collect the remaining data for all entities
123125 self ._all_entity_data ()
124126
125127 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- """
128+ """Perform an incremental update for updating the various device states."""
130129 self .gw_data : GatewayData = {}
131130 self .gw_entities : dict [str , GwEntityData ] = {}
132131 self ._zones : dict [str , GwEntityData ] = {}
133132 try :
134133 await self .full_xml_update ()
135134 self .get_all_gateway_entities ()
136- # Set self._cooling_enabled - required for set_temperature() ,
135+ # Set self._cooling_enabled - required for set_temperature,
137136 # also, check for a failed data-retrieval
138137 if "heater_id" in self .gw_data :
139138 heat_cooler = self .gw_entities [self .gw_data ["heater_id" ]]
0 commit comments