Dear Kumo colleagues,
Attached is a script that runs for me on KUMO and controls a KASA switch.
I use it to control a roof ventilation system, which is probably not going to be of interest to anyone but me.
I suspect, however, that the code for setting up and using a TP-LINK KASA switch may interest a number of you.
The KASA management needs (and the code requests) your:
- Kasa login credentials
- The alias for the target switch
The code provides for:
- Acquiring a token to authorise HTTP POST calls
- Acquiring the device ID to control the target switch
- Regularly fetching a fresh token to maintain continuity of access (they expire)
- Switch control
Hope some of you find it useful!
cheers
Rod Laird