88
99from plugwise .constants import (
1010 ANNA ,
11- LOGGER ,
1211 SPECIAL_PLUG_TYPES ,
1312 SWITCH_GROUP_TYPES ,
1413 ApplianceType ,
@@ -74,13 +73,12 @@ def _appl_heater_central_info(
7473 appl .name = "OpenTherm"
7574 locator_1 = "./logs/point_log[type='flame_state']/boiler_state"
7675 locator_2 = "./services/boiler_state"
77- mod_type = "boiler_state"
7876 # xml_1: appliance
7977 # xml_3: self._modules for legacy, self._domain_objects for actual
8078 xml_3 = return_valid (xml_3 , self ._domain_objects )
81- module_data = self ._get_module_data (xml_1 , xml_3 )
82- # if not module_data["contents"]:
83- # module_data = self._get_module_data(xml_1, xml_3)
79+ module_data = self ._get_module_data (xml_1 , locator_1 , xml_3 )
80+ if not module_data ["contents" ]:
81+ module_data = self ._get_module_data (xml_1 , locator_2 , xml_3 )
8482 appl .vendor_name = module_data ["vendor_name" ]
8583 appl .hardware = module_data ["hardware_version" ]
8684 appl .model_id = module_data ["vendor_model" ] if not legacy else None
@@ -95,9 +93,8 @@ def _appl_heater_central_info(
9593 def _appl_thermostat_info (self , appl : Munch , xml_1 : etree , xml_2 : etree = None ) -> Munch :
9694 """Helper-function for _appliance_info_finder()."""
9795 locator = "./logs/point_log[type='thermostat']/thermostat"
98- mod_type = "thermostat"
9996 xml_2 = return_valid (xml_2 , self ._domain_objects )
100- module_data = self ._get_module_data (xml_1 , xml_2 )
97+ module_data = self ._get_module_data (xml_1 , locator , xml_2 )
10198 appl .vendor_name = module_data ["vendor_name" ]
10299 appl .model = module_data ["vendor_model" ]
103100 if appl .model != "ThermoTouch" : # model_id for Anna not present as stand-alone device
@@ -278,6 +275,7 @@ def _get_lock_state(self, xml: etree, data: DeviceData, stretch_v2: bool = False
278275 def _get_module_data (
279276 self ,
280277 xml_1 : etree ,
278+ locator : str ,
281279 xml_2 : etree = None ,
282280 legacy : bool = False ,
283281 ) -> ModelData :
@@ -294,12 +292,11 @@ def _get_module_data(
294292 "vendor_model" : None ,
295293 "zigbee_mac_address" : None ,
296294 }
297- if (appl_search := xml_1 .find ("./logs/point_log/*[@id]" )) is not None :
295+
296+ if (appl_search := xml_1 .find (locator )) is not None :
298297 link_tag = appl_search .tag
299298 link_id = appl_search .attrib ["id" ]
300299 loc = f".//services/{ link_tag } [@id='{ link_id } ']...."
301- if legacy :
302- loc = f".//{ link_tag } [@id='{ link_id } ']...."
303300 # Not possible to walrus for some reason...
304301 # xml_2: self._modules for legacy, self._domain_objects for actual
305302 search = return_valid (xml_2 , self ._domain_objects )
0 commit comments