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 309.7k 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.
  • J joshmosh

    @hek
    Good morning. I had wired up my nodemcu a nRF24L01+, loaded the gateway sketch and bingo ! Zero problems, works like charm. Thanks a lot !!!

    I am using Domoticz as controller, with a serial USB gateway to connect my various sensors. In the serial console of the ESP8266 gateway I see that the messages of my sensors show up, but since I have not yet announced the gateway to Domoticz, there seems to be no interference. If I connect the ESP8266 gateway to a controller (in my case Domoticz), I guess that it will be required that the nodes need to choose the respective gateway (by using the parentNodeId) with which they like to communicate ? Currently, I am using parentNodeId = AUTO in all my nodes.
    I will do some testing to get an idea of the reach of my WiFi compared to the reach of my serial USB gateway (I have a nRF24L01+ with external antanna and booster in my gateway, so I am able to "see" a portable node even outside my house and 50 m away.

    Again, thank you for this very useful extension of MySensors. I think I have not yet an estimate of the full potential of it

    Cheers
    Josh

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

    @joshmosh You cannot have multiple gateways in a single MySensors network. The node-ID of the gateway is always hardcoded to 0.
    If you want to run multiple networks, each should have a unique RF24_CHANNEL & RF24_BASE_RADIO_ID combination. For best results make sure to have a separate RF24_CHANNEL for each network, and don't use directly adjacent channels.

    http://yveaux.blogspot.nl

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

      Playing with AES signing and encryption I enabled verbose debug.

      #define MY_DEBUG_VERBOSE
      

      The sketch crashes with this setting but seems to work fine without verbose debug.

      Is this a problem of my setup or a problem in the code?

      The log pf the serial terminal:

      write_register(0x04,0x5F)
      write_register(0x06,0x27)
      write_register(0x06,0x07)
      write_register(0x00,0x0C)
      write_register(0x07,0x70)
      write_register(0x05,0x4C)
      write_register(0x00,0x0E)
      write_register(0x00,0x0E)
      STATUS		0x0E RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
      RX_ADDR_P0-1	0x0E0E0E0E0E 0303030303 
      RX_ADDR_P2-5	0xC3 C4 C5 C6 
      TX_ADDR		0x0E0E0E0E0E 
      RX_PW_P0-6	0x00 00 00 00 00 00 
      EN_AA		0x3F 
      EN_RXADDR	0x03 
      RF_CH		0x4C 
      RF_SETUP	0x07 
      CONFIG		0x0E 
      DYNPD/FEATURE	0x00 00 
      Data Rate	1MBPS
      Model		nRF24L01+
      CRC Length	16 bits
      PA Power	PA_MAX
      write_register(0x01,0x3F)
      write_register(0x01,0x3B)
      write_register(0x1D,0x06)
      FEATURE=0x06
      write_register(0x1C,0x03)
      write_regis
      
      YveauxY 1 Reply Last reply
      0
      • FotoFieberF FotoFieber

        Playing with AES signing and encryption I enabled verbose debug.

        #define MY_DEBUG_VERBOSE
        

        The sketch crashes with this setting but seems to work fine without verbose debug.

        Is this a problem of my setup or a problem in the code?

        The log pf the serial terminal:

        write_register(0x04,0x5F)
        write_register(0x06,0x27)
        write_register(0x06,0x07)
        write_register(0x00,0x0C)
        write_register(0x07,0x70)
        write_register(0x05,0x4C)
        write_register(0x00,0x0E)
        write_register(0x00,0x0E)
        STATUS		0x0E RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
        RX_ADDR_P0-1	0x0E0E0E0E0E 0303030303 
        RX_ADDR_P2-5	0xC3 C4 C5 C6 
        TX_ADDR		0x0E0E0E0E0E 
        RX_PW_P0-6	0x00 00 00 00 00 00 
        EN_AA		0x3F 
        EN_RXADDR	0x03 
        RF_CH		0x4C 
        RF_SETUP	0x07 
        CONFIG		0x0E 
        DYNPD/FEATURE	0x00 00 
        Data Rate	1MBPS
        Model		nRF24L01+
        CRC Length	16 bits
        PA Power	PA_MAX
        write_register(0x01,0x3F)
        write_register(0x01,0x3B)
        write_register(0x1D,0x06)
        FEATURE=0x06
        write_register(0x1C,0x03)
        write_regis
        
        YveauxY Offline
        YveauxY Offline
        Yveaux
        Mod
        wrote on last edited by
        #154

        @FotoFieber said:

        Is this a problem of my setup or a problem in the code?

        I'll opt for the first, but lets see:

        • What ESP hardware are you using?
        • Which Arduino/ESP8266 port/MySensors version are you using?
        • Did you define both DEBUG and MY_DEBUG_VERBOSE?
        • What did you do to 'Play with AES signing and encryption' ?
        • AES stuff is untested for ESP8266, however, you don't seen to get that far as it crashes during startup.
        • My startup log (see here ) shows what it shoes during startup with DEBUG and MY_DEBUG_VERBOSE enabled.

        http://yveaux.blogspot.nl

        FotoFieberF 1 Reply Last reply
        0
        • YveauxY Yveaux

          @FotoFieber said:

          Is this a problem of my setup or a problem in the code?

          I'll opt for the first, but lets see:

          • What ESP hardware are you using?
          • Which Arduino/ESP8266 port/MySensors version are you using?
          • Did you define both DEBUG and MY_DEBUG_VERBOSE?
          • What did you do to 'Play with AES signing and encryption' ?
          • AES stuff is untested for ESP8266, however, you don't seen to get that far as it crashes during startup.
          • My startup log (see here ) shows what it shoes during startup with DEBUG and MY_DEBUG_VERBOSE enabled.
          FotoFieberF Offline
          FotoFieberF Offline
          FotoFieber
          Hardware Contributor
          wrote on last edited by
          #155

          @Yveaux

          • ESP12E
          • Development Version
          • Defined both DEBUG AND VERBOSE
          • Playing with AES:
          #define MY_RF24_CHANNEL  13
          #define MY_RF24_BASE_RADIO_ID ((uint64_t)0xF8A813FC09CL)
          
          #define MY_RF24_ENABLE_ENCRYPTION
          #define MY_RF24_ENCRYPTKEY  secret....
          
          #define MY_SIGNING_SOFT // Software signing enabled
          
          #define MY_SIGNING_SOFT_SERIAL secret....
          // Key to use for HMAC calculation in soft signing (32 bytes)
          
          #define MY_SIGNING_SOFT_HMAC_KEY secret
          

          It seems to work perfect without the verbose debug.

          I will test now without AES. My gut tells me, I should look inside the AES stuff.

          FotoFieberF 1 Reply Last reply
          0
          • YveauxY Yveaux

            @joshmosh You cannot have multiple gateways in a single MySensors network. The node-ID of the gateway is always hardcoded to 0.
            If you want to run multiple networks, each should have a unique RF24_CHANNEL & RF24_BASE_RADIO_ID combination. For best results make sure to have a separate RF24_CHANNEL for each network, and don't use directly adjacent channels.

            J Offline
            J Offline
            joshmosh
            wrote on last edited by
            #156

            @Yveaux said:

            @joshmosh You cannot have multiple gateways in a single MySensors network. The node-ID of the gateway is always hardcoded to 0.
            If you want to run multiple networks, each should have a unique RF24_CHANNEL & RF24_BASE_RADIO_ID combination. For best results make sure to have a separate RF24_CHANNEL for each network, and don't use directly adjacent channels.

            @Yveaux
            Thank you for this piece of information - I was not aware of this fact.
            My idea was to reduce cost and parts count for sensors by using ESPs instead of nRF plus Arduino. Since I have Domoticz as controller, there is pehaps no need for an additional gateway, because Domoticz can handle TCP-attached sensors. Of course this would require to use WiFi instead of nRF24 as underlying transport for MySensors. My interpretation of some of hek's contributions is that he is working on it for realisation in version 1.6.

            1 Reply Last reply
            0
            • FotoFieberF FotoFieber

              @Yveaux

              • ESP12E
              • Development Version
              • Defined both DEBUG AND VERBOSE
              • Playing with AES:
              #define MY_RF24_CHANNEL  13
              #define MY_RF24_BASE_RADIO_ID ((uint64_t)0xF8A813FC09CL)
              
              #define MY_RF24_ENABLE_ENCRYPTION
              #define MY_RF24_ENCRYPTKEY  secret....
              
              #define MY_SIGNING_SOFT // Software signing enabled
              
              #define MY_SIGNING_SOFT_SERIAL secret....
              // Key to use for HMAC calculation in soft signing (32 bytes)
              
              #define MY_SIGNING_SOFT_HMAC_KEY secret
              

              It seems to work perfect without the verbose debug.

              I will test now without AES. My gut tells me, I should look inside the AES stuff.

              FotoFieberF Offline
              FotoFieberF Offline
              FotoFieber
              Hardware Contributor
              wrote on last edited by
              #157

              @Yveaux
              Downloaded the development branch again and used the sketch included as example. The sketch is hanging too. My gut was wrong, AES is not the problem.

              1 Reply Last reply
              0
              • V Offline
                V Offline
                vickey
                wrote on last edited by
                #158

                Hi.
                I am having an issue with my ESP8266 gateway. I have tried all versions of mysensors including developmental versions, but my esp8266 does not show any serial debug, nor it gets connected to my router. I also enabled debug in configuration file. When I install AT firmware, it replies to AT command, it also works with nodemcu firmware, but it does not respond with Arduino firmware. May someone help me?

                1 Reply Last reply
                0
                • AndurilA Offline
                  AndurilA Offline
                  Anduril
                  wrote on last edited by Anduril
                  #159

                  Finally I got my NodeMCU and tried the WiFi gateway too. But I get the following messages (with Serial.setDebugOutput(true);):

                  ESP8266 MySensors Gateway
                  Connecting to WLAN
                  scandone
                  f 0, ....scandone
                  .add 0
                  aid 1
                  pm open phy_2,type:2 0 0
                  cnt 
                  ..................rm 0
                  pm close 7 0 0/9299504
                  ..reconnect
                  f -240, ....scandone
                  no WLAN found, reconnect after 1s
                  .reconnect
                  f 0, ....scandone
                  .add 0
                  aid 1
                  pm open phy_2,type:2 0 0
                  cnt 
                  ................rm 0
                  pm close 7 0 0/8288631
                  ..reconnect
                  f -240, ....scandone
                  no WLAN found, reconnect after 1s
                  .reconnect
                  f 0, ....scandone
                  .add 0
                  aid 1
                  pm open phy_2,type:2 0 0
                  cnt 
                  ................rm 0
                  pm close 7 0 0/8124923
                  ..reconnect
                  
                  

                  Additionally I tried to use

                    IPAddress ip(192, 168, 38, 18);  /* Set to whatever IP address you'd like the gateway to have */
                    WiFi.config(ip);
                  

                  to avoid DHCP, but that gives error during compiling:

                  no matching function for call to 'ESP8266WiFiClass::config(IPAddress&)'
                  

                  Any hints how to solve?

                  Thanks

                  Edit:
                  to find the problem I tested to connect the ESP to the wifi-hotspot of my smartphone... worked. Is it maybe a problem if the password contain special characters which behave strange during compiling?

                  1 Reply Last reply
                  0
                  • YveauxY Offline
                    YveauxY Offline
                    Yveaux
                    Mod
                    wrote on last edited by Yveaux
                    #160

                    @Anduril said:

                    no WLAN found, reconnect after 1s

                    That's a clear indication the ESP cannot connect to your WiFi accesspoint.
                    Is the SSID matching your accesspoint ('WLAN')?
                    Is the encryption supported by the ESP (see e.g. https://nurdspace.nl/ESP8266#Features -- not sure if it is accurate)
                    Weird characters in the password could be problematic (and of course the password is case-sensitive).

                    Changing between DHCP/Fixed IP won't make a difference here, as the ESP doesn't even connect. IP configuration starts once connected.

                    http://yveaux.blogspot.nl

                    AndurilA 1 Reply Last reply
                    0
                    • YveauxY Yveaux

                      @Anduril said:

                      no WLAN found, reconnect after 1s

                      That's a clear indication the ESP cannot connect to your WiFi accesspoint.
                      Is the SSID matching your accesspoint ('WLAN')?
                      Is the encryption supported by the ESP (see e.g. https://nurdspace.nl/ESP8266#Features -- not sure if it is accurate)
                      Weird characters in the password could be problematic (and of course the password is case-sensitive).

                      Changing between DHCP/Fixed IP won't make a difference here, as the ESP doesn't even connect. IP configuration starts once connected.

                      AndurilA Offline
                      AndurilA Offline
                      Anduril
                      wrote on last edited by
                      #161

                      @Yveaux
                      SSID is 'WLAN' (all capital). Encryption is WPA2 which should be supported. The password contains '|' (don't know the name, vertical line) and 'ß' (german character). I use them among other more common ones to raise the complexity of the encryption. As I am using a bunch of wifi devices I don't want to go around and change passwords for all if not absolutely necessary. Is there a way to specify these 'weird characters' e.g. by ASCII codes or anything else?

                      Changing the IP was not to solve this problem but for future use, as my DHCP is not very good. Can you tell me how to fix IP else?

                      YveauxY 1 Reply Last reply
                      0
                      • AndurilA Anduril

                        @Yveaux
                        SSID is 'WLAN' (all capital). Encryption is WPA2 which should be supported. The password contains '|' (don't know the name, vertical line) and 'ß' (german character). I use them among other more common ones to raise the complexity of the encryption. As I am using a bunch of wifi devices I don't want to go around and change passwords for all if not absolutely necessary. Is there a way to specify these 'weird characters' e.g. by ASCII codes or anything else?

                        Changing the IP was not to solve this problem but for future use, as my DHCP is not very good. Can you tell me how to fix IP else?

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

                        @Anduril try to print your password to the serial console and see if it matches the password you entered in the sketch.

                        http://yveaux.blogspot.nl

                        1 Reply Last reply
                        0
                        • AndurilA Offline
                          AndurilA Offline
                          Anduril
                          wrote on last edited by
                          #163

                          good idea @Yveaux, seems that 'ß' is the problem. serial.print shows ß at that position. Do you know how to avoid that?

                          YveauxY 1 Reply Last reply
                          0
                          • AndurilA Anduril

                            good idea @Yveaux, seems that 'ß' is the problem. serial.print shows ß at that position. Do you know how to avoid that?

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

                            @Anduril probably Unicode problem of the editor. I assume you use the Arduino editor? Try a simple editor like notepad to type the problematic character, or directly type it in windows by setting your keyboard in numpad mode and type it's ascii code: alt+225

                            http://yveaux.blogspot.nl

                            1 Reply Last reply
                            0
                            • AndurilA Offline
                              AndurilA Offline
                              Anduril
                              wrote on last edited by Anduril
                              #165

                              @Yveaux tried with a nano to print out "ß" to serial, no problems. After that I tried that sketch on ESP:

                              void setup() {
                                Serial.begin(115200);
                                const char *pass = "ß1ß";
                                Serial.println(" "); //to break line after rubbish at init
                                Serial.println(pass);
                              }
                              
                              [not readable/copyable stuff]
                              ß1ß
                              

                              So in general it should be no problem compiling the char 'ß' even on ESP.. Also in the ESPGateway sketch I don't see anything that is changing the *pass, but maybe you know what is going on with this string in more detail.

                              edit: it seems to happen even before void setup in the gw sketch. I uncommented everything in setup, loop and output, but still get the distorted serial print of pass.

                              YveauxY 1 Reply Last reply
                              0
                              • AndurilA Anduril

                                @Yveaux tried with a nano to print out "ß" to serial, no problems. After that I tried that sketch on ESP:

                                void setup() {
                                  Serial.begin(115200);
                                  const char *pass = "ß1ß";
                                  Serial.println(" "); //to break line after rubbish at init
                                  Serial.println(pass);
                                }
                                
                                [not readable/copyable stuff]
                                ß1ß
                                

                                So in general it should be no problem compiling the char 'ß' even on ESP.. Also in the ESPGateway sketch I don't see anything that is changing the *pass, but maybe you know what is going on with this string in more detail.

                                edit: it seems to happen even before void setup in the gw sketch. I uncommented everything in setup, loop and output, but still get the distorted serial print of pass.

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

                                @Anduril I guess it shouldn't make a difference. What happens if you copy/paste the "ß1ß" string from your test sketch into the ESP gateway sketch as password and print that to serial? (make sure to use the same editor on both sketches)

                                http://yveaux.blogspot.nl

                                1 Reply Last reply
                                0
                                • AndurilA Offline
                                  AndurilA Offline
                                  Anduril
                                  wrote on last edited by Anduril
                                  #167

                                  @Yveaux already tried that. When using my own sketch I get "ß1ß", when using the gw sketch (with really everything commented out, so no functionality) I get "ß1ß". I thought that it might be a problem of UFT encoding, had this issue with transfering LaTeX files created on linux system to windows system and vice versa: the system that creates the file sets the charset.
                                  But I also created a completely new .ino with the gateway-code inside and new created gatewayutil.h with data copied in notepad++, but no succes.
                                  And yes I use Arduino IDE as editor. Is there a good way to use another editor and compile/upload without the IDE?

                                  YveauxY 1 Reply Last reply
                                  0
                                  • AndurilA Anduril

                                    @Yveaux already tried that. When using my own sketch I get "ß1ß", when using the gw sketch (with really everything commented out, so no functionality) I get "ß1ß". I thought that it might be a problem of UFT encoding, had this issue with transfering LaTeX files created on linux system to windows system and vice versa: the system that creates the file sets the charset.
                                    But I also created a completely new .ino with the gateway-code inside and new created gatewayutil.h with data copied in notepad++, but no succes.
                                    And yes I use Arduino IDE as editor. Is there a good way to use another editor and compile/upload without the IDE?

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

                                    @Anduril I'm still convinced it has something to do with Unicode, but very hard to nail from a distance without the actual files...
                                    Maybe @hek has seen this before?

                                    http://yveaux.blogspot.nl

                                    1 Reply Last reply
                                    0
                                    • hekH Online
                                      hekH Online
                                      hek
                                      Admin
                                      wrote on last edited by
                                      #169

                                      Nope, not the slightest idea.

                                      @Anduril
                                      Couldn't you just temporarily change password on router to rule out other stuff?

                                      1 Reply Last reply
                                      0
                                      • AndurilA Offline
                                        AndurilA Offline
                                        Anduril
                                        wrote on last edited by
                                        #170

                                        @hek yeah already did this, when leaving out ß it works perfect. So no problem with router or ESP hardware. But changing the wifi password would be the worst case, as I have to reassign that to squeezeboxes, smartphones, laptops, wifi printer,... (and all guest devices of friends/familie) but still possible if all other things fail.
                                        @Yveaux Would it help if I send you the files for verification? Is it possible inside this forum or only via email?

                                        1 Reply Last reply
                                        0
                                        • AndurilA Offline
                                          AndurilA Offline
                                          Anduril
                                          wrote on last edited by
                                          #171

                                          @Yveaux thank you very much for offering help with verification, but something strange happened during preperation of files: I took an example sketch and modified it to print the "ß1ß" on serial --> working fine.
                                          But after saving the file I tried again, only reading rubbish. Thats strange! So it has something to do with saving the file and maybe setting a special encoding. Maybe thats related to the editor? Could you please try to redo what I explained and see if you get the same results? Thank you. @hek have you ever had such a problem of a sketch behaving differently after saving?

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


                                          14

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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