Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. General Discussion
  3. Sonoff, how it works?

Sonoff, how it works?

Scheduled Pinned Locked Moved General Discussion
7 Posts 7 Posters 2.2k Views 7 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mhmd
    wrote on last edited by
    #1

    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?

    alexsh1A Heinz-Josef GodeH C 3 Replies Last reply
    0
    • electrikE Offline
      electrikE Offline
      electrik
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tsjoender
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        1
        • M mhmd

          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?

          alexsh1A Offline
          alexsh1A Offline
          alexsh1
          wrote on last edited by
          #4

          @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:

          https://rutg3r.com/sonoff-firmware-tutorial-to-esp-easy/

          1 Reply Last reply
          1
          • dbemowskD Offline
            dbemowskD Offline
            dbemowsk
            wrote on last edited by
            #5

            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/

            Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
            Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

            1 Reply Last reply
            0
            • M mhmd

              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?

              Heinz-Josef GodeH Offline
              Heinz-Josef GodeH Offline
              Heinz-Josef Gode
              wrote on last edited by
              #6

              @mhmd

              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.

              1 Reply Last reply
              0
              • M mhmd

                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?

                C Offline
                C Offline
                Craig Thom
                wrote on last edited by
                #7

                @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.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                23

                Online

                11.7k

                Users

                11.2k

                Topics

                113.1k

                Posts


                Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • MySensors
                • OpenHardware.io
                • Categories
                • Recent
                • Tags
                • Popular