Skip to content

Commit 9fad189

Browse files
committed
Improve descriptions/comments
1 parent 1a799e8 commit 9fad189

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

plugwise/helper.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,8 @@ def all_appliances(self):
419419

420420
# For legacy P1
421421
if self._smile_legacy and self.smile_type == "power":
422-
# Inject home_location as dev_id for legacy so
423-
# _appliance_data can use loc_id for dev_id.
422+
# Inject home_location as device id for legacy so
423+
# appl_data can use the location id as device id.
424424
self.appl_data[self._home_location] = {
425425
"name": "P1",
426426
"model": "Smile P1",
@@ -631,7 +631,7 @@ def appliance_measurements(self, appliance, data, measurements):
631631

632632
return data
633633

634-
def appliance_data(self, dev_id):
634+
def appliance_data(self, d_id):
635635
"""
636636
Collect the appliance-data based on device id.
637637
Determined from APPLIANCES, for legacy from DOMAIN_OBJECTS.
@@ -641,7 +641,7 @@ def appliance_data(self, dev_id):
641641
if self._smile_legacy and self.smile_type != "stretch":
642642
search = self._domain_objects
643643

644-
appliances = search.findall(f'.//appliance[@id="{dev_id}"]')
644+
appliances = search.findall(f'.//appliance[@id="{d_id}"]')
645645

646646
for appliance in appliances:
647647
measurements = DEVICE_MEASUREMENTS.items()
@@ -1025,7 +1025,7 @@ def get_lock_state(self, xml):
10251025
return data
10261026

10271027
def update_helper(self, data, d_dict, d_id, e_type, key):
1028-
"""Helper for update_gw_devices."""
1028+
"""Helper-function for update_gw_devices()."""
10291029
for dummy in d_dict[e_type]:
10301030
if key != dummy[ATTR_ID]:
10311031
continue
@@ -1035,7 +1035,7 @@ def update_helper(self, data, d_dict, d_id, e_type, key):
10351035
self.gw_devices[d_id][e_type][idx][ATTR_STATE] = data[key]
10361036

10371037
def update_device_state(self, data, d_dict):
1038-
"""Helper for device_state_updater()."""
1038+
"""Helper-function for device_state_updater()."""
10391039
_cooling_state = False
10401040
_dhw_state = False
10411041
_heating_state = False
@@ -1069,23 +1069,25 @@ def update_device_state(self, data, d_dict):
10691069
return [state, icon]
10701070

10711071
def device_state_updater(self, data, d_id, d_dict):
1072-
""" Device State sensor update helper."""
1072+
""" Device State sensor update helper-function for update_gw_devices()."""
10731073
for idx, item in enumerate(d_dict["sensors"]):
10741074
if item[ATTR_ID] == "device_state":
10751075
result = self.update_device_state(data, d_dict)
10761076
self.gw_devices[d_id]["sensors"][idx][ATTR_STATE] = result[0]
10771077
self.gw_devices[d_id]["sensors"][idx][ATTR_ICON] = result[1]
10781078

10791079
def pw_notification_updater(self, d_id, d_dict):
1080-
""" PW_Notification update helper."""
1080+
""" PW_Notification update helper-function for update_gw_devices()."""
10811081
for idx, item in enumerate(d_dict["binary_sensors"]):
10821082
if item[ATTR_ID] == "plugwise_notification":
10831083
self.gw_devices[d_id]["binary_sensors"][idx][ATTR_STATE] = (
10841084
self.notifications != {}
10851085
)
10861086

10871087
def append_special(self, data, d_id, bs_list, s_list):
1088-
"""Helper for all_device_data()."""
1088+
"""Helper-function for all_device_data().
1089+
When the conditions are met, it appends the plugwise_notification binary_sensor and/or the device_state sensor.
1090+
"""
10891091
if d_id == self.gateway_id:
10901092
if self.single_master_thermostat() is not None:
10911093
bs_list.append(PW_NOTIFICATION)

0 commit comments

Comments
 (0)