Start a new topic

Local, LAN control

Last week I lost control over my house, for 12 hours, because something went wrong with iTead systems.

Sonoff devices device works flawlessly per se, and I'm very happy to have 13 of them around my house.


I'm beginning to think there's a glitch in their marketing model. I haven't thought for a moment that they want to spy on us, like some else implied in this forum, but every serious usage require redundancy and backup.

We cannot rely on the whole "cloud" model to be always working: too many things can go wrong on the user side, on itead side and, eventually, on the side of the many third party service providers involved (ISPs and Cloud providers above all).

Every digital and/or networking system might stop working every now and then. While we can surely afford not to remotely switch on a light, what about water heating, house heating, door opening, surveillance systems?

I did my best to build redundancy in my installations, but there are two factors that are not easily overcame.

First, some sonoff device might be (and in my case are) difficult to be physically reached: inside walls or up near the ceiling, the onboard switch is almost useless in these cases.

Second, Dual sonoff aren't capable of manually switching the connected devices on/off: if the system isn't working (i.e. they are offline), the only possible solution is to uninstall them, which is not acceptable at all.

iTead (and coolkit) seem to be trying to sell their solution to third parties (other manufacturers who are supposed to relay onto their whole solution, cloud included) which is cool. If I had to, I would guess that's why they are so "cloud-centered": to offer a easy and rapid solution, all included. It's cool. 

But other than toyish usages, without redundancy their solution is unimplementable: I hope they realize this soon (if they haven't already).

The solution that comes to mind is very simple, and a few have already suggested it here: a dual control system. The cloud is great for remote control, but when the app is on the same local network the sonoff devices are, everything should switch to local. Simply put: automatic switching to LAN control.

If I'm home, I should be able to control my devices even if my Internet connection is down.

If they could do this with an open protocol, that would be top. But after all, not everyone of us wants to build his/her own system: I'm cool with their app, they can keep their protocol reserved as much as they want. To me, the only thing that matters is that I don't ever lose control over my house again.

Other than the above, thank you iTead, I'm very happy with your products!

What do you think?

86 people like this idea

Visit our Guide Domoticz Tasmota: Control Sonoff without Internet. It covers all expects of local controlling a Sonoff devices including video demonstrations. 

@prem raj There is no reason for multiple channels not to be available. Just read the description of the firmware for that item. As there are multiple options of firmware just be selective. Yes, you can flash the bridge. I was going to myself, but mine broke and Sonoff are being typically useless at replacing it. No reason for a device to lose RF sensing ability; just read the firmware description before uploading it. In-fact someone even added a second temperature sensor to a Th etc. The takeaway point is read the description of the firmware before uploading it and check it is for the correct device. @waqas I don’t think it is the software aspect that people will find off-putting. It is opening the devices, probably voiding the warranty, soldering the pins onto the PCB, connecting the USB serial device and then flashing. Given the extreme flakiness of the Sonoff/ewelink/Itead servers they need to make it easy to upload third party firmware OTA.

2 people like this
Is the lan feature "operation notification from hardware...." in settings????

@EB - thank you!

Nova atualização eWeLinK! com opção de Enable Lan! Ja esta disponivel.

Still waiting on local control like Local MQTT and COAP to be enabled in firmware. There's an alternative Sonoff killer Im exploring now too called: Shelly1, which might be worth a look. It has a good REST API too. Enabling MQTT publishing via REST calls. Seems interesting...

Hai paura di rimanere col tuo Sonoff senza internet e non poter accendere e spegnere i tuoi dispositivi ? Scopri come fare con la modalità LAN grazie alla mia guida completa.

Sonoff senza internet: modalità LAN guida completa

It seems like you don´t know how to write a LAN controller. So let me explain.
You have "hosts", with ip-addresses like which is "loopback". See the file /etc/hosts in Linux and Mac. They have in old days something similar on Windows. Then you have "/etc/services" -
smtp 25/udp # Simple Mail Transfer

smtp 25/tcp # Simple Mail Transfer

Service 25 is "mail transfer" .
You make a connection like this:


#include <sys/socket.h>
#include <netinet/in.h>

int main( argc, argv )
int argc;
char *argv[];
        int  sd , len;
        struct sockaddr_in saddr;
        memset(&saddr, 0, size(saddr));
         saddr.sa_family  = AF_INET;
        sd = socket(SOCK_STREAM,(int *)0;& saddr,(int)0);
        saddr.sin_port   = getServbyname("Seabas");
        saddr.sin_addr   = gethostbyname("localhost");

  .. and when the code is waiting in connect()" you can make a "netstat -a" and find it in the state "LISTEN".


            len = read(sd,message,sizeof(buffer));

 This will make a LAN server wait for any message to come on the "connect()" port.


            len = write(sd,message,sizeof(buffer));

 Is the way to send a message on the same "socket".


            len = close(sd));

 Is the way to end the connection and take it all down. This is the Linux / Unix / Mac simple way, and I know that it is not this easy on Windows, but I don´t care. Now use "netstat -a" on your router and find the service number that that they use, the IP address - and just make an "server" for it all at home.  Use Wireshark if needed to trap the messages - if they do not know, don´t argue,  just do it. Start with a message dispatcher that intercepts it all, and reroutes whatever you don't care about, but trap and handle what your server will handle. Intercept values and keep your own statistics.
This is not difficult, but so easy that nobody coming from Windows believes it. The messages are read() as a stream of bytes, they have a header and a body and you have to intercept the messages and decode the content and if the do not publish the structure of the header, they may end up loosing control of their own source code - when others make code that is better than them, they have lost that right.

I had assumed communication had some encryption using a key shared between their servers and the devices to stop man in the middle attacks, so I hadn’t considered trying to jump in there. Have you actually tried this basic approach? I have never had more than 0 devices connected over LAN using the app. Has anyone?

I not have any devices connect to the LAN, but i am very insteresting in this cuestion

Your thermostat and switches are on the net - your "LAN" with IP addresses like or - just take a look at "address leases" and the app on the phone.  Your app access a global site that they are registered on - your "Home" is known to this server that then knows the IP address of th thermostats and switches. Google, Apple and Amazon makes these global servers available to allow software to be developed on the mobile that can access the devices. 
So buy a lightbulb that is controlled on WLAN, a camera, switches and plugs and you will soon be able to control them all from your mobile. You can also buy voice assistants that allows you to speak to them and turn the light on and off. We discuss how to code the software, how to make code that can control them all.

According to eWelink user's guide, there are 2 conditions in order to see a device connected to your LAN:


So just unplug the LAN cable from your WiFi router, wait a little bit for device to go off line and then press Erable LAN in app settings.


1 person likes this

Please do not burst into the discussion. There are  too many people here, and nobody seems to know anything. Network is not magic, it is not prayer.  If you need connections to a remote server, all these must be names "" - and best also with IP addresses on the /etc/hosts" format.

No name, no server and impossible to integrate with. With server name, I can map that to any IP address, including my own Google Home device, and repackage it to work with others. If the power is on, light is on, the network is on, it may still work,  but it must relate to the correct settings in DNS. 

I believe that some of their devices are controllable locally or  through LAN some of them is the SLAMPHER.  This is a tricontrollable device:  via cloud, LAN, or through 433 RF. I use two  of these devices, and I believe their RF switches work too like the RF Basic although I haven't used them, their smart  plugs work two offline  LAN, I saw them in their product list, the table lists their devices that are controllable by LAN (without internet connection) although I don't know if their timers will work.

I bought a  4CH Pro and am waiting for the 4CH (original version) to be delivered in  my home. I bought the Pro so that I can use an RF remote to control to control.  

Login or Signup to post a comment