@@ -133,10 +133,10 @@ def __init__(self):
133133 self ._port = None
134134 self ._timeout = None
135135
136- self .appliances = None
137- self .domain_objects = None
138- self .locations = None
139- self .modules = None
136+ self ._appliances = None
137+ self ._domain_objects = None
138+ self ._locations = None
139+ self ._modules = None
140140
141141 self .appl_data = {}
142142 self .active_device_present = None
@@ -219,7 +219,7 @@ def locations_legacy(self):
219219 self ._home_location = 0
220220
221221 # Add Anna appliances
222- for appliance in self .appliances :
222+ for appliance in self ._appliances :
223223 appliances .add (appliance .attrib ["id" ])
224224
225225 if self .smile_type == "thermostat" :
@@ -266,11 +266,11 @@ def all_locations(self):
266266 loc = Munch ()
267267
268268 # Legacy Anna without outdoor_temp and Stretches have no locations, create one containing all appliances
269- if len (self .locations ) == 0 and self ._smile_legacy :
269+ if len (self ._locations ) == 0 and self ._smile_legacy :
270270 self .locations_legacy ()
271271 return
272272
273- for location in self .locations :
273+ for location in self ._locations :
274274 loc .name = location .find ("name" ).text
275275 loc .id = location .attrib ["id" ]
276276 loc .types = set ()
@@ -298,7 +298,7 @@ def get_module_data(self, appliance, locator, mod_type):
298298 appl_search = appliance .find (locator )
299299 if appl_search is not None :
300300 link_id = appl_search .attrib ["id" ]
301- module = self .modules .find (f".//{ mod_type } [@id='{ link_id } ']...." )
301+ module = self ._modules .find (f".//{ mod_type } [@id='{ link_id } ']...." )
302302 if module is not None :
303303 v_name = module .find ("vendor_name" ).text
304304 v_model = module .find ("vendor_model" ).text
@@ -429,16 +429,16 @@ def all_appliances(self):
429429 # scan for the same functionality
430430
431431 # The presence of either indicates a local active device, e.g. heat-pump or gas-fired heater
432- self ._cp_state = self .appliances .find (
432+ self ._cp_state = self ._appliances .find (
433433 ".//logs/point_log[type='compressor_state']"
434434 )
435- fl_state = self .appliances .find (".//logs/point_log[type='flame_state']" )
436- bl_state = self .appliances .find (".//services/boiler_state" )
435+ fl_state = self ._appliances .find (".//logs/point_log[type='flame_state']" )
436+ bl_state = self ._appliances .find (".//services/boiler_state" )
437437 self .active_device_present = (
438438 self ._cp_state is not None or fl_state is not None or bl_state is not None
439439 )
440440
441- for appliance in self .appliances :
441+ for appliance in self ._appliances :
442442 appl = Munch ()
443443 appl .pwclass = appliance .find ("type" ).text
444444 # Nothing useful in opentherm so skip it
@@ -505,7 +505,7 @@ def presets(self, loc_id):
505505 rule_ids = self .rule_ids_by_name ("Thermostat presets" , loc_id )
506506
507507 for rule_id in rule_ids :
508- directives = self .domain_objects .find (f'rule[@id="{ rule_id } "]/directives' )
508+ directives = self ._domain_objects .find (f'rule[@id="{ rule_id } "]/directives' )
509509
510510 for directive in directives :
511511 preset = directive .find ("then" ).attrib
@@ -524,7 +524,7 @@ def presets(self, loc_id):
524524 def presets_legacy (self ):
525525 """Collect presets for legacy Anna."""
526526 preset_dictionary = {}
527- for directive in self .domain_objects .findall ("rule/directives/when/then" ):
527+ for directive in self ._domain_objects .findall ("rule/directives/when/then" ):
528528 if directive is not None and "icon" in directive .keys ():
529529 # Ensure list of heating_setpoint, cooling_setpoint
530530 preset_dictionary [directive .attrib ["icon" ]] = [
@@ -538,7 +538,7 @@ def rule_ids_by_name(self, name, loc_id):
538538 """Obtain the rule_id from name and location_id."""
539539 schema_ids = {}
540540 locator = f'.//contexts/context/zone/location[@id="{ loc_id } "]'
541- for rule in self .domain_objects .findall (f'.//rule[name="{ name } "]' ):
541+ for rule in self ._domain_objects .findall (f'.//rule[name="{ name } "]' ):
542542 if rule .find (locator ) is not None :
543543 schema_ids [rule .attrib ["id" ]] = loc_id
544544
@@ -550,7 +550,7 @@ def rule_ids_by_tag(self, tag, loc_id):
550550 schema_ids = {}
551551 locator1 = f'.//template[@tag="{ tag } "]'
552552 locator2 = f'.//contexts/context/zone/location[@id="{ loc_id } "]'
553- for rule in self .domain_objects .findall (".//rule" ):
553+ for rule in self ._domain_objects .findall (".//rule" ):
554554 if rule .find (locator1 ) is not None :
555555 if rule .find (locator2 ) is not None :
556556 schema_ids [rule .attrib ["id" ]] = loc_id
@@ -561,18 +561,18 @@ def rule_ids_by_tag(self, tag, loc_id):
561561 def temperature_uri_legacy (self ):
562562 """Determine the location-set_temperature uri - from APPLIANCES."""
563563 locator = ".//appliance[type='thermostat']"
564- appliance_id = self .appliances .find (locator ).attrib ["id" ]
564+ appliance_id = self ._appliances .find (locator ).attrib ["id" ]
565565
566566 return f"{ APPLIANCES } ;id={ appliance_id } /thermostat"
567567
568568 async def update_domain_objects (self ):
569569 """Request domain_objects data."""
570- self .domain_objects = await self .request (DOMAIN_OBJECTS )
570+ self ._domain_objects = await self .request (DOMAIN_OBJECTS )
571571
572572 # If Plugwise notifications present:
573573 self .notifications = {}
574574 url = f"{ self ._endpoint } { DOMAIN_OBJECTS } "
575- notifications = self .domain_objects .findall (".//notification" )
575+ notifications = self ._domain_objects .findall (".//notification" )
576576 for notification in notifications :
577577 try :
578578 msg_id = notification .attrib ["id" ]
@@ -628,9 +628,9 @@ def appliance_data(self, dev_id):
628628 Determined from APPLIANCES, for legacy from DOMAIN_OBJECTS.
629629 """
630630 data = {}
631- search = self .appliances
631+ search = self ._appliances
632632 if self ._smile_legacy and self .smile_type != "stretch" :
633- search = self .domain_objects
633+ search = self ._domain_objects
634634
635635 appliances = search .findall (f'.//appliance[@id="{ dev_id } "]' )
636636
@@ -719,14 +719,14 @@ def temperature_uri(self, loc_id):
719719 return self .temperature_uri_legacy ()
720720
721721 locator = f'location[@id="{ loc_id } "]/actuator_functionalities/thermostat_functionality'
722- thermostat_functionality_id = self .locations .find (locator ).attrib ["id" ]
722+ thermostat_functionality_id = self ._locations .find (locator ).attrib ["id" ]
723723
724724 return f"{ LOCATIONS } ;id={ loc_id } /thermostat;id={ thermostat_functionality_id } "
725725
726726 def group_switches (self ):
727727 """Collect switching- or pump-group info."""
728728 switch_groups = {}
729- search = self .domain_objects
729+ search = self ._domain_objects
730730
731731 appliances = search .findall ("./appliance" )
732732 groups = search .findall ("./group" )
@@ -772,7 +772,7 @@ def heating_valves(self):
772772 """
773773 loc_found = 0
774774 open_valve_count = 0
775- for appliance in self .appliances .findall (".//appliance" ):
775+ for appliance in self ._appliances .findall (".//appliance" ):
776776 locator = './/logs/point_log[type="valve_position"]/period/measurement'
777777 if appliance .find (locator ) is not None :
778778 loc_found += 1
@@ -819,7 +819,7 @@ def power_data_from_location(self, loc_id):
819819 direct_data = {}
820820 loc = Munch ()
821821
822- search = self .domain_objects
822+ search = self ._domain_objects
823823 t_string = "tariff"
824824 if self ._smile_legacy and self .smile_type == "power" :
825825 t_string = "tariff_indicator"
@@ -857,15 +857,15 @@ def power_data_from_location(self, loc_id):
857857 def preset (self , loc_id ):
858858 """Collect the active preset based on location_id."""
859859 if self ._smile_legacy :
860- active_rule = self .domain_objects .find (
860+ active_rule = self ._domain_objects .find (
861861 "rule[active='true']/directives/when/then"
862862 )
863863 if active_rule is None or "icon" not in active_rule .keys ():
864864 return
865865 return active_rule .attrib ["icon" ]
866866
867867 locator = f'.//location[@id="{ loc_id } "]/preset'
868- preset = self .domain_objects .find (locator )
868+ preset = self ._domain_objects .find (locator )
869869 if preset is not None :
870870 return preset .text
871871
@@ -877,7 +877,7 @@ def schemas_legacy(self):
877877 schemas = {}
878878 selected = None
879879
880- for schema in self .domain_objects .findall (".//rule" ):
880+ for schema in self ._domain_objects .findall (".//rule" ):
881881 rule_name = schema .find ("name" ).text
882882 if rule_name :
883883 if "preset" not in rule_name :
@@ -886,8 +886,8 @@ def schemas_legacy(self):
886886 log_type = "schedule_state"
887887 locator = f"appliance[type='thermostat']/logs/point_log[type='{ log_type } ']/period/measurement"
888888 active = False
889- if self .domain_objects .find (locator ) is not None :
890- active = self .domain_objects .find (locator ).text == "on"
889+ if self ._domain_objects .find (locator ) is not None :
890+ active = self ._domain_objects .find (locator ).text == "on"
891891
892892 if name is not None :
893893 schemas [name ] = active
@@ -933,14 +933,15 @@ def schemas(self, loc_id):
933933 return available , selected , schedule_temperature
934934
935935 for rule_id , dummy in rule_ids .items ():
936- name = self .domain_objects .find (f'rule[@id="{ rule_id } "]/name' ).text
936+ name = self ._domain_objects .find (f'rule[@id="{ rule_id } "]/name' ).text
937937 active = (
938- self .domain_objects .find (f'rule[@id="{ rule_id } "]/active' ).text == "true"
938+ self ._domain_objects .find (f'rule[@id="{ rule_id } "]/active' ).text
939+ == "true"
939940 )
940941 schemas [name ] = active
941942 schedules = {}
942943 locator = f'rule[@id="{ rule_id } "]/directives'
943- directives = self .domain_objects .find (locator )
944+ directives = self ._domain_objects .find (locator )
944945 for directive in directives :
945946 schedule = directive .find ("then" ).attrib
946947 keys , dummy = zip (* schedule .items ())
@@ -971,8 +972,8 @@ def last_active_schema(self, loc_id):
971972 return
972973
973974 for rule_id , dummy in rule_ids .items ():
974- schema_name = self .domain_objects .find (f'rule[@id="{ rule_id } "]/name' ).text
975- schema_date = self .domain_objects .find (
975+ schema_name = self ._domain_objects .find (f'rule[@id="{ rule_id } "]/name' ).text
976+ schema_date = self ._domain_objects .find (
976977 f'rule[@id="{ rule_id } "]/modified_date'
977978 ).text
978979 schema_time = parse (schema_date )
@@ -985,7 +986,7 @@ def last_active_schema(self, loc_id):
985986
986987 def object_value (self , obj_type , obj_id , measurement ):
987988 """Obtain the object-value from the thermostat."""
988- search = self .domain_objects
989+ search = self ._domain_objects
989990
990991 locator = (
991992 f'.//{ obj_type } [@id="{ obj_id } "]/logs/point_log'
0 commit comments