I have a TP-Link HS110 plug (probably identical to the HS100 … but I thought being able to query it through the app to find out energy usage would be neat …).
Anyway, it originally didn’t seem to let me schedule it through the app, so I dug around and wrote a crap shell script I can prod via cron.
Usage examples:
1. tplink.sh -u my@email.com -p mypassword -o off -> turns the first device found off.
2. tplink.sh -u my@email.com -p mypassword -o on -> turns the first device found on.
3. tplink.sh -u my@email.com -p mypassword -d TpLinkDeviceId -o on -> now for a specific device.
4. tplink.sh -u …. -p …. -d “?” -> dumps device list output …
5. tplink.sh -t tpLinktoken -d DeviceId -o on|off …
Hello david,
When I write (from the mac terminal) “sh /Users/DESIGN/Downloads/tplink.sh -u MAIL -p PASS -d DEVICEID -or on” the following error message appears:
/Users/DESIGN/Downloads/tplink.sh: line 69: / proc / sys / kernel / random / uuid: No such file or directory
/Users/DESIGN/Downloads/tplink.sh: line 78: jq: command not found
(23) Failed writing body
Retrieved token of: from API
Turn plug on …
Turn plug -> 1 …
/Users/DESIGN/Downloads/tplink.sh: line 112: jq: command not found
/Users/DESIGN/Downloads/tplink.sh: line 112: [: =: unary operator expected
Check: {“error_code”: – 20104, “msg”: “Parameter does not exist”}
Any solution??
Thank you!
Hi – the problem is that you’re using a Mac – so somehow you’ll need to get ‘jq’ installed. (It’s a small utility to read/parse json).
For the proc/sys/kernel/random/uuid problem – try replacing line 69 with :
"terminalUUID": "'$(python -c 'import uuid; print "%s" % uuid.uuid4()')'"