This is a PowerShell module that can be used for controlling a TPLink HS100 or HS110 smart plug. The plug receives requests and this module sends requests on tcp port 9999, so theoretically this can traverse networks or the internet with proper port forwarding/NAT rules. However this can allow someone to control the device plugged into the TPLink plug, so do this with caution.
-
Begin by downloading or cloning the repository to a directory of your choice. Preferably a directory in your
$env:PSModulePath
so that the module will auto-load itself when running any of the exported functions. -
Determine the IP address of your plug using
Find-TPLinkSmartPlug
. -
Send a command to your unit. For example we can turn on the unit. Or Send the command using raw JSON.
Optional
The Send-TPLinkCommand
outputs a PSCustomObject with the respose. This is generated from the raw JSON response from the plug. This response can be placed in a variable and analyzed.
Click here to find a list of valid JSON commands the HS100 or HS110 will accept.
Big thanks to EgoManiac's TPLink-PoSH for the code base for this project. My goal with this was to: cleanup the code, convert this to module format, and give myself a project.