Sonoff Smart Switch LAN Control without Internet

Found of Sonoff WiFi Smart Switches to control your home appliances? Ever you feel it little slow to respond? or Lost control of your smart switches due to problem into your internet connection? or curious about your home security when it comes to expose your devices to internet, even though communication between your device and itead servers is encrypted?

Well here is a little work around to overcome all above concerns. Burn our ESPMetRED or any other open source firmware into your Sonoff Smart Switches and enjoy controlling your device locally without internet connection.

Background:

Basically Sonoff Smart Switch are connected to cloud servers linked to your account registered with it. eWeLink application which is connected to cloud servers, controls all Sonoff devices linked to your account. When We control our Sonoff devices locally, We require a server You  will be connected to NodeRed installed in Raspberry Pi using WiFi router and all communication will be accomplished by MQTT broker. Switching command is published by your smart phone or computer on a specific topic which will be routed to all Sonoff Units subscribed to that specific topic by NodeRed and device is switched ON or OFF depending on your command. Now you will control your Sonoff devices via Web interface or other third party apps but cannot use your eWeLink to contril your Sonoff device.

Hardware Requirements:

Software Requirements:

Step-by-Step Procedure:

Step A:

Our LAN Server comprises a Raspberry Pi 3 | Raspberry Pi Zero W, a mini computer running a Linux Operating System i.e. Raspbian (Latest version is Raspbian Stretch). In Raspberry Pi, operating system is installed in a Micro SD Card which is used to boot it up. Prepare your Micro SD Card according to Raspbian Stretch Headless Setup on Raspberry Pi Zero, Zero W, Pi 3. Now our mini computer is ready to use. Let’s install few other software applications.

Step B:

Our brain, Node-RED is a programming tool for wiring together hardware devices. To install Node-Red, visit Complete Guide to Home Automation. Node-Red is pre-installed with a collection of Nodes used for various functionalities. As We are concerned about IOT (Internet of Things) and Dashboard is the heart of IOT to control various devices using graphical user interface. Let’s install Node-Red Dashboard node which does not come pre-installed with Node-Red.

Our Smart Devices will communicate with our server using MQTT protocol, so next We are required to install Mosquitto MQTT Broker, just follow the steps of Installing secure Mosquitto broker on Raspberry Pi with Raspbian Jessie or Stretch along with systemd start up.

Install Samba File Server by following Password Protected Raspberry Pi File Server – Samba and NGINX Web Server by adopting the procedure given under Complete Guide to Home Automation. Over the Air Update (OTA) is an optional but important part of IOT to update our software inside our Sonoff Smart Devices without attaching them to our computer. Both Samba and NGINX will be used for Over the Air Updates of our Sonoff Smart devices.

Step C:

Install Arduino IDE, an open-source Arduino Software (IDE) makes it easy to write code and upload it to the development boards, and Arduino IDE Plugin for ESP8266 by following ESP8266 Basic Setup and Program using Arduino IDE. Follow our guide ESPMetRED an Arduino IDE compatible library to communicate ESP8266 and Node-Red via MQTT to download and install ESPMetRED Libruary along with other dependencies required to accomplish successful communication between Sonoff Smart Device and our LAN Server.

Step D:

Disconnect your Sonoff Smart Switch from AC Power line. Now real fun begins. Follow the links below specific for each of Sonoff Smart Switch to connect it with your PC and start it in programming mode for installing our opensource firmware.

Step E:

Now We’ll wire our nodes in Node-Red to communicate Sonoff Smart Switch with our Server and Graphical User Interface. Power Sonoff Smart Switch up using AC source. Open your favourite web browser and visit your server IP address on 1880 port i.e. http://192.168.50.30:1880.

WORK IN PROGRESS… STAY TUNED!!

Leave a Reply

Your email address will not be published. Required fields are marked *

All orders confirmed by 3:00 PM will be shipped on same day. Estimated delivery time is 24-48 hrs. Dismiss