Controlling a WiFi smart plug with the Raspberry Pi

Conclusion

Thanks to the Raspberry Pi, you can use the Edimax SP1101W without monitoring and control by the manufacturer. This precaution is not just the result of a healthy mistrust: Time and again a manufacturer turns off a cloud service without forewarning its participants, leaving you high and dry with hardware that has lost its functionality. The Rasp Pi in this project protects your investment in a smart plug.

If you want to control the plug remotely, you can use the smartphone app. An alternative would be to send a text message to the Raspberry Pi. Communicating directly with the smart plug via a port open to the Internet is not a good idea, because communication is not encrypted. A VPN server for the local network could possibly provide additional security.

The smart plug is not well suited for the originally intended use case of wake on RTC, because a time period of one week is too short. However, as long as the Raspberry Pi boots at least once a week, this is not really a limitation.

One question remains: Is it worth the effort to set up the plug as described? The smart plug pulls 1W of power when turned off and 2W during operation, and conceivably, the effect depends on precision (e.g., 1.4W, 1.6W). Still, the plug's power consumption has an effect.

The procedure described here is not worth the effort for the Rasp Pi alone; therefore, you must decide on the basis of power consumption by connected peripherals. When something is mounted on the active hub of the Rasp Pi, along with a hard drive and DVB stick, consumption increases several fold over the 2W used by the plug itself.

Unfortunately, access to the smart plug operating system is not open. Although the integrated computer apparently has enough performance for the small but capable Lighttpd, open software would surely make it possible to delegate more tasks directly to the smart plug, even if they deal only with administration of switch times of more than one week ahead.

Infos

  1. "Home Automation" by Marc Staller, Raspberry Pi Geek, issue 7, 2014, pg. 50, http://www.raspberry-pi-geek.com/Archive/2014/07/Automating-the-home-with-the-Raspberry-Pi
  2. Code for this article: ftp://ftp.linux-magazine.com/pub/listings/raspberry-pi-geek.com/17
  3. Simple Python code to control the plug: https://gist.github.com/wendlers/a5fc0bf06bbe656c7291
  4. Controlling Edimax plugs with C#: https://github.com/contrequarte/SmartPlugSP2101W
  5. Python library for Edimax plugs: https://github.com/bablokb/ediplug

The Author

Bernhard Bablok works at Allianz Managed Operations & Services SE as a SAP HR developer. He enjoys listening to music, biking, and hiking. He also likes working with everything to do with Linux, programming, and – lately – SBCs. He can be contaced at mail@bablokb.de.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content