@@ -77,7 +77,7 @@ async def _create_session() -> aiohttp.ClientSession:
7777 self .gw_devices = {}
7878
7979 async def connect (self ):
80- """Connect to Plugwise device."""
80+ """Connect to Plugwise device and determine its name, type and version ."""
8181 names = []
8282
8383 result = await self .request (DOMAIN_OBJECTS )
@@ -105,6 +105,7 @@ async def connect(self):
105105 return True
106106
107107 async def smile_detect_legacy (self , result , dsmrmain ):
108+ """Helper-function for smile_detect()."""
108109 network = result .find (".//module/protocols/network_router/network" )
109110
110111 # Assume legacy
@@ -145,7 +146,9 @@ async def smile_detect_legacy(self, result, dsmrmain):
145146 return model , version
146147
147148 async def smile_detect (self , result , dsmrmain ):
148- """Detect which type of Smile is connected."""
149+ """Helper-function for connect().
150+ Detect which type of Smile is connected.
151+ """
149152 model = None
150153 gateway = result .find (".//gateway" )
151154
@@ -192,7 +195,7 @@ async def close_connection(self):
192195 await self .websession .close ()
193196
194197 async def full_update_device (self ):
195- """Update all XML data from device ."""
198+ """Perform a first fetch of all XML data, needed for initialization ."""
196199 await self .update_domain_objects ()
197200 self ._locations = await self .request (LOCATIONS )
198201
@@ -205,7 +208,7 @@ async def full_update_device(self):
205208 self ._modules = await self .request (MODULES )
206209
207210 async def update_gw_devices (self ):
208- """Update all XML data from device ."""
211+ """Perform an incremental update for updating the various states ."""
209212 await self .update_domain_objects ()
210213
211214 # P1 legacy has no appliances
@@ -230,7 +233,9 @@ async def update_gw_devices(self):
230233 self .update_helper (data , dev_dict , dev_id , "switches" , key )
231234
232235 def all_device_data (self ):
233- "Helper-function: collect data for each device and add to self.gw_devices."
236+ """Helper-function for get_all_devices().
237+ Collect data for each device and add to self.gw_devices.
238+ """
234239 dev_id_list = []
235240 dev_and_data_list = []
236241 for dev_id , dev_dict in self .devices .items ():
@@ -256,7 +261,7 @@ def all_device_data(self):
256261 self .gw_devices = dict (zip (dev_id_list , dev_and_data_list ))
257262
258263 def get_all_devices (self ):
259- """Determine available devices from inventory ."""
264+ """Determine the devices present from the obtained XML-data ."""
260265 self .devices = {}
261266 self .scan_thermostats ()
262267
@@ -281,7 +286,9 @@ def get_all_devices(self):
281286 self .all_device_data ()
282287
283288 def device_data_switching_group (self , details , device_data ):
284- """Determine switching groups device data."""
289+ """Helper-function for get_device_data().
290+ Determine switching group device data.
291+ """
285292 if details ["class" ] in SWITCH_GROUP_TYPES :
286293 counter = 0
287294 for member in details ["members" ]:
@@ -296,7 +303,9 @@ def device_data_switching_group(self, details, device_data):
296303 return device_data
297304
298305 def device_data_anna (self , dev_id , details , device_data ):
299- """Determine anna and legacy_anna device data."""
306+ """Helper-function for get_device_data().
307+ Determine Anna and legacy Anna device data.
308+ """
300309 # Legacy_anna: create Auxiliary heating_state and leave out domestic_hot_water_state
301310 if "boiler_state" in device_data :
302311 device_data ["heating_state" ] = device_data ["intended_boiler_state" ]
@@ -311,7 +320,9 @@ def device_data_anna(self, dev_id, details, device_data):
311320 return device_data
312321
313322 def device_data_adam (self , details , device_data ):
314- """Determine Adam device data."""
323+ """Helper-function for get_device_data().
324+ Determine Adam device data.
325+ """
315326 # Adam: indicate heating_state based on valves being open in case of city-provided heating
316327 if self .smile_name == "Adam" :
317328 if details ["class" ] == "gateway" :
@@ -323,8 +334,9 @@ def device_data_adam(self, details, device_data):
323334 return device_data
324335
325336 def device_data_climate (self , details , device_data ):
326- """Determine climate-control device data."""
327- # Anna, Lisa, Tom/Floor
337+ """Helper-function for get_device_data().
338+ Determine climate-control device data.
339+ """
328340 device_data ["active_preset" ] = self .preset (details ["location" ])
329341 device_data ["presets" ] = self .presets (details ["location" ])
330342
0 commit comments