From 5ccb2fd24dbec28d531c6e0074b313b7e6411014 Mon Sep 17 00:00:00 2001 From: Jason Benaim Date: Sat, 24 Nov 2018 02:18:02 -0800 Subject: [PATCH] Add reboot and reset commands --- README.md | 21 ++++++++++++++------- hs100.c | 8 ++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index bf07974..7d63770 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,25 @@ # hs100 -A small program for flipping TP-Link HS100/HS105/HS110 wi-fi smart plugs on -and off. +A tool for using TP-Link HS100/HS105/HS110 wi-fi smart plugs. You can turn +them on or off, reboot them, and factory reset them. + +Tested to work on Linux, OSX, IRIX, and Windows under WSL. Loosely based on [pyHS100](https://github.com/GadgetReactor/pyHS100) and [research from softScheck](https://www.softscheck.com/en/reverse-engineering-tp-link-hs110/). -Tested to work on Linux, OSX, and IRIX. - ## Usage -```hs100 ``` -As a convenience, you can supply the words 'on' or 'off' in place of a json -command blob. +`hs100 ` + +Command can be: +- `on`: turn the power on +- `off`: turn the power off +- `reboot`: reboot the plug +- `reset-yes-really`: factory reset the plug +- Alternatively, you can supply a JSON string to be sent directly to the +device. Note that the JSON string must be quoted, like so: +`hs100 '{"system":{"set_relay_state":{"state":1}}}'` ## Todo diff --git a/hs100.c b/hs100.c index ce6f703..8656dec 100644 --- a/hs100.c +++ b/hs100.c @@ -23,6 +23,14 @@ struct cmd_alias_s cmd_aliases[] = { .alias = "on", .command = "{\"system\":{\"set_relay_state\":{\"state\":1}}}", }, + { + .alias = "reboot", + .command = "{\"system\":{\"reboot\":{\"delay\":0}}}", + }, + { + .alias = "reset-yes-really", + .command = "{\"system\":{\"reset\":{\"delay\":0}}}", + }, { .end = 1, },