@@ -126,16 +126,20 @@ def _get_module_data(
126126 model_data ["vendor_model" ] = module .find ("vendor_model" ).text
127127 model_data ["hardware_version" ] = module .find ("hardware_version" ).text
128128 model_data ["firmware_version" ] = module .find ("firmware_version" ).text
129- if legacy :
130- # Stretches
131- if (router := module .find ("./protocols/network_router" )) is not None :
132- model_data ["zigbee_mac_address" ] = router .find ("mac_address" ).text
133- # Also look for the Circle+/Stealth M+
134- if (coord := module .find ("./protocols/network_coordinator" )) is not None :
135- model_data ["zigbee_mac_address" ] = coord .find ("mac_address" ).text
136- # Adam
137- elif (zb_node := module .find ("./protocols/zig_bee_node" )) is not None :
138- model_data ["zigbee_mac_address" ] = zb_node .find ("mac_address" ).text
139- model_data ["reachable" ] = zb_node .find ("reachable" ).text == "true"
129+ self ._get_zigbee_data (module , model_data , legacy )
140130
141131 return model_data
132+
133+ def _get_zigbee_data (self , module : etree , model_data : ModelData , legacy : bool ) -> ModelData :
134+ """Helper-function for _get_model_data()."""
135+ if legacy :
136+ # Stretches
137+ if (router := module .find ("./protocols/network_router" )) is not None :
138+ model_data ["zigbee_mac_address" ] = router .find ("mac_address" ).text
139+ # Also look for the Circle+/Stealth M+
140+ if (coord := module .find ("./protocols/network_coordinator" )) is not None :
141+ model_data ["zigbee_mac_address" ] = coord .find ("mac_address" ).text
142+ # Adam
143+ elif (zb_node := module .find ("./protocols/zig_bee_node" )) is not None :
144+ model_data ["zigbee_mac_address" ] = zb_node .find ("mac_address" ).text
145+ model_data ["reachable" ] = zb_node .find ("reachable" ).text == "true"
0 commit comments