A CGI script that provides a simple web interface and RESTful JSON API for the Kankun Small K wifi switch.
This project is a fork of Konstantin Dondoshanskiy's relay.cgi
script.
/www/
directory on your Kankun switch.0755
on cgi-bin
files for the API to function correctly).switches.json
file to use the IP addresses and labels appropriate for your switches.Visit the IP address of your switch in your web browser:
http://10.0.0.10/
This should show you information about the switches, and allow you to control them.
e.g. You can see how to turn the switch on / off, or set delayed on / off.
Output from the base end-point, http://10.0.0.10/cgi-bin/json.cgi
. (Shown pretty-printed for legibility.)
{
"info": {
"name": "kankun-json",
"version": "0.0.3",
"ipAddress": "10.0.0.10",
"macaddr": "00:15:61:f2:83:57",
"ssid": "ireadyourmail",
"channel": "11",
"signal": "-83",
"timezone": "EST-10EST,M10.1.0,M4.1.0/3",
"uptime": "2:41"
},
"links": {
"meta": {
"state": "http://10.0.0.10/cgi-bin/json.cgi?get=state",
"timing": "http://10.0.0.10/cgi-bin/json.cgi?get=timing"
},
"actions": {
"on": "http://10.0.0.10/cgi-bin/json.cgi?set=on",
"off": "http://10.0.0.10/cgi-bin/json.cgi?set=off"
}
}
}
If you'd like to contribute to the development of kankun-json, please review the guidelines for contributing.