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. Hardware
  3. Looking for detailed description for hacking a sonoff

Looking for detailed description for hacking a sonoff

Scheduled Pinned Locked Moved Hardware
45 Posts 12 Posters 49.3k Views 15 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.
  • TheoLT Offline
    TheoLT Offline
    TheoL
    Contest Winner
    wrote on last edited by
    #1

    One of the prices of the contest is a Sonoff. I really love the size of it. I've tried it and it works great.

    What I'm not fond if, is the fact that the state and the logic are being stored on a website. I just like to keep things like that in my home.

    I saw some articles that you can mod the sonoff to an mqtt device. But I've never worked with the ESP so I'm looking for a detailed step by step article to modifiy the sonoff.

    B.t.w. nice gadget for a really low price ;-)

    1 Reply Last reply
    0
    • hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by
      #2

      Couldn't your just upload a regular MySensors gateway sketch to it? Controlling whatever pin they use for the relay?

      1 Reply Last reply
      0
      • will hW Offline
        will hW Offline
        will h
        wrote on last edited by
        #3

        This article shows you how to connect an FTDI to the sonoff

        http://tech.scargill.net/itead-slampher-and-sonoff/

        From there, I think this tutorial will get you going

        https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/using-nodemcu-lua

        leading well into this project on Github, which, I think, is what you were referring to for MQTT on the Sonoff (all of this, of course, removes the original cloud functionality)

        https://github.com/elric91/nodemcu_sonoff

        1 Reply Last reply
        1
        • will hW Offline
          will hW Offline
          will h
          wrote on last edited by will h
          #4

          And then there is this:

          https://community.smartthings.com/t/release-sonoff-5-wifi-switch-device-handler/45957

          Would get you going pretty quickly (the FTDI explanation is a little more clear that the earlier link with the picture)

          I haven't yet made a MySensors node with an ESP, but it's doable

          http://forum.mysensors.org/topic/3583/mysensors-on-esp8266-esp01/4

          1 Reply Last reply
          0
          • will hW Offline
            will hW Offline
            will h
            wrote on last edited by
            #5

            Last one

            http://benlo.com/esp8266/esp8266QuickStart.html

            1 Reply Last reply
            0
            • alexsh1A Offline
              alexsh1A Offline
              alexsh1
              wrote on last edited by
              #6

              @TheoL I have just uploaded ESPEasy R78 stable firmware. It works really well on existing WiFi with Domoticz. The biggest advantage of it as a remote relay is that it reports its status to the virtual sensor in Domoticz. This is something z-wave devices do and something I've been missing with MySensors.

              @hek I think the memory is only 1Mb (Wemos D1 mini - 4Mb) and I am not sure it would be enough for the GW (with signing and other stuff).

              Price wise though this cannot beaten ($7 for the RF + ESP8266 version)

              1 Reply Last reply
              0
              • Mark SwiftM Offline
                Mark SwiftM Offline
                Mark Swift
                wrote on last edited by
                #7

                How could we make this a MySensors node?

                alexsh1A 1 Reply Last reply
                0
                • Mark SwiftM Mark Swift

                  How could we make this a MySensors node?

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

                  @Mark-Swift I do not think you can.
                  IMHO one needs to (a) upgrade EEPROM. This is doable but very tricky the flash chip is in a place not easily accessible by a soldering iron
                  (b) given that it is based on ESP, connect nrf24l01+ to it. Please see below how FTDI is connected - I think the same way you can connect Arduino Pro mini. I do not think you can connect nrf24l01+ directly as the GPIO number is limited (c) come up with a sketch for ESP8266 as a node.

                  0_1476781881612_image.jpeg

                  In my view this is just not worth the effort.

                  1 Reply Last reply
                  0
                  • hekH Offline
                    hekH Offline
                    hek
                    Admin
                    wrote on last edited by
                    #9

                    @alexsh1

                    Couldn't you just run the MySensors ESP gateway on it (presenting it as a binary switch)?

                    alexsh1A 1 Reply Last reply
                    0
                    • hekH hek

                      @alexsh1

                      Couldn't you just run the MySensors ESP gateway on it (presenting it as a binary switch)?

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

                      @hek two issues with your proposal:

                      1. ESP-12 which is used for MySensors ESP GW has got more GPIOs and 4Mb memory. Sonoff has a limited number of GPIOs and 1Mb memory marginally better than ESP-01. This can be upgraded, but not easy. I can do SMT, but here is a challenge. See below

                      0_1476782323575_image.jpeg

                      1. connect nrf24l01+ - I did not figure out how to do that given that GPIOs are limited. Sure Arduino can be connected, but it is not the same
                      1 Reply Last reply
                      0
                      • alexsh1A Offline
                        alexsh1A Offline
                        alexsh1
                        wrote on last edited by
                        #11

                        A better photo for your understanding.
                        I know some people upgraded the chip, but the board got really messy. I do not think I can stick my fan into it - too many plastic components which will start melting.

                        0_1476782548742_image.jpeg

                        1 Reply Last reply
                        0
                        • hekH Offline
                          hekH Offline
                          hek
                          Admin
                          wrote on last edited by
                          #12

                          I mean skip the NRF2401.. just run it as a standalone gw/node.

                          alexsh1A 1 Reply Last reply
                          0
                          • hekH hek

                            I mean skip the NRF2401.. just run it as a standalone gw/node.

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

                            @hek in this case it is doable. Not sure if 1mb Is enough though

                            peterscargillP 1 Reply Last reply
                            0
                            • FotoFieberF Offline
                              FotoFieberF Offline
                              FotoFieber
                              Hardware Contributor
                              wrote on last edited by
                              #14

                              I hacked a sonoff dual:
                              https://itead.freshdesk.com/support/discussions/topics/11000006870

                              It should be easy to upload a wifi gateway sketch. I made an MQTT integration.

                              1 Reply Last reply
                              0
                              • Mark SwiftM Offline
                                Mark SwiftM Offline
                                Mark Swift
                                wrote on last edited by Mark Swift
                                #15

                                Thanks for the great replies.

                                I'm not currently using MQTT, I'm running the Ethernet gateway via a W5100. Can I use the ESP boards, i.e this or the nodemcu without the need for an NRF24?

                                alexsh1A 1 Reply Last reply
                                0
                                • Mark SwiftM Mark Swift

                                  Thanks for the great replies.

                                  I'm not currently using MQTT, I'm running the Ethernet gateway via a W5100. Can I use the ESP boards, i.e this or the nodemcu without the need for an NRF24?

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

                                  @Mark-Swift how would you intend to use Sonoff with MySensors? Do you have the ESP GW?

                                  I am using several Sonoffs with Domoticz via a JSON script. https://www.domoticz.com/wiki/Domoticz_API/JSON_URL's

                                  1 Reply Last reply
                                  0
                                  • peterscargillP Offline
                                    peterscargillP Offline
                                    peterscargill
                                    wrote on last edited by
                                    #17

                                    So - I agree re: Sonoffs - we've written our own software at the tech blog and though not quite step by step it is easy enough to use and ROMS are available to save you having to get into compiling code. We use Node-Red and MQTT as the base of everything - so you have a number of ESP sensors and relay controllers etc all talking to a Raspberry Pi - or something much cheaper like an Orange Pi Zero running Armbian for example - and basically you're sending simple MQTT messages around the house - nothing has to go outside unless of course you want remote control at a distance. Modifying Sonoffs is easy - I'm sitting in front of some now updating them with our software - just in the process of figuring our which port is used for the second relay in the DUAL product.

                                    1 Reply Last reply
                                    0
                                    • alexsh1A alexsh1

                                      @hek in this case it is doable. Not sure if 1mb Is enough though

                                      peterscargillP Offline
                                      peterscargillP Offline
                                      peterscargill
                                      wrote on last edited by
                                      #18

                                      @alexsh1 Replace the FLASH in the Sonoff - easier in the latest models as they've put the FLASH chip on the back (Sonoff TH16 etc) - on the originals it was jammed in next to the programming button and a pain to replace.

                                      alexsh1A 1 Reply Last reply
                                      0
                                      • peterscargillP peterscargill

                                        @alexsh1 Replace the FLASH in the Sonoff - easier in the latest models as they've put the FLASH chip on the back (Sonoff TH16 etc) - on the originals it was jammed in next to the programming button and a pain to replace.

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

                                        @peterscargill Peter, I am stuck with the previous model (WiFi + 433) and changing FLASH is literally impossible even with a small tip. Using a hot fan is not an option as it would melt down all plastic including the button.

                                        1 Reply Last reply
                                        0
                                        • EfflonE Offline
                                          EfflonE Offline
                                          Efflon
                                          wrote on last edited by
                                          #20

                                          Here is a working example of using Sonoff with MySensors and the mqtt gateway.
                                          No need to replace any flash etc...

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


                                          19

                                          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