Closed Johnny-Larue closed 7 years ago
@Johnny-Larue I'm pretty sure there is no "discover" command in the script. Do you have any documentation on how to communicate the delayed reboot command to the hs100?
Hrmm. Unless I'm mistaking something, line 199 in hs100.sh looks to be the subroutine to discover smart plugs:
# plug commands
cmd_discover(){
...etc.
Here is a reverse-engineer of the device. All the relevant commands are under "system commands". I'd do it myself, but I'm new to this, and having difficulty trying to figure out how they've encoded the JSON to be sent as a payload. This is the JSON for 1 second wait until rebooting:
{"system":{"reboot":{"delay":1}}}
Thanks!
You're probably referring to a fork somebody made (can you point me to it?). The original script is here [1] and doesn't perform any discovery.
[1] https://github.com/ggeorgovassilis/linuxscripts/blob/master/tp-link-hs100-smartplug/hs100.sh
Oh, gosh, you're right. I'm a bonehead, ha! Here it is: Control the tp-link HS100 smart plug from the command line Just out of curiosity, how are those JSON commands being encoded? I don't see any functions within your scripts, so I assume it must be pre-encoded and just dropped right in.
Hi! This is a wonderful script, but I've run into two things. Maybe I'm doing something wrong, but I don't think so. When I run:
sudo hs100.sh discover
the script asks for the IP address. In perusing your code, I found that it doesn't seem to look for anything other than the IP and port. Here's my dumb little hack that made it work for me:
Also, when I do discovery, it picks up an IP camera on the network and throws it in the list, which I think is because the IP camera has port 9999 open. Just FYI.
One last thing: Would you consider implementing the {"system":{"reboot":{"delay":1}}} function? I'm using the code to reset a funky POE switch that the computer happens to be connected to, thus it's a bit tough to turn the thing back on through code!
Thank you so much!