Skip to content

Commit 4123d89

Browse files
committed
Revert "Make appl, dom_ob, locs, mods global vars not private"
This reverts commit 999ce5f.
1 parent f13dce6 commit 4123d89

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

plugwise/smile.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,15 @@ async def close_connection(self):
204204
async def full_update_device(self):
205205
"""Update all XML data from device."""
206206
await self.update_domain_objects()
207-
self.locations = await self.request(LOCATIONS)
207+
self._locations = await self.request(LOCATIONS)
208208

209209
# P1 legacy has no appliances
210210
if not (self.smile_type == "power" and self._smile_legacy):
211-
self.appliances = await self.request(APPLIANCES)
211+
self._appliances = await self.request(APPLIANCES)
212212

213213
# No need to import modules for P1, no userfull info
214214
if self.smile_type != "power":
215-
self.modules = await self.request(MODULES)
215+
self._modules = await self.request(MODULES)
216216

217217
def update_device_state(self, data, dev_dict):
218218
"""Helper for update_helper."""
@@ -263,7 +263,7 @@ async def update_gw_devices(self):
263263

264264
# P1 legacy has no appliances
265265
if not (self.smile_type == "power" and self._smile_legacy):
266-
self.appliances = await self.request(APPLIANCES)
266+
self._appliances = await self.request(APPLIANCES)
267267

268268
for dev_id, dev_dict in self.gw_devices.items():
269269
data = self.get_device_data(dev_id)
@@ -492,7 +492,7 @@ async def set_schedule_state(self, loc_id, name, state):
492492
if location_id == loc_id:
493493
state = str(state)
494494
locator = f'.//*[@id="{schema_rule_id}"]/template'
495-
for rule in self.domain_objects.findall(locator):
495+
for rule in self._domain_objects.findall(locator):
496496
template_id = rule.attrib["id"]
497497

498498
uri = f"{RULES};id={schema_rule_id}"
@@ -511,7 +511,7 @@ async def set_preset(self, loc_id, preset):
511511
if self._smile_legacy:
512512
return await self.set_preset_legacy(preset)
513513

514-
current_location = self.locations.find(f'location[@id="{loc_id}"]')
514+
current_location = self._locations.find(f'location[@id="{loc_id}"]')
515515
location_name = current_location.find("name").text
516516
location_type = current_location.find("type").text
517517

@@ -544,7 +544,7 @@ async def set_groupswitch_member_state(self, members, state, switch):
544544
"""Switch the Switch within a group of members off/on."""
545545
for member in members:
546546
locator = f'appliance[@id="{member}"]/{switch.actuator}/{switch.func_type}'
547-
switch_id = self.appliances.find(locator).attrib["id"]
547+
switch_id = self._appliances.find(locator).attrib["id"]
548548
uri = f"{APPLIANCES};id={member}/{switch.device};id={switch_id}"
549549
if self.stretch_v2:
550550
uri = f"{APPLIANCES};id={member}/{switch.device}"
@@ -578,7 +578,7 @@ async def set_switch_state(self, appl_id, members, model, state):
578578
return await self.set_groupswitch_member_state(members, state, switch)
579579

580580
locator = f'appliance[@id="{appl_id}"]/{switch.actuator}/{switch.func_type}'
581-
switch_id = self.appliances.find(locator).attrib["id"]
581+
switch_id = self._appliances.find(locator).attrib["id"]
582582
uri = f"{APPLIANCES};id={appl_id}/{switch.device};id={switch_id}"
583583
if self.stretch_v2:
584584
uri = f"{APPLIANCES};id={appl_id}/{switch.device}"
@@ -588,7 +588,7 @@ async def set_switch_state(self, appl_id, members, model, state):
588588
locator = (
589589
f'appliance[@id="{appl_id}"]/{switch.actuator}/{switch.func_type}/lock'
590590
)
591-
lock_state = self.appliances.find(locator).text
591+
lock_state = self._appliances.find(locator).text
592592
print("Lock state: ", lock_state)
593593
# Don't bother switching a relay when the corresponding lock-state is true
594594
if lock_state == "true":
@@ -602,7 +602,7 @@ async def set_switch_state(self, appl_id, members, model, state):
602602
async def set_preset_legacy(self, preset):
603603
"""Set the given preset on the thermostat - from DOMAIN_OBJECTS."""
604604
locator = f'rule/directives/when/then[@icon="{preset}"].../.../...'
605-
rule = self.domain_objects.find(locator)
605+
rule = self._domain_objects.find(locator)
606606
if rule is None:
607607
return False
608608

@@ -615,7 +615,7 @@ async def set_preset_legacy(self, preset):
615615
async def set_schedule_state_legacy(self, name, state):
616616
"""Send a set request to the schema with the given name."""
617617
schema_rule_id = None
618-
for rule in self.domain_objects.findall("rule"):
618+
for rule in self._domain_objects.findall("rule"):
619619
if rule.find("name").text == name:
620620
schema_rule_id = rule.attrib["id"]
621621

@@ -625,7 +625,7 @@ async def set_schedule_state_legacy(self, name, state):
625625
template_id = None
626626
state = str(state)
627627
locator = f'.//*[@id="{schema_rule_id}"]/template'
628-
for rule in self.domain_objects.findall(locator):
628+
for rule in self._domain_objects.findall(locator):
629629
template_id = rule.attrib["id"]
630630

631631
uri = f"{RULES};id={schema_rule_id}"

0 commit comments

Comments
 (0)