@@ -306,24 +306,16 @@ def _appliance_info_finder(self, appl: Munch, appliance: etree) -> Munch:
306306 appl .name = self .smile_name
307307 appl .vendor_name = "Plugwise"
308308
309- # Adam: look for the ZigBee MAC address of the Smile
309+ # Adam: collect the ZigBee MAC address of the Smile
310310 if self .smile (ADAM ) and (
311311 (found := self ._domain_objects .find (".//protocols/zig_bee_coordinator" )) is not None
312312 ):
313313 appl .zigbee_mac = found .find ("mac_address" ).text
314314
315315 # Adam: collect regulation_modes and check for cooling, indicating cooling-mode is present
316- reg_mode_list : list [str ] = []
317- locator = "./actuator_functionalities/regulation_mode_control_functionality"
318- if (search := appliance .find (locator )) is not None :
319- if search .find ("allowed_modes" ) is not None :
320- for mode in search .find ("allowed_modes" ):
321- reg_mode_list .append (mode .text )
322- if mode .text == "cooling" :
323- self ._cooling_present = True
324- self ._reg_allowed_modes = reg_mode_list
325-
326- # Adam: check for presence of gateway_modes
316+ self ._appl_regulation_mode_info (appliance )
317+
318+ # Adam: collect the gateway_modes
327319 self ._gw_allowed_modes = []
328320 locator = "./actuator_functionalities/gateway_mode_control_functionality[type='gateway_mode']/allowed_modes"
329321 if appliance .find (locator ) is not None :
@@ -346,8 +338,23 @@ def _appliance_info_finder(self, appl: Munch, appliance: etree) -> Munch:
346338 # Collect info from power-related devices (Plug, Aqara Smart Plug)
347339 return self ._energy_device_info_finder (appl , appliance )
348340
341+ def _appl_regulation_mode_info (self , appliance : etree ) -> None :
342+ """Helper-function for _appliance_info_finder()."""
343+ reg_mode_list : list [str ] = []
344+ locator = "./actuator_functionalities/regulation_mode_control_functionality"
345+ if (search := appliance .find (locator )) is not None :
346+ if search .find ("allowed_modes" ) is not None :
347+ for mode in search .find ("allowed_modes" ):
348+ reg_mode_list .append (mode .text )
349+ if mode .text == "cooling" :
350+ self ._cooling_present = True
351+ self ._reg_allowed_modes = reg_mode_list
352+
349353 def _appl_dhw_mode_info (self , appl : Munch , appliance : etree ) -> Munch :
350- """Collect dhw control operation modes - Anna + Loria."""
354+ """Helper-function for _appliance_info_finder().
355+
356+ Collect dhw control operation modes - Anna + Loria.
357+ """
351358 dhw_mode_list : list [str ] = []
352359 locator = "./actuator_functionalities/domestic_hot_water_mode_control_functionality"
353360 if (search := appliance .find (locator )) is not None :
0 commit comments