HAL component for TP-Link HS110
Python Makefile
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
Makefile
README.md
hal_smartplug.py
test_hal_smartplug.py

README.md

HAL component for TP-Link HS100/HS110

This is a Machinekit HAL component for the TP-Link HS100/HS110 smart-plug. The HAL component uses the reverse engineered protocol en/decryption which is described at SoftCheck.

Installing the component

The HAL component can be installed to the machinekit installation using the following command, whereas <machinekit_dir> needs to be replaced with your actual machinekit installation folder. Without any additional arguments the component will be installed in /usr/bin/.

sudo make install MACHINEKIT_DIR=<machinekit_dir>

Using the component

The hal_smartplug component can be integrated into any HAL configuration with the following command:

Classic HAL:

loadusr ./hal_smartplug.py -n smartplug -e -a <ip_address>

HAL Python:

address = "10.0.0.8"
name = "smartplug"
smartplug = hal.loadusr('./hal_smartplug.py -n %s -e -a %s' % (name, address), wait_name=name)

To use the component with the HS100 (smart plug without power monitor) remove the optional argument -e from the command line.

The component has the following pins:

Component Pins:
  Comp   Inst Type  Dir         Value  Name                             Epsilon         Flags
    74        float OUT      0.015744  p.current                        0.000010        0
    74        bit   I/O         FALSE  p.enable                                         0
    74        float OUT         0.001  p.energy                         0.000010        0
    74        bit   OUT         FALSE  p.error                                          0
    74        float OUT             0  p.power                          0.000010        0
    74        float OUT      231.9359  p.voltage                        0.000010        0

Testing

To the test HAL component with your smartplug device you modify the ip address in the test_hal_smartplug.py and run make check. The Smartplug should toggle a few times.