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. How to know the node ids assigned by the mqtt gateway to the sensors?

How to know the node ids assigned by the mqtt gateway to the sensors?

Scheduled Pinned Locked Moved Development
11 Posts 5 Posters 5.6k Views 2 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.
  • A Offline
    A Offline
    amitach
    wrote on last edited by
    #1

    Hi,

    I have a mqtt gateway running on arduino from mysensors library. I also have an openhab controller running on a raspberry pi connected to the arduino uno through the ethernet shield. I am trying to create my first item on openhab and I understand that the format required is
    MyMQTT/20/0/V_TEMP where 20 and 0 are node id and sensor id respectively.

    I can see following message on the serial monitor

    Started!
    0;0;3;0;9;read: 20-20-0 s=1,c=1,t=16,pt=0,l=1:1

    1. How do I configure the node id and the sensor id?
    2. Is it assigned automatically or do I assign it statically?
    3. How do I understand the above output on the serial monitor?
    XanderX A D 3 Replies Last reply
    1
    • A amitach

      Hi,

      I have a mqtt gateway running on arduino from mysensors library. I also have an openhab controller running on a raspberry pi connected to the arduino uno through the ethernet shield. I am trying to create my first item on openhab and I understand that the format required is
      MyMQTT/20/0/V_TEMP where 20 and 0 are node id and sensor id respectively.

      I can see following message on the serial monitor

      Started!
      0;0;3;0;9;read: 20-20-0 s=1,c=1,t=16,pt=0,l=1:1

      1. How do I configure the node id and the sensor id?
      2. Is it assigned automatically or do I assign it statically?
      3. How do I understand the above output on the serial monitor?
      XanderX Offline
      XanderX Offline
      Xander
      wrote on last edited by
      #2

      @amitach I have the same setup and I use a MQTT-Client for testing: http://www.jensd.de/wordpress/
      You have to stop OpenHAB, because only one connection to the gateway is possible.
      Usage:

      • start client
      • create a profile: Extras / Connection Profiles
      • connect with this profile
      • click button "Subscribe"
      • choose "Topic" : # (see wildcards: http://mosquitto.org/man/mqtt-7.html )
      • click button "Subscribe" (on the right from field "Topic"

      Now you see all messages from your sensor.

      1 Reply Last reply
      1
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        If you have any questions or comments regarding MQTT.fx please don't hesitate to get in touch with me!

        A 1 Reply Last reply
        2
        • ? A Former User

          If you have any questions or comments regarding MQTT.fx please don't hesitate to get in touch with me!

          A Offline
          A Offline
          Anthony Straw
          wrote on last edited by
          #4

          @Jerady works with older verions of MQTT.fx 0.0.12 on win 7 32 bit .. the newer one is only for 64 bit machine.. cheers

          ? 1 Reply Last reply
          0
          • A amitach

            Hi,

            I have a mqtt gateway running on arduino from mysensors library. I also have an openhab controller running on a raspberry pi connected to the arduino uno through the ethernet shield. I am trying to create my first item on openhab and I understand that the format required is
            MyMQTT/20/0/V_TEMP where 20 and 0 are node id and sensor id respectively.

            I can see following message on the serial monitor

            Started!
            0;0;3;0;9;read: 20-20-0 s=1,c=1,t=16,pt=0,l=1:1

            1. How do I configure the node id and the sensor id?
            2. Is it assigned automatically or do I assign it statically?
            3. How do I understand the above output on the serial monitor?
            A Offline
            A Offline
            Anthony Straw
            wrote on last edited by
            #5

            @amitach im able see on mqttfx on windows with incoming msg of arduino senting temp and hum (MyMQTT/21/0/v_HUM with 41.0 below.. appear to be working on this machine while the openhab is running as server on this pc for testing .... ive check the openhab test.items
            i rename the line...

            String sketch20 "Cupboard Temp [%s °C]" (sketch,all) {mqtt="<[MyMQTT/21/0/V_TEMP:state:default]"}

            nothing is updating....

            A 1 Reply Last reply
            0
            • A Anthony Straw

              @amitach im able see on mqttfx on windows with incoming msg of arduino senting temp and hum (MyMQTT/21/0/v_HUM with 41.0 below.. appear to be working on this machine while the openhab is running as server on this pc for testing .... ive check the openhab test.items
              i rename the line...

              String sketch20 "Cupboard Temp [%s °C]" (sketch,all) {mqtt="<[MyMQTT/21/0/V_TEMP:state:default]"}

              nothing is updating....

              A Offline
              A Offline
              Anthony Straw
              wrote on last edited by
              #6
              This post is deleted!
              1 Reply Last reply
              0
              • A Offline
                A Offline
                Anthony Straw
                wrote on last edited by
                #7

                on the arduino serial monitor showing..

                0;0;3;0;9;read: 21-21-0 s=1,c=1,t=0,pt=7,l=5:21.0
                MyMQTT/21/1/V_TEMP

                30 18 00 12 4D 79 4D 51 54 54 2F 32 31 2F 31 2F 56 5F 54 45 4D 50 32 31 2E 30
                0;0;3;0;9;read: 21-21-0 s=0,c=1,t=1,pt=7,l=5:41.0
                MyMQTT/21/0/V_HUM
                30 17 00 11 4D 79 4D 51 54 54 2F 32 31 2F 30 2F 56 5F 48 55 4D 34 31 2E 30
                0;0;3;0;9;read: 21-21-0 s=0,c=1,t=1,pt=7,l=5:42.0

                1 Reply Last reply
                0
                • A Anthony Straw

                  @Jerady works with older verions of MQTT.fx 0.0.12 on win 7 32 bit .. the newer one is only for 64 bit machine.. cheers

                  ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #8

                  @Anthony-Straw Going to provide a 32 Bit version of MQTT.fx 0.0.14.3 for windows.

                  ? 1 Reply Last reply
                  1
                  • ? A Former User

                    @Anthony-Straw Going to provide a 32 Bit version of MQTT.fx 0.0.14.3 for windows.

                    ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by A Former User
                    #9

                    @Anthony-Straw have a look here: http://www.jensd.de/apps/mqttfx/0.0.14.3/

                    1 Reply Last reply
                    1
                    • A Offline
                      A Offline
                      Anthony Straw
                      wrote on last edited by
                      #10

                      thanks ;-)

                      1 Reply Last reply
                      0
                      • A amitach

                        Hi,

                        I have a mqtt gateway running on arduino from mysensors library. I also have an openhab controller running on a raspberry pi connected to the arduino uno through the ethernet shield. I am trying to create my first item on openhab and I understand that the format required is
                        MyMQTT/20/0/V_TEMP where 20 and 0 are node id and sensor id respectively.

                        I can see following message on the serial monitor

                        Started!
                        0;0;3;0;9;read: 20-20-0 s=1,c=1,t=16,pt=0,l=1:1

                        1. How do I configure the node id and the sensor id?
                        2. Is it assigned automatically or do I assign it statically?
                        3. How do I understand the above output on the serial monitor?
                        D Offline
                        D Offline
                        darazs
                        wrote on last edited by
                        #11

                        @amitach said:

                        Hi,

                        I have a mqtt gateway running on arduino from mysensors library. I also have an openhab controller running on a raspberry pi connected to the arduino uno through the ethernet shield. I am trying to create my first item on openhab and I understand that the format required is
                        MyMQTT/20/0/V_TEMP where 20 and 0 are node id and sensor id respectively.

                        I can see following message on the serial monitor

                        Started!
                        0;0;3;0;9;read: 20-20-0 s=1,c=1,t=16,pt=0,l=1:1

                        1. How do I configure the node id and the sensor id?
                        2. Is it assigned automatically or do I assign it statically?
                        3. How do I understand the above output on the serial monitor?

                        You can let the gateway autoassign node IDs or take it in your own hands.

                        What I found useful is to not rely on the automatic assignment but give my nodes a static ID, you can do that by replacing the gw.begin function call by this:

                        gw.begin(NULL, NODE_ID, false);
                        

                        where NODE_ID is your chosen ID (you can use "#define NODE_ID 12" for example to specify it before).

                        The sensor ID is specified by you. So in each example you see a line something like this:

                        MyMessage msgMotion(CHILD_ID_MOTION, V_TRIPPED);
                        

                        where the first argument (here CHILD_ID_MOTION) specifies the sensor ID that will be sent along your message. You can, again, use #define to define a number in the top of your sketch.

                        The serial output was a mystery to me as well until I looked up the printout in the libraries/MySensors/MySensors.cpp file. It's constructed like this:

                        debug(PSTR("read: %d-%d-%d s=%d,c=%d,t=%d,pt=%d,l=%d:%s\n"),
                        			msg.sender, msg.last, msg.destination,  msg.sensor, mGetCommand(msg), msg.type, mGetPayloadType(msg), mGetLength(msg), msg.getString(convBuf)); 
                        

                        So it's the sender's node ID, then probably the next hop's node ID, then the destination's node ID, then s=sensor ID, command type?, the message type (like V_TRIPPED, but as a number), payload type, length of the message, the message itself.

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


                        9

                        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