TP-Link HS110 – controlling from the command line

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. -u -p mypassword -o off -> turns the first device found off.
2. -u -p mypassword -o on -> turns the first device found on.
3. -u -p mypassword -d TpLinkDeviceId -o on -> now for a specific device.
4. -u …. -p …. -d “?” -> dumps device list output …
5. -t tpLinktoken -d DeviceId -o on|off …

Code / download


  1. Hello david,

    When I write (from the mac terminal) “sh /Users/DESIGN/Downloads/ -u MAIL -p PASS -d DEVICEID -or on” the following error message appears:

    /Users/DESIGN/Downloads/ line 69: / proc / sys / kernel / random / uuid: No such file or directory
    /Users/DESIGN/Downloads/ line 78: jq: command not found
    (23) Failed writing body
    Retrieved token of: from API
    Turn plug on …
    Turn plug -> 1 …
    /Users/DESIGN/Downloads/ line 112: jq: command not found
    /Users/DESIGN/Downloads/ line 112: [: =: unary operator expected
    Check: {“error_code”: – 20104, “msg”: “Parameter does not exist”}

    Any solution??
    Thank you!

  2. 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()')'"

Leave a comment

Your email address will not be published.