You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#!/usr/bin/env python3
from kasa import SmartPlug
import asyncio
import time
plug = SmartPlug("192.168.1.96")
while True:
asyncio.run(plug.update())
power = plug.emeter_realtime.power
print(power)
time.sleep(5)
This almost works, but I encounter "Detected protocol reuse between different event loop" and then it eventually errors out.
What is the proper way to update the emeter information every X seconds?
Polling devices and storing them in a database is probably one of the top reasons for using this library. It would be wonderful if more examples were added to the documentation to show how to poll every X seconds / minutes.
Here is a copy of my current code:
This almost works, but I encounter "Detected protocol reuse between different event loop" and then it eventually errors out.
What is the proper way to update the emeter information every X seconds?
Polling devices and storing them in a database is probably one of the top reasons for using this library. It would be wonderful if more examples were added to the documentation to show how to poll every X seconds / minutes.