Skip to content
forked from branning/hs100

Control the tp-link HS100 smart plug from the command line

Notifications You must be signed in to change notification settings

vassilisw/hs100

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 

Repository files navigation

tp-link Wi-Fi Smart Plug HS100

About

The tp-link Wi-Fi Smart Plug model HS100 is an embedded Linux computer with a Wifi chip, a 110/220 V AC relay with a 15 A current limit, and a US-style grounded electrical socket. You pair with it by establishing an ad-hoc network between the plug and a smartphone (also called Wifi direct). After giving your router's SSID and access information, the plug connects to it and you can control the plug with the app provided by tp-link, called Kasa. One downside of using Kasa is that it's really not much more than a wall-switch in an app, though it does have pretty rich timer features which are nice. But you can't do things like turn the light on or off in response to events on the internet. Tp-link does provide a network control mode, but you have to pass control of your plug over to them, which isn't particularly great if you endeavor to remain the master of your own domain, haha only serious.

The script below was graciously provided by @ggeorgovassilis in his linux scripts repo, with help from Thomas Baust. You can read a great description of the reverse engineering process and the development of the script at George's blog here.

control the tp-link hs100 and hs110 wlan smart plug

Script to connect over TCP/IP to an hs100/hs110 smart plug, switch it on and off and query status information. You'll need the IP address and port (was 9999 in my tests) and a command, e.g.:

Print what IP your HS100 has:

hs100.sh discover

Discover IP, and save it for later:

  • if you use sudo, then an entry is written into /etc/hosts for the HS100, if it is found
  • if you don't do this, you must add an -i 192.168.1.20 arguments to all other hs100.sh commands, e.g. hs100.sh -i 192.168.1.20 on
sudo hs100.sh discover

Switch plug on:

hs100.sh on

Switch plug off:

hs100.sh on

Check if plug is on or off:

hs100.sh check

Print plug system status:

hs100.sh status

Print power consumption (not supported with my hs100 so not tested):

hs100.sh emeter

About

Control the tp-link HS100 smart plug from the command line

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%