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. Development
  3. ESP8266 WiFi gateway port for MySensors

ESP8266 WiFi gateway port for MySensors

Scheduled Pinned Locked Moved Development
328 Posts 56 Posters 310.8k Views 39 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.
  • sowardS Offline
    sowardS Offline
    soward
    wrote on last edited by
    #192

    I'd been using the ESP gateway for several weeks, but recently was having trouble adding a new sensor I am developing.

    Since the copy of dev I built it with was now out of date, I went ahead and updated... still wasn't working right so while I had the serial link to it I checked and noticed it was crashing and cycling. It would work for hours, until I fired up my new node, then crash about immediately. A few dozen debug(PSTR())'s later, I found a cause.

    In core/MySensorsCore.cpp the result of _msg.getConfig() is dereferenced in a comparison, and it's possible it could return NULL ( like when it's a new node ). I put a check around that and it's not crashing anymore. Which is more than what I can say for my new sensor node....

    I have not tested this change with an AVR.

    I submitted PR 264.

    1 Reply Last reply
    2
    • mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by
      #193

      Great work @soward !

      1 Reply Last reply
      0
      • D Offline
        D Offline
        D_dude
        wrote on last edited by
        #194

        on some basic debugging, seems like my sketch is crashing in setupGateway.

        infact even adding a print statement, it only prints first 3 chars.

        My question is setupGateway takes output as an arg, which in turn is a function, should there be some parameters for this function?
        also "Serial.print(serialBuffer);" does not print anything i added prints above and before and they don't show up either.

          va_end (args);
          Serial.print("A1");
          Serial.print(serialBuffer);
          Serial.print("A2");
        

        any suggestions?

        YveauxY 1 Reply Last reply
        0
        • D D_dude

          on some basic debugging, seems like my sketch is crashing in setupGateway.

          infact even adding a print statement, it only prints first 3 chars.

          My question is setupGateway takes output as an arg, which in turn is a function, should there be some parameters for this function?
          also "Serial.print(serialBuffer);" does not print anything i added prints above and before and they don't show up either.

            va_end (args);
            Serial.print("A1");
            Serial.print(serialBuffer);
            Serial.print("A2");
          

          any suggestions?

          YveauxY Offline
          YveauxY Offline
          Yveaux
          Mod
          wrote on last edited by Yveaux
          #195

          @D_dude flush the serial output after each print.
          The ESP will output the serial data in the background while your programm continues and then it crashes.

          http://yveaux.blogspot.nl

          YhtY D 2 Replies Last reply
          1
          • YveauxY Yveaux

            @D_dude flush the serial output after each print.
            The ESP will output the serial data in the background while your programm continues and then it crashes.

            YhtY Offline
            YhtY Offline
            Yht
            wrote on last edited by
            #196

            Hi,
            I'm getting all the time this:

            ESP8266 MySensors Gateway
            Connecting to layla
            ......Connected!
            IP: 192.168.0.102
            0;0;3;0;9;gateway started, id=0, parent=0, distance=0

            Then it got stuck so I do reset and getting this in loop:

            ESP8266 MySensors Gateway
            Connecting to layla
            ..Connected!
            IP: 192.168.0.102
            0;0;3;0;9;radio init fail

            Soft WDT reset

            ctx: cont
            sp: 3ffefe70 end: 3fff00a0 offset: 01b0

            stack>>>
            3fff0020: 00000000 00000000 3ffeed74 40203665
            3fff0030: 0000007f 3ffef074 40205ba0 3ffef080
            3fff0040: 40202114 00000001 00000000 40205c10
            3fff0050: 6600a8c0 00ffffff 0100a8c0 3ffef074
            3fff0060: 3ffe84ac 3ffeee8c 3ffeefb0 4020256b
            3fff0070: 3ffe86b8 6600a8c0 00000000 00000000
            3fff0080: 3fffdc20 00000000 3ffef06d 40205bde
            3fff0090: 00000000 00000000 3ffef080 40100114
            <<<stack<<<

            ets Jan 8 2013,rst cause:2, boot mode:(3,6)

            load 0x4010f000, len 1264, room 16
            tail 0
            chksum 0x42
            csum 0x42
            ~ld

            YveauxY 1 Reply Last reply
            0
            • YhtY Yht

              Hi,
              I'm getting all the time this:

              ESP8266 MySensors Gateway
              Connecting to layla
              ......Connected!
              IP: 192.168.0.102
              0;0;3;0;9;gateway started, id=0, parent=0, distance=0

              Then it got stuck so I do reset and getting this in loop:

              ESP8266 MySensors Gateway
              Connecting to layla
              ..Connected!
              IP: 192.168.0.102
              0;0;3;0;9;radio init fail

              Soft WDT reset

              ctx: cont
              sp: 3ffefe70 end: 3fff00a0 offset: 01b0

              stack>>>
              3fff0020: 00000000 00000000 3ffeed74 40203665
              3fff0030: 0000007f 3ffef074 40205ba0 3ffef080
              3fff0040: 40202114 00000001 00000000 40205c10
              3fff0050: 6600a8c0 00ffffff 0100a8c0 3ffef074
              3fff0060: 3ffe84ac 3ffeee8c 3ffeefb0 4020256b
              3fff0070: 3ffe86b8 6600a8c0 00000000 00000000
              3fff0080: 3fffdc20 00000000 3ffef06d 40205bde
              3fff0090: 00000000 00000000 3ffef080 40100114
              <<<stack<<<

              ets Jan 8 2013,rst cause:2, boot mode:(3,6)

              load 0x4010f000, len 1264, room 16
              tail 0
              chksum 0x42
              csum 0x42
              ~ld

              YveauxY Offline
              YveauxY Offline
              Yveaux
              Mod
              wrote on last edited by Yveaux
              #197

              @Yht 0;0;3;0;9;radio init fail
              Means there's something wrong with your nRF communication. The WDT reset following this is normal.

              http://yveaux.blogspot.nl

              1 Reply Last reply
              0
              • C Offline
                C Offline
                ciprian
                wrote on last edited by
                #198

                i have been using wifi gateway with Domoticz controller without any problems until recentely. After the last update to beta version of the controller, the gateway crashes when the controller request gateway version:
                Gateway startup complete.
                Client 0: 0;0;3;0;2;

                Exception (28):
                epc1=0x4000bf80 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

                ctx: cont
                sp: 3ffebf60 end: 3ffec1f0 offset: 01a0

                I have tested with telnet client with the same request and it was ok. Then I saw that the request from controller was terminated with only <LF> and not with <CR><LF> and this is why it crashed. I have added the following to the sketch:

                •    if (inChar == '\n')
                    {  
                      if (inputString[i].string[inputString[i].idx-1] != '\r') { // if the last char is not CR then add it
                      inputString[i].string[inputString[i].idx++]='\r';
                     }
                      // a command was issued by the client
                      // we will now try to send it to the actuator
                  

                and now it seems to work.
                Is this the right way to go?
                Thanks

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

                  @ciprian

                  Are you talking abut this line of code?
                  https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/core/MyGatewayTransportEthernet.cpp#L194

                  C 1 Reply Last reply
                  0
                  • hekH hek

                    @ciprian

                    Are you talking abut this line of code?
                    https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/core/MyGatewayTransportEthernet.cpp#L194

                    C Offline
                    C Offline
                    ciprian
                    wrote on last edited by
                    #200

                    @hek My code is from GatewayESP8266.ino example in Mysensors 1.5, line 234.

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

                      Ok! Mis-read this line---

                      After the last update to beta version....

                      Thought you were talking about the development branch. Sorry.

                      1 Reply Last reply
                      0
                      • YhtY Offline
                        YhtY Offline
                        Yht
                        wrote on last edited by
                        #202

                        Hi all,
                        First, I have to say this is awsome what @Yveaux did, thank you!

                        Sorry if this question takes you back in time. I don't know what channel and id to use for the nodes,I tried channel 97 and id from 1-5 but it is not working..
                        are you using mesh lib?

                        YveauxY 1 Reply Last reply
                        0
                        • YhtY Yht

                          Hi all,
                          First, I have to say this is awsome what @Yveaux did, thank you!

                          Sorry if this question takes you back in time. I don't know what channel and id to use for the nodes,I tried channel 97 and id from 1-5 but it is not working..
                          are you using mesh lib?

                          YveauxY Offline
                          YveauxY Offline
                          Yveaux
                          Mod
                          wrote on last edited by
                          #203

                          @Yht said:

                          I don't know what channel and id to use for the nodes

                          Just leave the default channel untouched for both sensors and gateway. It should be fine.
                          The gateway will automatically be assigned ID 0, the nodes can have any fixed ID.
                          Dynamic ID assignment requires some extra software, as the gateway does not support it.

                          http://yveaux.blogspot.nl

                          1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            georgep56
                            wrote on last edited by
                            #204

                            I'm also seeing my ESP8266 gateway crash when the controller requests its version.

                            I had not seen this thread so I started a new topic here: http://forum.mysensors.org/topic/2493/esp8266-wifi-gateway-crashes-and-reboots-when-controller-connects

                            1 Reply Last reply
                            0
                            • scalzS Offline
                              scalzS Offline
                              scalz
                              Hardware Contributor
                              wrote on last edited by
                              #205

                              hi,

                              maybe you have already seen it...but you can get cheap and smaller nodemcu. crazy price! I have ordered some, and waiting for them...
                              http://fr.aliexpress.com/item/D1-mini-Mini-NodeMcu-4M-bytes-Lua-WIFI-Internet-of-Things-development-board-based-ESP8266/32529101036.html?spm=2114.06010108.3.1.04LsjX&ws_ab_test=searchweb201556_2_79_78_77_80,searchweb201644_0,searchweb201560_9

                              YveauxY 1 Reply Last reply
                              0
                              • scalzS scalz

                                hi,

                                maybe you have already seen it...but you can get cheap and smaller nodemcu. crazy price! I have ordered some, and waiting for them...
                                http://fr.aliexpress.com/item/D1-mini-Mini-NodeMcu-4M-bytes-Lua-WIFI-Internet-of-Things-development-board-based-ESP8266/32529101036.html?spm=2114.06010108.3.1.04LsjX&ws_ab_test=searchweb201556_2_79_78_77_80,searchweb201644_0,searchweb201560_9

                                YveauxY Offline
                                YveauxY Offline
                                Yveaux
                                Mod
                                wrote on last edited by
                                #206

                                @scalz Nice! Thanks for the link!

                                http://yveaux.blogspot.nl

                                1 Reply Last reply
                                0
                                • D Offline
                                  D Offline
                                  drock1985
                                  wrote on last edited by
                                  #207

                                  Just wanted to chime in and say thank you for this gateway script @Yveaux

                                  I originally had an ethernet gateway for the longest time. But when I changed over to an OnHub router, it stopped working because it doesn't like to handle static IP, and the current branch sketch is too large to enable DHCP. This worked wonderfully with the OnHub out of the box (ver 7390.62.2) and shows up with a hostname of ESP_DA7D8B.

                                  Thanks again!

                                  My Projects
                                  2 Door Chime Sensor
                                  Washing Machine Monitor

                                  1 Reply Last reply
                                  0
                                  • M Offline
                                    M Offline
                                    mbj
                                    wrote on last edited by
                                    #208

                                    Hi,
                                    When testing the ESP8266MQTTClient (downloaded latest version of the library today) and compiled with the NodeMCU 1.0 ...... option I get an odd result. The message at startup is (please disregard the "Radio init fail" - the radio was not yet connected. I just wanted to check the WiFi ):

                                    2dO,4`lLMØl 8ðÿ0;0;3;0;9;Starting gateway (RNNGE-, 1.6.0-beta)
                                    0;0;3;0;9;Radio init failed. Check wiring.
                                    scandone
                                    state: 0 -> 2 (b0)
                                    state: 2 -> 3 (0)
                                    state: 3 -> 5 (10)
                                    add 0
                                    aid 2
                                    pm open phy_2,type:2 0 0
                                    cnt

                                    connected with XXXyyy, channel 1
                                    dhcp client start...
                                    ip:192.168.1.167,mask:255.255.255.0,gw:192.168.1.1

                                    I can see from the router that the connection to 192.168.1.167 is successful but the oddity is that I have set the gateway to use a static address and also connect to a SSID which is not XXXyyy. The defines are:

                                    // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
                                    #define MY_IP_ADDRESS 192,168,1,22
                                    // If using static ip you need to define Gateway and Subnet address as well
                                    #define MY_IP_GATEWAY_ADDRESS 192,168,1,1
                                    #define MY_IP_SUBNET_ADDRESS 255,255,255,0

                                    So the ESP8266 uses dhcp when it should have a static address and connects to a SSID which is not given but may have been previously used at earlier tests.

                                    I have looked at the code and tried a few changes to defines but none resulted in the override of dhcp.
                                    Anyone have a clue?

                                    1 Reply Last reply
                                    0
                                    • B Offline
                                      B Offline
                                      bp_968
                                      wrote on last edited by
                                      #209

                                      I have the exact hardware in this setup but can't even get to the point where the hardware is a problem! I'm having compile errors during verify that make no sense and that I can't seem to find in the forums using search:

                                      In file included from Esp8266Gateway.ino:69:0:
                                      C:\Users\xxxxx\Documents\Arduino\libraries\SPI/SPI.h:982:8: error: 'SPIClass' does not name a type
                                      extern SPIClass SPI;

                                      Any suggestions? I'm running windows 10 and Arduino 1.6.5 with the most current esp8266 board files through board manager.

                                      Apparently me and anything arduino related are like oil and water, yet I keep buying the stuff.

                                      B 1 Reply Last reply
                                      0
                                      • B bp_968

                                        I have the exact hardware in this setup but can't even get to the point where the hardware is a problem! I'm having compile errors during verify that make no sense and that I can't seem to find in the forums using search:

                                        In file included from Esp8266Gateway.ino:69:0:
                                        C:\Users\xxxxx\Documents\Arduino\libraries\SPI/SPI.h:982:8: error: 'SPIClass' does not name a type
                                        extern SPIClass SPI;

                                        Any suggestions? I'm running windows 10 and Arduino 1.6.5 with the most current esp8266 board files through board manager.

                                        Apparently me and anything arduino related are like oil and water, yet I keep buying the stuff.

                                        B Offline
                                        B Offline
                                        bp_968
                                        wrote on last edited by
                                        #210

                                        @bp_968 said:

                                        I have the exact hardware in this setup but can't even get to the point where the hardware is a problem! I'm having compile errors during verify that make no sense and that I can't seem to find in the forums using search:

                                        In file included from Esp8266Gateway.ino:69:0:
                                        C:\Users\xxxxx\Documents\Arduino\libraries\SPI/SPI.h:982:8: error: 'SPIClass' does not name a type
                                        extern SPIClass SPI;

                                        Any suggestions? I'm running windows 10 and Arduino 1.6.5 with the most current esp8266 board files through board manager.

                                        Apparently me and anything arduino related are like oil and water, yet I keep buying the stuff.

                                        I tried this on my laptop and it worked fine (the compile verify did anyway) so I'll be reinstalling the IDE and trying again and hopefully that resolves my issues!

                                        1 Reply Last reply
                                        0
                                        • T Offline
                                          T Offline
                                          tjay4x4
                                          wrote on last edited by
                                          #211

                                          Yesterday I have successfully installed the ESP8266 module and it works fine, but the Vera3 show something strange now.
                                          ESP.jpg
                                          Has anyone experienced this?

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


                                          21

                                          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