mqtt/ethernet gateway - node id?

  • Hi! How can i find node ids (mysensor:/id1/id2/V_LIGHT) when they are connected to mqttgateway or etherentgateway?

  • You have to set them yourself, unless you have controller

  • i do have openhab... but it does not list anything. Can i make static nodeID?

  • I have openhab too and it works fine.

    Have you checked that openhab has connected to the mqtt gateway?

  • Sure. Openhab connects to mqtt gateway without any problems, but i dont know where to find node and sensor ID ex. for switch "mysensor:MyMQTT/nodeID/sensorID/V_LIGHT:command:ON", what i should put instead of nodeID and sensorID? where to find theme? is there any option i can get nodeID and display it when debugging (node) on com port?

  • I am sorry to dig this old one out but I have the same question and it seems to be unanswered. How can I define a static Node Id instead of auto assign by the gateway?

  • @siod

    Depending on what version of the library you're using it could be:

    For version 1.5

    void setup()  
      // Initialize library and add callback for incoming messages
      gw.begin(incomingMessage, AUTO, true);
      // Send the sketch version information to the gateway and Controller
      gw.sendSketchInfo("Relay", "1.0");

    where AUTO means auto assign, so replace by your static id

    gw.begin(incomingMessage, 10 , true);

    For version 1.6/2.0 beta

    It would be

    // Define Node ID
    #define MY_NODE_ID 7
    // INCLUDES //
    #include <SPI.h>
    #include <MySensor.h>


  • thank you!!

  • @barduino said:

    #define MY_NODE_ID 7

    so just to be sure, am assuming the MQTT gateway has nothing to do with Openhab's MySensors Binding and thus won't obtain an automatic Node ID ?

  • No, I don't believe the mysensors binding supports MQTT so won't provide node ID.

    I am using the MQTT binding for openhab2 and using a mixture of auto and static node ID with the MYS 2.0 MQTT client gateway.

    I use Node Red to assign node ID's I think someone already posted a workflow for it.

    I have Node Red ping me a message saying that it's assigned a new ID but you can use mosquitto to subscribe to both the in and out topics so you can see each message going back and forth.

    You could even use mosquitto to reply to the node on the MQTT topic and set it manually.

  • @Qu3Uk

    thanks for the quick prompt, i am trying to assign a static gateway address by specifying

    #define MY_NODE_ID 1

    and it doesn't take effect, (putting it before the #include)


    results always in 0

    any ideas ?

  • For 2.0 I think if you want to assign a static nodeID you only need to define it like you are.

    You do not need to call getNodeID as that I believe will request an ID from the controller.

    Hopefully someone can confirm that, I've only been using 2.0 for a single node after upgrading my gateway.

  • Mod

    A gateway always has node id 0. It cannot be configured.

Log in to reply

Suggested Topics

  • 75
  • 48
  • 6
  • 1
  • 4
  • 27
  • 18
  • 479