TP-link device control through local web requests

I got annoyed that I couldn’t tie all the tp-link bulbs and plugs into my vera so I decided to do something about it. I wrote a perl module that I threw on my pi3 which does the socket communication directly to the devices; no TP-link middleman. Add in the cgi script and all you need is something that can make a get request and suddenly we’re tied in.

Follow the instructions on the github page and lua such as this:
local http = require(‘socket.http’)
local result = http.request “

…will turn your plug on. Note the user/password: not required, but I strongly recommend you set it up on your web server or restrict access to local only. Many more commands available. While anyone can use this I’m a vera owner so I want to tailor it to our needs so I welcome feed back on the return format that works best for lua processing.