Skip to content

Commit fec7b38

Browse files
committed
Make the changes also work for Stretch v2
1 parent fd671b7 commit fec7b38

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

plugwise/helper.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,14 @@ def appliance_data(self, dev_id):
568568

569569
data[name] = format_measure(measure, ENERGY_WATT_HOUR)
570570

571+
# Adam & Stretches: detect relay switch data
572+
actuator = "actuator_functionalities"
573+
func_type = "relay_functionality"
574+
if self.smile_type == "stretch" and self.smile_version[1].major == 2:
575+
actuator = "actuators"
576+
func_type = "relay"
571577
for item, name in {"lock": "lock", "state": "relay"}.items():
572-
locator = f'.//actuator_functionalities/relay_functionality/{item}'
578+
locator = f'.//{actuator}/{func_type}/{item}'
573579
if appliance.find(locator) is not None:
574580
measure = appliance.find(locator).text
575581
data[name] = measure

0 commit comments

Comments
 (0)