I impulse-bought 2 of these because it seemed like exactly what I needed for a couple projects. 6 individually controlled power outlets, and three always on USB ports. Each port monitors voltage and amps. And I even found a Python library that controls it and all the other Kasa smart devices I own. 😍
And look here. An official MySQL Python Connector.
So, this is a start.
# commented out code is example code... for now
import asyncio
from kasa import Discover
async def main():
# dev = await Discover.discover_single("127.0.0.1",username="un@example.com",password="pw")
# me no think me need login
dev = await Discover.discover_single("192.168.1.230")
# await dev.turn_on()
# await dev.update()
# me just want Info for now
devInfo = dev.hw_info
print(type(devInfo))
print(devInfo)
if __name__ == "__main__":
asyncio.run(main())
which gives me this
<class 'dict'>
{'sw_ver': '1.0.12 Build 220121 Rel.175814', 'hw_ver': '2.0', 'mac': 'B0:19:21:DF:80:D0', 'mic_type': 'IOT.SMARTPLUGSWITCH', 'hwId': '955F433CBA24823A248A59AA64571A73', 'oemId': '32BD0B21AA9BF8E84737D1DB1C66E883'}
I could probably use this command to populate the device table with ease.