TP-Link HS100 And HS110 jeedom plugin
For the full story, see Reverse Engineering the TP-Link HS110
A python client for the proprietary TP-Link Smart Home protocol to control TP-Link HS100 and HS110 WiFi Smart Plugs. The SmartHome protocol runs on TCP port 9999 and uses a trivial XOR autokey encryption that provides no security.
There is no authentication mechanism and commands are accepted independent of device state (configured/unconfigured).
Commands are formatted using JSON, for example:
{"system":{"get_sysinfo":null}}
Instead of null
we can also write {}
. Commands can be nested, for example:
{"system":{"get_sysinfo":null},"time":{"get_time":null}}
A full list of commands is provided in tplink-smarthome-commands.txt.
./tplink_smartplug.py -t <ip> [-c <cmd> || -j <json>]
Provide the target IP using -t
and a command to send using either -c
or -j
. Commands for the -c
flag:
Command | Description |
---|---|
on | Turns on the plug |
off | Turns off the plug |
info | Returns device info |
cloudinfo | Returns cloud connectivity info |
wlanscan | Scan for nearby access points |
time | Returns the system time |
schedule | Lists configured schedule rules |
countdown | Lists configured countdown rules |
antitheft | Lists configured antitheft rules |
reboot | Reboot the device |
reset | Reset the device to factory settings |
energy | Return realtime voltage/current/power |
More advanced commands such as creating or editing rules can be issued using the -j
flag by providing the full JSON string for the command. Please consult tplink-smarthome-commands.txt for a comprehensive list of commands.