Tuesday, May 16, 2017

WanCam wireless camera HW0036

I made a mistake in getting this camera.  Despite it having the features it advertised, this camera is missing an RJ45 jack.  For security reasons I never buy a camera without a wired connection.



This camera does work correctly, however they made a couple of annoying design decisions when making this model.  First, the http port by default is 81 rather than the standard 80.  Second they also deviated from the standard OnVif ports and choose to use 10080 for this service; and it is not configurable.

It does not support https, which I consider a negative, although not horrible as I rarely use the web interface once configured.

Fortunately you can change the http port, and you can change the default password.  The camera works very well with Milestone.  As long as you only want wireless then this is a good camera, however because of that reason I would never recommend, or purchase another one.

EDIT: Within a week of owning this camera it began to have issues turning on.  A few days later the problem was so bad the camera no longer functioned.  It is possible that I simply got a lemon, or this particular model has a bad design flaw.  I was able to get a partial refund, threw the camera away, and will never get another of this model.

Monday, May 15, 2017

KanKun Wireless Plug

I recently purchased  a wireless KanKun plug, specifically because I heard that it was running a version of OpenWRT and could easily be modified.

I found the primary directions here.

There were a couple of challenges.  The first was getting the plug on the wireless network.  The Chinese directions and app did not function at all, and I tried them multiple times.

The good news is that the plug successfully resets all failed attempts very well with its reset process.  Eventually I was successful following these steps:

- Use a laptop to connect to the wireless network the plug defaults to creating.
- Lookup the Plugs IP based on the DHCP address assigned to the laptop because it did not create the network that most examples were claiming it would.
- Use Putty to SSH into the plug with a username of 'root'.  My default password was p9z34c, however others have claimed it might be admin or 1234.
- Edit the following file with 'vi': /etc/config/wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option channel '9'
        option hwmode '11ng'
        option path 'platform/ar933x_wmac'
        list ht_capab 'SHORT-GI-20'
        list ht_capab 'SHORT-GI-40'
        list ht_capab 'RX-STBC1'
        list ht_capab 'DSSS_CCK-40'
        option htmode 'HT20'
        option disabled '0'
        option country 'CN'

config wifi-iface
        option device 'radio0'
        option network 'wwan'
        option ssid 'MyWirelessSID'
        option encryption 'psk2'
        option mode 'sta'
        option key 'MyWirelessPassword'

I made sure the channel was set correctly since I run my wireless network on 9 rather than the standard 11.  I also struggled a bit with the encryption since I run WPA2 Personal; I finally got the very logical instructions to set encryption to 'psk2'.

- The second critical file to edit is: /etc/config/network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd59:45ed:8ead:0000:/48'

config interface 'lan'
        option ifname 'eth0'
        option force_link '1'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.145.253'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'
        option proto 'dhcp'
        option ifname 'eth1'

config interface 'wwan'
        option proto 'static'
        option ipaddr '192.168.1.32'
        option gateway '192.168.1.1'
        option netmask '255.255.255.0'

I modified the MAC address in this file, adding the '0000', however leaving it empty would probably have been fine as well from what others have said; and considering it was working prior.  Adding the last 'config interface wwan' section is the most critical.  It is used by the wireless file for interface settings and specifies the static IP network necessary to communicate on this network.

- 'reboot' the plug
- With the plug now successfully connecting to my network I was able to return to my main computer for further configuration.
- My next step was to copy in a simple CGI script someone created to allow me to remotely control the plug.  I did have to modify the following script slightly because my RELAY_CTRL was different from the ones they were using.
- I had to create the folder /www/cgi-bin
- And create the following file: /www/cgi-bin/relay.cgi

#!/bin/sh
echo "Content-Type: text/plain"
echo "Cache-Control: no-cache, must-revalidate"
echo "Expires: Sat, 26 Jul 1997 05:00:00 GMT"
echo

RELAY_CTRL=/sys/class/leds/i-konke\:red\:relay/brightness

case "$QUERY_STRING" in
state) 
case "`cat $RELAY_CTRL`" in
0) echo "OFF"
;;
1) echo "ON"
;;
esac
;;
on) 
echo 1 > $RELAY_CTRL
echo OK
;;
off) 
echo 0 > $RELAY_CTRL
echo OK
;;
esac

- Unfortunately I discovered that the uhttpd service did not exist on my plug.  I had to turn to a very helpful Internet community who was able to give me the required files.  You can download them here.
- Inside the rar file you should see a kkplug folder with the most likely folder structure and the files that go in each folder.  Use WinSCP to copy the files to the plug.
- Run the following command
/etc/init.d/uhttpd enable
- This creates a sym link that causes the plug to execute the startup file on boot.
- 'reboot' again to test and verify that the service will start correctly.

- When the plug comes up you should be able to use a web browser and control the plug in this way.
http://192.168.1.32/cgi-bin/relay.cgi?on