From fe52bc5b6d515f43fe89aaf7d776fd9020bdc3e5 Mon Sep 17 00:00:00 2001 From: mista-funky <57115343+mista-funky@users.noreply.github.com> Date: Sat, 22 Jul 2023 06:34:29 -0400 Subject: [PATCH] power: tplink smartstrip fix Correct the procedure for setting the child id for devices that control more than one outlet. Signed-off-by: Rick Marino --- moonraker/components/power.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/moonraker/components/power.py b/moonraker/components/power.py index a75de91..60f5f9f 100644 --- a/moonraker/components/power.py +++ b/moonraker/components/power.py @@ -809,10 +809,9 @@ class TPLinkSmartPlug(PowerDevice): # TPLink device controls multiple devices if self.output_id is not None: sysinfo = await self._send_tplink_command("info") - dev_id = sysinfo["system"]["get_sysinfo"]["deviceId"] - out_cmd["context"] = { - 'child_ids': [f"{dev_id}{self.output_id:02}"] - } + children = sysinfo["system"]["get_sysinfo"]["children"] + child_id = children[self.output_id]["id"] + out_cmd["context"] = {"child_ids": [f"{child_id}"]} elif command == "info": out_cmd = {'system': {'get_sysinfo': {}}} elif command == "clear_rules":