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 <rcmarino@gmail.com>
This commit is contained in:
mista-funky 2023-07-22 06:34:29 -04:00 committed by GitHub
parent 821f3c5161
commit fe52bc5b6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -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":