55from __future__ import annotations
66
77from plugwise .constants import ModelData
8- from plugwise .util import check_heater_central , check_model , get_vendor_name
8+ from plugwise .util import check_heater_central , check_model , get_vendor_name , safe
99
1010from defusedxml import ElementTree as etree
1111from munch import Munch
@@ -32,7 +32,7 @@ def _appl_thermostat_info(self, appl: Munch, xml_1: etree, xml_2: etree = None)
3232 """Helper-function for _appliance_info_finder()."""
3333 locator = "./logs/point_log[type='thermostat']/thermostat"
3434 mod_type = "thermostat"
35- xml_2 = xml_2 or self ._domain_objects
35+ xml_2 = safe ( xml_2 , self ._domain_objects )
3636 module_data = self ._get_module_data (xml_1 , locator , mod_type , xml_2 )
3737 appl .vendor_name = module_data ["vendor_name" ]
3838 appl .model = check_model (module_data ["vendor_model" ], appl .vendor_name )
@@ -56,7 +56,8 @@ def _appl_heater_central_info(
5656
5757 # Find the valid heater_central
5858 # xml_2 self._appliances for legacy, self._domain_objects for actual
59- self ._heater_id = check_heater_central (xml_2 or self ._domain_objects )
59+ xml_2 = safe (xml_2 , self ._domain_objects )
60+ self ._heater_id = check_heater_central (xml_2 )
6061
6162 # Info for On-Off device
6263 if self ._on_off_device :
@@ -72,7 +73,7 @@ def _appl_heater_central_info(
7273 mod_type = "boiler_state"
7374 # xml_1: appliance
7475 # xml_3: self._modules for legacy, self._domain_objects for actual
75- xml_3 = xml_3 or self ._domain_objects
76+ xml_3 = safe ( xml_3 , self ._domain_objects )
7677 module_data = self ._get_module_data (xml_1 , locator_1 , mod_type , xml_3 )
7778 if not module_data ["contents" ]:
7879 module_data = self ._get_module_data (xml_1 , locator_2 , mod_type , xml_3 )
0 commit comments