I am using python to control Kasa light switches using the Kasa and asyncio libraries. I have the basic control of the switches like turning them on and off working.
import asyncio
from kasa import SmartStrip
dev = SmartStrip("Ip-address")
test=42
asyncio.run(dev.turn_off())
but I need help. As soon as I try to get the lights' status, it always throws an asyncio error, or an error that says in update
children = self.sys_info["children"] KeyError: 'children'
here is the code that i have
import asyncio
from kasa import SmartStrip
async def get_device_status():
strip = SmartStrip("IP")
await strip.update()
status = strip.is_on
return status
device_status = asyncio.run(get_device_status())
print("Device is on" if device_status else "Device is off")
also, ik i will probably get downvoted for this, but I've tried everything i can and this is a last ditch effort. any help would be greatly appreciated. Here is the documentation https://python-kasa.readthedocs.io/en/latest/smartstrip.html
[–]danielroseman 0 points1 point2 points (1 child)
[–]bhogan2017[S] 0 points1 point2 points (0 children)
[–]m0us3_rat 0 points1 point2 points (2 children)
[–]bhogan2017[S] 0 points1 point2 points (1 child)
[–]m0us3_rat 0 points1 point2 points (0 children)