jkbenaim / hs100

CLI tool for TP-Link and Kasa WiFi smart plugs.
70 stars 16 forks source link
c iot smartplug tp-link-hs100 tp-link-hs105 tp-link-hs110

hs100

A tool for using TP-Link HS100/HS103/HS105/HS110/HS300 wi-fi smart plugs. You can turn them on and off, reboot them, and so on. You can even set them up without using TP-Link's app (see Initial Setup).

Tested to work on Linux, OSX, IRIX, and Windows under WSL.

Loosely based on pyHS100 and research from softScheck.

Usage

hs100 <ip> <command>

Commands:

Use with Outlet Strips (such as HS300)

The emeter, off and on commands can be used on the individual outlets of multiple outlet strips.

Initial Setup

According to TP-Link, initial setup of the plugs is performed by installing their "Kasa" app on your smartphone (free account required), and using its setup tool. This sucks and I do not recommend it. Instead, follow these alternative instructions.

You want to get the plug into the "blinking amber and blue" state, in which it will spin up its own AP and await commands. If you have a brand new plug, then it should do this automatically. Otherwise, hold down one of the buttons (depending on your model) for about 5 seconds, until its light blinks amber and blue.

You should see a wifi AP called "TP-Link_Smart Plug_XXXX" or similar. Connect to this AP. You will be given an IP of 192.168.0.100, with the plug at 192.168.0.1.

Issue the following commands to the plug:

If the light turns solid amber, then it was unable to associate-- factory reset the plug and try again. Otherwise, the light on your plug will change first to blinking blue, then to solid blue indicating that it has successfully connected to your AP.

Build

Ubuntu instructions You will need build-essential installed. Then run make. This will produce a hs100 binary which you can use. E.g. ./hs100 192.168.0.1 off

Todo

This program is very basic. Patches welcome!