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. Troubleshooting
  3. ESP8266 MQTT Gateway and setting NODE_ID

ESP8266 MQTT Gateway and setting NODE_ID

Scheduled Pinned Locked Moved Troubleshooting
13 Posts 4 Posters 3.3k Views 5 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.
  • popP Offline
    popP Offline
    pop
    wrote on last edited by
    #1

    Re: Connecting first node to new gateway - what am I missing?

    Hi, I have a working setup now thanks to the above thread with an ESP8266 acting as gateway and a nano acting as a sensor.

    Regarding the node id of the gateway, is there something special you have to do to set the node id?
    Because I added #define MY_NODE_ID 1 to my gateway sketch but the gateway always reports node id 0.

    mfalkviddM 1 Reply Last reply
    0
    • popP pop

      Re: Connecting first node to new gateway - what am I missing?

      Hi, I have a working setup now thanks to the above thread with an ESP8266 acting as gateway and a nano acting as a sensor.

      Regarding the node id of the gateway, is there something special you have to do to set the node id?
      Because I added #define MY_NODE_ID 1 to my gateway sketch but the gateway always reports node id 0.

      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by
      #2

      @pop a gateway always has node id 0. Changing node id for a gateway is not possible.

      Could you describe why you'd prefer a separate node id?

      popP 1 Reply Last reply
      0
      • mfalkviddM mfalkvidd

        @pop a gateway always has node id 0. Changing node id for a gateway is not possible.

        Could you describe why you'd prefer a separate node id?

        popP Offline
        popP Offline
        pop
        wrote on last edited by
        #3

        @mfalkvidd hi. I thought I could build several ESP8266 devices with their own sensors and place them (within wifi range) then have several nano-based sensors calling in to each ESP8266.
        How would I make sensors using the ESP8266 without hitting gateway limitations?

        popP 1 Reply Last reply
        0
        • popP pop

          @mfalkvidd hi. I thought I could build several ESP8266 devices with their own sensors and place them (within wifi range) then have several nano-based sensors calling in to each ESP8266.
          How would I make sensors using the ESP8266 without hitting gateway limitations?

          popP Offline
          popP Offline
          pop
          wrote on last edited by
          #4

          @pop said:

          @mfalkvidd hi. I thought I could build several ESP8266 devices with their own sensors and place them (within wifi range) then have several nano-based sensors calling in to each ESP8266.
          How would I make sensors using the ESP8266 without hitting gateway limitations?

          I should have added, I'm using openhab and as far as I understand, we have to use MQTT to talk to it. Hance the ESP8266 MQTT Gateway.

          mfalkviddM 1 Reply Last reply
          0
          • popP pop

            @pop said:

            @mfalkvidd hi. I thought I could build several ESP8266 devices with their own sensors and place them (within wifi range) then have several nano-based sensors calling in to each ESP8266.
            How would I make sensors using the ESP8266 without hitting gateway limitations?

            I should have added, I'm using openhab and as far as I understand, we have to use MQTT to talk to it. Hance the ESP8266 MQTT Gateway.

            mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote on last edited by
            #5

            @pop you would just add each esp to OpenHab I think. No need to have different node id.

            popP 1 Reply Last reply
            0
            • mfalkviddM mfalkvidd

              @pop you would just add each esp to OpenHab I think. No need to have different node id.

              popP Offline
              popP Offline
              pop
              wrote on last edited by
              #6

              @mfalkvidd Oh right, thanks. I think I get it now.
              So I just add more ESPs and the MQTT messages will be identified by the MQTT prefix which will be unique to each gateway.
              Duh! I was thinking the node id identified the MQTT stream.

              Thanks for putting me right.

              mfalkviddM 1 Reply Last reply
              2
              • popP pop

                @mfalkvidd Oh right, thanks. I think I get it now.
                So I just add more ESPs and the MQTT messages will be identified by the MQTT prefix which will be unique to each gateway.
                Duh! I was thinking the node id identified the MQTT stream.

                Thanks for putting me right.

                mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote on last edited by mfalkvidd
                #7

                @pop great! Thanks for clarifying your use case.

                1 Reply Last reply
                0
                • proddyP Offline
                  proddyP Offline
                  proddy
                  wrote on last edited by
                  #8

                  Glad I found this post. I couldn't work out why my ESP8266 which is an MQTT gateway and sensor in one was always ignoring the MY_NODE_ID. Perhaps good to mention in the doc that if you have MY_GATEWAY_MQTT_CLIENT defined the node will always be 0 ?

                  1 Reply Last reply
                  0
                  • jjkJ Offline
                    jjkJ Offline
                    jjk
                    wrote on last edited by
                    #9

                    I found this topic by chance and there might be new info - if so, I'm sorry.
                    However, I was thinking how the "forced" node-id 0 will work if more than one ESP8266 gateway is installed within possible radio range of the sensor nodes. Wouldn't that be leading to unpredictable behavior, like messages sent more than one?

                    mfalkviddM 1 Reply Last reply
                    1
                    • jjkJ jjk

                      I found this topic by chance and there might be new info - if so, I'm sorry.
                      However, I was thinking how the "forced" node-id 0 will work if more than one ESP8266 gateway is installed within possible radio range of the sensor nodes. Wouldn't that be leading to unpredictable behavior, like messages sent more than one?

                      mfalkviddM Offline
                      mfalkviddM Offline
                      mfalkvidd
                      Mod
                      wrote on last edited by
                      #10

                      @jjk yes it would be a problem. The solution is to use different radio channels (or protocols) for each MySensors network.

                      From https://www.mysensors.org/about/network

                      ... you can create another parallel radio network on a different channel and there are 126 available channels [NRF24L01+].

                      jjkJ popP 2 Replies Last reply
                      0
                      • mfalkviddM mfalkvidd

                        @jjk yes it would be a problem. The solution is to use different radio channels (or protocols) for each MySensors network.

                        From https://www.mysensors.org/about/network

                        ... you can create another parallel radio network on a different channel and there are 126 available channels [NRF24L01+].

                        jjkJ Offline
                        jjkJ Offline
                        jjk
                        wrote on last edited by
                        #11

                        @mfalkvidd thanks for the swift reply - sometimes the obvious is hard to see ;)

                        1 Reply Last reply
                        1
                        • mfalkviddM mfalkvidd

                          @jjk yes it would be a problem. The solution is to use different radio channels (or protocols) for each MySensors network.

                          From https://www.mysensors.org/about/network

                          ... you can create another parallel radio network on a different channel and there are 126 available channels [NRF24L01+].

                          popP Offline
                          popP Offline
                          pop
                          wrote on last edited by
                          #12

                          @mfalkvidd Hi, just for completeness, how do you actually select another channel? The article that was linked to didn't cover how to do it.
                          I don't need to use an extra channel, I just thought it would be interesting for people to know.

                          mfalkviddM 1 Reply Last reply
                          0
                          • popP pop

                            @mfalkvidd Hi, just for completeness, how do you actually select another channel? The article that was linked to didn't cover how to do it.
                            I don't need to use an extra channel, I just thought it would be interesting for people to know.

                            mfalkviddM Offline
                            mfalkviddM Offline
                            mfalkvidd
                            Mod
                            wrote on last edited by
                            #13

                            @pop for nrf24l01+ based networks, set MY_RF24_CHANNEL
                            for rfm69, set MY_RFM69_NETWORKID
                            They are documented at https://www.mysensors.org/download/sensor_api_20#configuration

                            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.0k

                            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