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 MQTT Client Node ID

ESP8266 MQTT Client Node ID

Scheduled Pinned Locked Moved Development
8 Posts 3 Posters 1.0k Views 3 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.
  • T Offline
    T Offline
    tchoblond59
    wrote on last edited by
    #1

    Hi !
    My goal is to make a sensor node on a wemos D1 mini on ESP8266 with MQTT directly on WIFI.
    I can push and receive message from the MQTT broker but when i send something (like a relay status) the node id of my sensor is 0 and i can't change it even with #define MY_NODE_ID 5.
    I use GatewayESP8266MQTTClient sketch and i comment //#define MY_RADIO_NRF24

    So how can i force it ? Thanks.

    mfalkviddM 1 Reply Last reply
    0
    • T tchoblond59

      Hi !
      My goal is to make a sensor node on a wemos D1 mini on ESP8266 with MQTT directly on WIFI.
      I can push and receive message from the MQTT broker but when i send something (like a relay status) the node id of my sensor is 0 and i can't change it even with #define MY_NODE_ID 5.
      I use GatewayESP8266MQTTClient sketch and i comment //#define MY_RADIO_NRF24

      So how can i force it ? Thanks.

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

      @tchoblond59 a gateway always has node ID 0. It can use sensor IDs from 0 to 254 though.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        msolo
        wrote on last edited by
        #3

        @mfalkvidd
        why node ID need to be 0 ? I want to have a few node ( different localization ) and all arduino node should be have unical node_id but only sketch name can by unical.

        I'm using MY_GATEWAY_MQTT_CLIENT

        mfalkviddM 1 Reply Last reply
        0
        • M msolo

          @mfalkvidd
          why node ID need to be 0 ? I want to have a few node ( different localization ) and all arduino node should be have unical node_id but only sketch name can by unical.

          I'm using MY_GATEWAY_MQTT_CLIENT

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

          @msolo because the node ID is used in routing within a MySensors network, and there can only be one gateway per MySensors network.

          You can use MY_MQTT_CLIENT_ID, MY_MQTT_PUBLISH_TOPIC_PREFIX and MY_MQTT_SUBSCRIBE_TOPIC_PREFIX to differentiate between different MySensors gateways/networks.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            msolo
            wrote on last edited by
            #5

            @mfalkvidd
            MY_MQTT_CLIENT_ID was rewrite for other device

            so if I good understand, the best options is use dedicated channel for communication

            ex:
            arduino00:
            MY_MQTT_PUBLISH_TOPIC_PREFIX=mysensors-in00
            MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mysensors-out00
            domoticz for ex:
            new: mysensor gateway mqtt with TOPIC : mysensors-${in/out}00

            arduino01
            the same action but change 00->01

            mfalkviddM 1 Reply Last reply
            0
            • M msolo

              @mfalkvidd
              MY_MQTT_CLIENT_ID was rewrite for other device

              so if I good understand, the best options is use dedicated channel for communication

              ex:
              arduino00:
              MY_MQTT_PUBLISH_TOPIC_PREFIX=mysensors-in00
              MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mysensors-out00
              domoticz for ex:
              new: mysensor gateway mqtt with TOPIC : mysensors-${in/out}00

              arduino01
              the same action but change 00->01

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

              @msolo yes I think that will work. I have not used MySensors with MQTT though, so I can't say for sure.

              1 Reply Last reply
              0
              • M Offline
                M Offline
                msolo
                wrote on last edited by
                #7

                @mfalkvidd it's working, but i think in not pro way - why ? you need create separate channel for communicastion ( for security point it's ok ) but if you have many nodes and you want exchange some informasion insite network it't will be not working you need some integrasion ex domoticz, hassio etc bo some think chane in other node. Maybe you add this option to change node_id in mqtt gatway ?

                mfalkviddM 1 Reply Last reply
                0
                • M msolo

                  @mfalkvidd it's working, but i think in not pro way - why ? you need create separate channel for communicastion ( for security point it's ok ) but if you have many nodes and you want exchange some informasion insite network it't will be not working you need some integrasion ex domoticz, hassio etc bo some think chane in other node. Maybe you add this option to change node_id in mqtt gatway ?

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

                  @msolo "adding" that would risk breaking a lot of stuff, but you're welcome to try. https://www.mysensors.org/download/contributing has some useful information if you want to work on it.

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


                  11

                  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