Sonoff, how it works?
-
I have sonoff device used to on/off the light. I have installed and configured it through ewelink. All works fine .i just want to know how the cloud server is able to reach my sonoff device over internet although it doesn't have a public IP? I understand that the sonoff device is using http post and get requests to reach the server for status update and query as the server has public ip..etc. but don't understand how the cloud server is sending commands (on/off) to the sonoff device despit it doesn't have a public ip? So how the server is reaching the device over internet?
-
Perhaps the local IP of the sonoff is stored in the cloud service, than that is used from the app to control the sonoff locally.
Are you still able to control it when you have no internet connection?I use tasmota on my sonoffs. That is completely transparent and doesn't send any data over the internet, just locally
-
I would expect there to be two options: Either the Sonoff connects to the Ewelink cloud service and polls if there are actions to be taken. So the actions are not sent directly to the Sonoff unit, but the Sonoff reads at some point something needs to be done.
Another approach would be that a tunnel of some kind is initiated by the Sonoff. The Ewelink service then sends commands back through this tunnel.
-
@mhmd I never bothered to discover how original Sonoff firmware works. The whole idea that my home is managed via a remote Chinese server is just not appealing to me.
Plus nobody in the DIY community using a native Sonoff app. The whole idea to buy Sonoff is to hack it.I have several Sonoff relays and I am using ESP Easy (Let's control it) firmware:
-
I too use Sonoffs and use the ESP Easy firmware that @alexsh1 uses. I wrote a BLOG post some time back on how to install and configure it for use with a Vera home controller. https://dan.bemowski.info/2017/07/04/using-a-sonoff-with-espeasy-and-vera/
-
Please see https://blog.ipsumdomus.com/sonoff-switch-complete-hack-without-firmware-upgrade-1b2d6632c01 for a description on what the sonoff uses to cimmunicate with the chinese cloud.
On initial setup you just integrate the sonoff in your WLAN and then it communicates with the chinese cloud. The ewlink also communicates with the chinese cloud and status and other commands are stored and forwarded by the cloud to/from your sonoff device.
-
@mhmd It's a function of your router's network address translation (NAT). It's the same way your browser can get push notifications (as from this forum).
When your Sonoff device communicates with the Chinese server, your router uses a different port number and stores that info. When traffic comes in to your external IP address with that port number the router knows which internal IP address and port to send it to.
You can read more about NAT elsewhere.
The bottom line is that the Chinese server isn't getting special access to your network and doesn't know your local IP address.
Suggested Topics
-
Update RF24 library to latest version
Bug Reports • 23 Mar 2014, 23:37 • andriej 24 Mar 2014, 22:52 -
Which device I have to use to connect with accelerometer before connecting to my pc?
General Discussion • 24 Jan 2023, 17:16 • Yada Kijsathan 29 days ago -
is this project dead?
General Discussion • 4 days ago • perfectom 4 days ago -
Meet in Malmö, Summer 2016?
General Discussion • 1 Feb 2016, 15:34 • bjacobse 4 Mar 2025, 00:29 -
Email notifications received twice
General Discussion • 6 Feb 2023, 16:15 • Jodaille 18 days ago -
Why is the output of ACS712 current measurement module unchanged?
General Discussion • 19 Jul 2021, 09:09 • Tessie T 16 days ago