linuxscripts
linuxscripts copied to clipboard
hs100 script: incorporate netstat timeout
Details in this comment https://blog.georgovassilis.com/2016/05/07/controlling-the-tp-link-hs100-wi-fi-smart-plug/comment-page-2/#comment-1901
I'm not sure of the etiquette for this, but I rewrote the script in python. netcat on arch linux doesn't like the timeout arguments as per that linked comment. https://github.com/Nealefelaen/hs100
Issue (on a Raspberry PI): The plug reacted without delay to on/off commands, but the script seemed to hang for a long tome after sending a command. Also took a long time to get any status info. Looked like nc was waiting for a timeout?
I added -N (shutdown on EOF) to nc in send_to_plug(). All the commands work and the script terminates quickly. Tested with: sw_ver":"1.0.18 Build 210910 Rel.141202","hw_ver":"1.0","model":"KP115(US)"