Jochen Scheib

Read more posts by this author.

5 min read

The Edimax Smart Plug SP-2101W is a wifi-based smart plug to switch electric devices on and off. It also measures the power and energy consumption of the plugged in device.

Some smart developers have reversed engineered the REST protocol a while ago and we now have apis for a various of programming languages and of course for node-RED. I noticed that after some time the smart plug is no longer reachable and you have to reset it (plug out and in again). My first assumption was, that the wifi connection is not stable and the plug is not reconnecting, but this assumption was not confirmed.

So I did some more research an found out that it is related to the frequence and number of http requests to the smart plug. Maybe the web server logs?

I recently found out, that you can access the plug by telnet and I was able to confirm, that there is a log file /var/access.log which logs every request.

To enable telnet you have to do the following steps:

  1. Reset your smart plug to factory settings
  2. Connect your PC with the EdiPlug.Setup wifi
  3. Call the http://192.168.20.3:10000/tnb2, it should confirm with "OK"
  4. Now connect with a telnet client on 192.168.20.3 port 1355
  5. To enable telnet after the initial setup, call nvc set Device.Test.HiddenPage.Enable ON
  6. Now you can configure the device via the EdiPlug App
  7. After this call http://192.168.20.3:10000/tnb2 and connect over telnet 192.168.20.3 port 1355 and have some fun.

Interesting tools:

Usage: nvc [command] [NAME] [VALUE]
command:
        set <NAME> <VALUE>      Set VALUE to NAME
        get <NAME>              Get value by NAME
        unset <NAME>            Unset value by NAME
        ms <NAME> <VALUE 1> <VALUE 2> ... <VALUE n>     Set column
        mg <NAME>               Get row
        mu <NAME>               Unset table
        all                     Show all values
        default [default file]  Restore default values
Usage: elecc [command] [NAME] [VALUE]
command:
        get_now
        notify
        read_budget
        get_history <TYPE> <START_TIME> <END_TIME>
        read_budget <CLEAR_CONTROL> <CLEAR_NOTIFY>
                get <TYPE> history energy from <START_TIME> to <END_TIME>
                where: <TYPE> can be HOUR/DAY/MONTH
usage: ledctl LED <led_id> <action> [args]
  where: <led_id> can be POWER|2G|RESET
         <action> can be ON|OFF|BLINK
         [args] MUST BE specified for BLINK
         ex. ledctl POWER BLINK <times on> <times off>
       ledctl GPIO <r|w> <gpio num> <value>
       ledctl SWITCH <ON|OFF>

Volumes

dev:    size   erasesize  name
mtd0: 00030000 00010000 "Bootloader"
mtd1: 00010000 00010000 "Config"
mtd2: 00010000 00010000 "Factory"
mtd3: 000c0000 00010000 "Kernel"
mtd4: 00220000 00010000 "RootFS"
mtd5: 00050000 00010000 "elecdata0"
mtd6: 00050000 00010000 "elecdata1"
mtd7: 00020000 00010000 "nvram"
mtd8: 00010000 00010000 "hwconfig"
mtd9: 002e0000 00010000 "Uimage"

A list of values:

# nvc all
Device.LAN.2G.Repeater.Band=BGN
Device.System.RemoteManagement.Enable=ON
Run.WAN.Interface=apcli0
Run.Device.System.Power.NowPower=0
Run.FW.Version=1.03
Device.WAN.Mode=DHCP
Device.LAN.2G.CTS=Auto
Device.System.Power.OverCurrent.UpperLimit=16
Device.WAN.Static.MTU=1454
Run.Device.System.Power.Schedule.Support=1
Device.System.RemoteManagement.IPAddress=
Run.Device.System.Power.NowEnergy.Week=0.000
Device.System.Power.Budget.Week.Notify=OFF
Device.System.TimeZone.Zone=23
Device.System.FwUpgrade.Enable=ON
Device.Firewall.Enable=OFF
Device.System.Power.Budget.Month.UpperLimit=0
Device.WAN.IPV6.Enable=ON
Device.System.TimeZone.Daylight.Enable=ON
Device.LAN.2G.NFixRate=Auto
Device.System.Password.Name=admin
Run.LAN.MAC.Address=801F02FA5FF2
Device.WAN.DHCPClient.MTU=1454
Device.LAN.2G.NChannelWidth=20
Device.System.FwUpgrade.Notification.Enable=ON
Device.LAN.NetMask=255.255.255.0
Device.LAN.2G.0.Security.WPAPSK.Key=11111111
Run.WAN.MAC.Address=000A8A20bd01
Run.Device.System.FwUpgrade.Support=1
HW.CountryCode=EU
Device.WAN.Static.DNS1=
Device.Configuration.HW.ModelName=SP2101W
Device.WAN.Static.DNS2=
Device.LAN.2G.0.MACAC.Num=0
Device.LAN.2G.Repeater.Security.WPAPSK.Key=wpakey
Device.System.Power.OverCurrent.MaxUpperLimit=16
Device.System.Power.Budget.Day.UpperLimit=0
Run.meth0=eth2
Device.LAN.2G.APMode=LiteRepeater
Device.System.Power.OverPower.UpperLimit=3680
Device.NAT.UPNP.Enable=ON
Device.LAN.2G.Repeater.Channel=11
Run.WAN.Gateway=192.168.80.1
Device.System.TimeZone.Server.Address.0=pool.ntp.org
Device.LAN.2G.WPS.ConfigType=Configured
Run.Device.System.Power.LastToggleTime=20160718094006
Device.System.TimeZone.Server.Address.1=europe.pool.ntp.org
Device.System.TimeZone.Server.Address.2=oceania.pool.ntp.org
Device.System.TimeZone.Server.Address.3=north-america.pool.ntp.org
Device.System.TimeZone.Server.Address.4=south-america.pool.ntp.org
Device.System.Power.Report.Energy.Month.Notify=OFF
Device.System.Internet.Check.Port=80
Device.LAN.2G.Repeater.MAC.Address=3431C4D8C8CC
Device.LAN.DHCPServer.Start=192.168.20.100
Run.Model=SP2101W
Device.LAN.2G.FragThreshold=2346
Device.NAT.VirtualServer.Enable=OFF
Run.WAN.DNS=192.168.80.1
Device.LAN.DHCPServer.End=192.168.20.200
Device.System.RemoteManagement.Port=
Device.LAN.2G.0.Security.WPAPSK.PSKFormat=Passphrase
Device.System.Power.Budget.Month.Enable=OFF
Device.System.Power.Report.Energy.Day.Notify=OFF
Device.System.Power.OverPower.MaxUpperLimit=3680
Device.System.HiddenPage.Enable=OFF
Device.LAN.2G.Repeater.Security.WPAPSK.PSKFormat=Passphrase
Run.br0=br0
Device.System.Power.Toggle.Notify=OFF
Device.System.FwUpgrade.Time=Auto
Device.System.Internet.Check.Address=www.google.com
Device.LAN.2G.0.Security.WPAPSK.CipherSuite=WPA2AES
Device.System.Power.Budget.Mode=ENERGY
Device.LAN.2G.Enable=ON
Device.LAN.DHCPClient.Enable=OFF
Device.LAN.2G.Repeater.Security.WPAPSK.CipherSuite=WPA2AES
Device.NAT.PortForward.Enable=OFF
Device.Configuration.SW.APRTSwitch=AP
Device.LAN.2G.Coexist.Enable=ON
Device.System.Power.Budget.UnitPrice=0
Device.System.Power.Budget.Day.Enable=OFF
Device.WAN.Static.IPAddress=172.1.1.1
Device.Test.HiddenPage.Enable=ON
HW.RegionDomain=1
Device.LAN.DHCPServer.Enable=ON
Run.Cus=Edimax
Device.WAN.DHCPClient.DNS.Enable=Auto
Device.WAN.Ping.Enable=OFF
Device.LAN.2G.0.Security.Mode=Disable
Device.LAN.Client.Mode=DHCP
Run.Device.System.Power.NowEnergy.Month=0.000
Device.LAN.2G.Repeater.Security.Mode=WPAPSK
Run.BackUp.MAC=000A8A796c00
Device.System.Power.Budget.Month.Notify=OFF
HW.LAN.MAC.Address=801F02FA5FF2
Device.LAN.2G.WPS.Enable=OFF
HW.LAN.2G.0.MAC.Address=801F02FA5FF3
Device.WAN.DynIP.HostName=
Run.w2c0=apcli0
Run.w2d0=wds0
Device.LAN.2G.Band=BGN
Run.w2d1=wds1
Run.w2d2=wds2
Run.w5c0=apclii0
Run.w5d0=wdsi0
Run.w2d3=wds3
Run.w2g0=ra0
HW.WAN.MAC.Address=000A8A20bd01
Run.w5d1=wdsi1
Run.w2g1=ra1
Run.w5d2=wdsi2
Run.w2g2=ra2
Run.w5d3=wdsi3
Run.w5g0=rai0
Run.w2g3=ra3
Device.LAN.2G.0.HideSSID.Enable=OFF
HW.LAN.2G.MSSID.Mode=PREVIOUS
Device.System.Power.Budget.Week.UpperLimit=0
Run.Device.System.Power.NowEnergy.Day=0.000
Device.LAN.Client.ConnTest.Enable=OFF
Device.System.Name=Pumpe
Device.System.Power.Budget.Day.Notify=OFF
Device.QoS.Download.Bandwidth=
Device.LAN.2G.BeaconInterval=100
Device.LAN.2G.0.MACAC.Enabled=OFF
Device.System.Cloud.Server.Address=www.myedimax.com
Run.LAN.Client.MAC.Address=801F02FA5FF3
Run.Device.System.Power.Budget.ControlMask=0
Device.LAN.2G.DTIMPeriod=3
Device.LAN.DHCPServer.LeaseTime=31536000
Device.LAN.2G.0.SSID=EdiPlug.Setup
Device.LAN.2G.Repeater.SSID=gallien
Run.Device.System.Power.NextToggle=-1
Run.LAN.IPAddress=192.168.20.3
Run.Device.System.Power.State=OFF
Run.Device.System.Power.Manual.Flag=ON
Run.lan0=eth2.1
Device.LAN.2G.RTSThreshold=2347
Device.LAN.2G.0.Enable=ON
Device.LAN.2G.1.Enable=OFF
Device.LAN.5G.0.Enable=OFF
Run.WAN.IPAddress=192.168.80.26
Device.System.Power.Report.Energy.Week.Notify=OFF
Device.NAT.Enable=OFF
Device.WAN.Static.NetMask=255.255.255.0
Run.wan0=eth2.2
Run.wan1=eth2.2
Run.Device.System.Power.NowCurrent=0
Device.LAN.2G.FixRate=Auto
Device.QoS.Upload.Bandwidth=
Device.LAN.IPAddress=192.168.20.3
Device.QOS.Enable=OFF
Device.LAN.2G.TXPower=100
Device.LAN.2G.Channel=Auto
Run.APMode.Enable=OFF
Device.System.Power.Budget.Week.Enable=OFF
Device.LAN.2G.0.WMM.Enable=ON
Device.LAN.2G.PreambleType=Short
Device.WAN.Static.Gateway=172.1.1.254
Device.Configuration.KernelMessage.Enabled=ON
Device.LAN.DHCPServer.NetMask=255.255.255.0
Run.Device.System.SMTP.Support=1
Device.System.Password.Password=password
Run.WAN.Mask=255.255.255.0