Amcrest Connect Plug aka Kakun WiFi Smart Plug

More info on this plug here.
Android App to program these plugs WidgetKK for SmartPlug.
Default user root and password p9z34c. SSH is enabled by default. As it 
turns out Amcrest has someone else make this, KONKE Technology Co.
BusyBox v1.19.4 (2014-03-27 17:39:06 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _    _               _    _
 | | _-_| _____ _____  | | _-_| _____ ____
 |  -_-  |     ||     ||  -_-  |     ||    |
 | |-_   |  -  ||  |  || |-_   |  -__||   _|
 |  _ -_ |_____||__|__||  _ -_ |_____||__|  
 |_| -__|  S M A L L   |_| -__| S M A R T
 -----------------------------------------------------
 KONKE Technology Co., Ltd. All rights reserved.
 -----------------------------------------------------
  * www.konke.com            All other products and   
  * QQ:27412237              company names mentioned
  * 400-871-3766             may be the trademarks of
  * fae@konke.com            their respective owners.
 -----------------------------------------------------
root@koven:~# passwd
Changing password for root
New password: 
Retype password: 
Password for root changed by root
root@koven:/www/cgi-bin# cat /etc/openwrt_release
DISTRIB_ID="OpenWrt"
DISTRIB_RELEASE="Bleeding Edge"
DISTRIB_REVISION="r39365"
DISTRIB_CODENAME="barrier_breaker"
DISTRIB_TARGET="ar71xx/generic"
DISTRIB_DESCRIPTION="OpenWrt Barrier Breaker r39365"

I added an index.html in /www

I did find some information on building a web page to control this here.  I get an error as below. However if I grabbed the files from here and then upload them using WinSCP everything works fine. So this turns out to be caused by my cut and paste.

Unable to launch the requested CGI program:
  /www/cgi-bin/relay.cgi: Exec format error

My country was set to CN so I changed it to US.

To display current setting:
/sbin/uci get wireless.radio0.country

To set it (to US, for example):
/sbin/uci set wireless.radio0.country=US
/sbin/uci commit
reboot

I borrowed a script to test network connection and reboot if it drops.

vi network_test
if [ $? -ne 0 ]; then
/etc/init.d/network reload
fi

chmod +x network_test

I need to add this to cron.

I then built a webpage on my Raspberry Pi where I can display multiple switches and turn them all off and on from one location. Since I only have one switch right now its the same switch three times.

nano /var/www/html/index.html

I bought  a second plug off Amazon this time it was branded as JTD WiFi SmartPlug. Its the same plug on the inside running OpenWRT. I also used WidgetKK to push json.cgi and set the cronjob to power cycle if it loses Internet connection.

jtd_plug

LivingRoom 
Repeat three times once for each switch.

amcrest_buttons

I need to make some labels and the little light at the top goes off when the switch is off on when it is on.I got a WeMo switch today and it is about twice the size of the Amcrest, but the WeMo App is better developed.november-29-2016-at-0656pmTurn the lights on and off from the cli. The advantage to this is there is no outside contact required, I can script the lights to run in a cron job and have the lights on and off on a timer without using the app or having any sort of outside control.

#lights off
echo 0 > /sys/class/leds/tp-link\:blue\:relay/brightness
#lights on 
echo 1 > /sys/class/leds/tp-link\:blue\:relay/brightness
Advertisements
This entry was posted in Home Automation, Uncategorized. Bookmark the permalink.

6 Responses to Amcrest Connect Plug aka Kakun WiFi Smart Plug

  1. Pingback: Google Home Arrived | blog.smithjon.com

  2. Pingback: Samsung Smartthings Hub | blog.smithjon.com

  3. Dirk Blaze says:

    I get this error on my cgi script from Firefox:

    Unable to launch the requested CGI program:
    /www/cgi-bin/RelayOn.cgi: Exec format error

    Actually I get this error on any script I create. This one is really simple. Here’s what it is:

    root@koven:/www/cgi-bin# cat RelayOn.cgi
    echo 1 > /sys/class/leds/tp-link:blue:relay/brightness

    make sure its executable:
    root@koven:/www/cgi-bin# chmod +x /www/cgi-bin/RelayOn.cgi
    root@koven:/www/cgi-bin#

    run it on the board:
    root@koven:/www/cgi-bin# /www/cgi-bin/RelayOn.cgi
    root@koven:/www/cgi-bin#

    Relay is on!

    But get the above error from it and any cgi script I’ve created from the browser!!

    • misguidedute says:

      What code are you using and what are your permission settings on the file?
      ls -a
      Should give you the permissions. Also maybe try WidgetKK it will push files for you and set the correct permissions if it has the files you want.

  4. Dirk Blaze says:

    So putting these lines at the top of the script helps:
    #! /bin/sh
    echo “Content-type: text/plain”

    It works when I run it from Firefox now.
    Except I get this:
    Bad Gateway
    The process did not produce any response

  5. Dirk Blaze says:

    Fixed! This works:

    echo “Content-type: text/plain”
    echo “Cache-Control: no-cache, must-revalidate”
    echo “Expires: Sat, 26 Jul 1997 05:00:00 GMT”
    echo

    echo 1 > /sys/class/leds/tp-link:blue:relay/brightness

    echo “Relay On!”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s