kankun-json CGI script

kankun-json is a CGI script to install on your Kankun Small K switch which gives it a JSONP API that can be used with the HomeDash dashboard.

Download kankun-json-0.0.1

Once you’ve downloaded the ZIP file above, unzip it. The file you need to copy to your Kankun switch is called json.cgi.

You can do this by opening the Terminal application on a Mac (or PuTTY on Windows), and doing the following steps, substituting the IP address for your own:

Note: The following assumes you’ve already done as much as shown in the Getting Started blog post.

1. Connect to the switch’s terminal

Connect via SSH:

ssh root@

You’ll then be prompted for the password you set in Getting Started.

You should now see something like this:

BusyBox v1.19.4 (2014-03-27 17:39:06 CST) built-in shell (ash)

Enter 'help' for a list of built-in commands.

_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
BARRIER BREAKER (Bleeding Edge, r39365)
* 1/2 oz Galliano Pour all ingredients into
* 4 oz cold Coffee an irish coffee mug filled
* 1 1/2 oz Dark Rum with crushed ice. Stir.
* 2 tsp. Creme de Cacao

2. Create a cgi-bin directory

We’ll need to create a special directory called cgi-bin. It must be named this way, as the switch’s web server knows how to treat it then.

mkdir /www/cgi-bin/

3. Copy the json.cgi file to the switch

From your computer, wherever you downloaded and unzipped kankun-json-0.0.1.zip to, run this command:

scp json.cgi root@

You’ll be prompted to enter your password, and the file will copy over.

4. Set permissions

Now you’ll need to connect to the switch over SSH again, and run the following command to set permissions on the json.cgi file correctly:

chmod -R 0755 /www/

5. Check everything worked

Now browse to the json.cgi file on your switch’s IP address in your browser (Safari, Google Chrome, Firefox, whatever you use):

You should see something like this:


You’re done installing kankun-json!

Want to control all your switches from a single web page? Visit My HomeDash.