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. Controllers
  3. OpenHAB
  4. My final setup to get MySensors and OpenHab communicating via MQTT

My final setup to get MySensors and OpenHab communicating via MQTT

Scheduled Pinned Locked Moved OpenHAB
mqttopenhab
24 Posts 7 Posters 16.4k Views 13 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.
  • zuolanZ Offline
    zuolanZ Offline
    zuolan
    wrote on last edited by zuolan
    #4

    Eric,
    Thanks for posting. It looks exactly what I need to follow.

    Can you describe how the hardware(Ethernet Shield and nRF24L01, SPI pins) are connected?
    Also where to look for them in the header file?

    Martin TellblomM 1 Reply Last reply
    0
    • zuolanZ zuolan

      Eric,
      Thanks for posting. It looks exactly what I need to follow.

      Can you describe how the hardware(Ethernet Shield and nRF24L01, SPI pins) are connected?
      Also where to look for them in the header file?

      Martin TellblomM Offline
      Martin TellblomM Offline
      Martin Tellblom
      wrote on last edited by
      #5

      @zuolan

      Follow this guide Ethernet Gateway

      MySensors MQTT Client Gateway, Openhab, Dashing, Razberry, 1-wire

      1 Reply Last reply
      0
      • zuolanZ Offline
        zuolanZ Offline
        zuolan
        wrote on last edited by
        #6

        Hi,
        Thanks for the help.

        I keep getting these messages on the COM port for the MQTT Gateway. What does it mean and what should I do to proceed? Thx.

        0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.0.1-beta
        0;255;3;0;9;TSM:INIT
        0;255;3;0;9;!TSM:INIT:TSP FAIL
        0;255;3;0;9;TSM:FAILURE
        0;255;3;0;9;TSM:FAILURE:PDT
        0;255;3;0;9;TSM:FAILURE:RE-INIT
        0;255;3;0;9;TSM:INIT
        0;255;3;0;9;!TSM:INIT:TSP FAIL
        0;255;3;0;9;TSM:FAILURE
        0;255;3;0;9;TSM:FAILURE:PDT
        0;255;3;0;9;TSM:FAILURE:RE-INIT

        1 Reply Last reply
        0
        • zuolanZ Offline
          zuolanZ Offline
          zuolan
          wrote on last edited by
          #7

          Update on this. It seems to be working after I found I did not modify the MyConfig.h being used.
          After uncommenting #define MY_SOFTSPI
          I got below.

          0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.0.1-beta
          0;255;3;0;9;TSM:INIT
          0;255;3;0;9;TSM:INIT:TSP OK
          0;255;3;0;9;TSM:INIT:GW MODE
          0;255;3;0;9;TSM:READY
          IP: 192.168.1.108
          0;255;3;0;9;MCO:REG:NOT NEEDED
          0;255;3;0;9;MCO:BGN:STP
          0;255;3;0;9;MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1
          IP: 192.168.1.108
          0;255;3;0;9;Attempting MQTT connection...
          0;255;3;0;9;MQTT connected
          0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
          0;255;3;0;9;TSF:SANCHK:OK
          IP: 192.168.1.108
          0;255;3;0;9;Attempting MQTT connection...
          0;255;3;0;9;MQTT connected
          0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18

          Martin TellblomM 1 Reply Last reply
          0
          • zuolanZ zuolan

            Update on this. It seems to be working after I found I did not modify the MyConfig.h being used.
            After uncommenting #define MY_SOFTSPI
            I got below.

            0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.0.1-beta
            0;255;3;0;9;TSM:INIT
            0;255;3;0;9;TSM:INIT:TSP OK
            0;255;3;0;9;TSM:INIT:GW MODE
            0;255;3;0;9;TSM:READY
            IP: 192.168.1.108
            0;255;3;0;9;MCO:REG:NOT NEEDED
            0;255;3;0;9;MCO:BGN:STP
            0;255;3;0;9;MCO:BGN:INIT OK,ID=0,PAR=0,DIS=0,REG=1
            IP: 192.168.1.108
            0;255;3;0;9;Attempting MQTT connection...
            0;255;3;0;9;MQTT connected
            0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18
            0;255;3;0;9;TSF:SANCHK:OK
            IP: 192.168.1.108
            0;255;3;0;9;Attempting MQTT connection...
            0;255;3;0;9;MQTT connected
            0;255;3;0;9;Sending message on topic: mygateway1-out/0/255/0/0/18

            Martin TellblomM Offline
            Martin TellblomM Offline
            Martin Tellblom
            wrote on last edited by
            #8

            @zuolan Good that you found the problem. Don't forget to comment out define MY_SOFTSPI again

            MySensors MQTT Client Gateway, Openhab, Dashing, Razberry, 1-wire

            zuolanZ 1 Reply Last reply
            0
            • Martin TellblomM Martin Tellblom

              @zuolan Good that you found the problem. Don't forget to comment out define MY_SOFTSPI again

              zuolanZ Offline
              zuolanZ Offline
              zuolan
              wrote on last edited by zuolan
              #9

              @Martin-Tellblom Something is still not right. I looked at the MQTT messages using

              mosquito_sub -v -t 'mygateway1-out/#'

              I got below:
              mygateway1-out/0/255/0/0/18 2.0.1-beta
              ...
              mygateway1-out/255/255/3/0/3 (null)
              ...
              It seems the (null)is where the message body should have been. So the payload is missing.

              The sensor node is the 'LightSensor' sketch taking an analog data

              // Enable debug prints to serial monitor
              #define MY_DEBUG

              // Enable and select radio type attached
              #define MY_RADIO_NRF24
              //#define MY_RADIO_RFM69

              #include <SPI.h>
              #include <MySensors.h>

              #define CHILD_ID_LIGHT 0
              #define LIGHT_SENSOR_ANALOG_PIN 0

              unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)

              MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
              int lastLightLevel;

              void presentation() {
              // Send the sketch version information to the gateway and Controller
              sendSketchInfo("Light Sensor", "1.0",true);

              // Register all sensors to gateway (they will be created as child devices)
              present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
              }

              void loop()
              {
              int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23;

              Serial.println(lightLevel);
              if (lightLevel != lastLightLevel) {
              send(msg.set(lightLevel));
              lastLightLevel = lightLevel;
              }
              sleep(SLEEP_TIME);
              }

              Why the sensor node is not returning the voltage reading?
              What am I doing wrong?

              Thanks,

              Martin TellblomM 1 Reply Last reply
              0
              • zuolanZ zuolan

                @Martin-Tellblom Something is still not right. I looked at the MQTT messages using

                mosquito_sub -v -t 'mygateway1-out/#'

                I got below:
                mygateway1-out/0/255/0/0/18 2.0.1-beta
                ...
                mygateway1-out/255/255/3/0/3 (null)
                ...
                It seems the (null)is where the message body should have been. So the payload is missing.

                The sensor node is the 'LightSensor' sketch taking an analog data

                // Enable debug prints to serial monitor
                #define MY_DEBUG

                // Enable and select radio type attached
                #define MY_RADIO_NRF24
                //#define MY_RADIO_RFM69

                #include <SPI.h>
                #include <MySensors.h>

                #define CHILD_ID_LIGHT 0
                #define LIGHT_SENSOR_ANALOG_PIN 0

                unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)

                MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
                int lastLightLevel;

                void presentation() {
                // Send the sketch version information to the gateway and Controller
                sendSketchInfo("Light Sensor", "1.0",true);

                // Register all sensors to gateway (they will be created as child devices)
                present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
                }

                void loop()
                {
                int lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23;

                Serial.println(lightLevel);
                if (lightLevel != lastLightLevel) {
                send(msg.set(lightLevel));
                lastLightLevel = lightLevel;
                }
                sleep(SLEEP_TIME);
                }

                Why the sensor node is not returning the voltage reading?
                What am I doing wrong?

                Thanks,

                Martin TellblomM Offline
                Martin TellblomM Offline
                Martin Tellblom
                wrote on last edited by
                #10

                @zuolan
                Hi , mygateway1-out is used when sending commands to MySensors devices. In my setup I have renamed it like this:

                // Set this nodes subscripe and publish topic prefix
                #define MY_MQTT_PUBLISH_TOPIC_PREFIX "MySensors"  //Changed from "MySensors-in"
                #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "MySensors-out"
                

                You should subscribe to the topic that the Gateway is Publishing (i.e MySensors-in)

                MySensors MQTT Client Gateway, Openhab, Dashing, Razberry, 1-wire

                zuolanZ 1 Reply Last reply
                0
                • Martin TellblomM Martin Tellblom

                  @zuolan
                  Hi , mygateway1-out is used when sending commands to MySensors devices. In my setup I have renamed it like this:

                  // Set this nodes subscripe and publish topic prefix
                  #define MY_MQTT_PUBLISH_TOPIC_PREFIX "MySensors"  //Changed from "MySensors-in"
                  #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "MySensors-out"
                  

                  You should subscribe to the topic that the Gateway is Publishing (i.e MySensors-in)

                  zuolanZ Offline
                  zuolanZ Offline
                  zuolan
                  wrote on last edited by
                  #11

                  @Martin-Tellblom
                  OK. I will. Can you post an example of messages you are getting so I have a rough idea?

                  Many thanks.

                  Martin TellblomM 1 Reply Last reply
                  0
                  • zuolanZ zuolan

                    @Martin-Tellblom
                    OK. I will. Can you post an example of messages you are getting so I have a rough idea?

                    Many thanks.

                    Martin TellblomM Offline
                    Martin TellblomM Offline
                    Martin Tellblom
                    wrote on last edited by
                    #12

                    @zuolan
                    This is how my Light sensor present itself and submitting data:

                    MySensors/100/255/0/0/17    2.0.0
                    MySensors/100/255/3/0/6		0
                    MySensors/100/255/3/0/6		Light Sensor
                    MySensors/100/255/3/0/12	1.0
                    MySensors/100/100/0/0/16	null
                    MySensors/100/100/1/0/23	7  <--This is the actual light value
                    

                    So in my case to monitor the light value in openhab I use this address: MySensors/100/100/1/0/23

                    MySensors MQTT Client Gateway, Openhab, Dashing, Razberry, 1-wire

                    zuolanZ 1 Reply Last reply
                    0
                    • Martin TellblomM Martin Tellblom

                      @zuolan
                      This is how my Light sensor present itself and submitting data:

                      MySensors/100/255/0/0/17    2.0.0
                      MySensors/100/255/3/0/6		0
                      MySensors/100/255/3/0/6		Light Sensor
                      MySensors/100/255/3/0/12	1.0
                      MySensors/100/100/0/0/16	null
                      MySensors/100/100/1/0/23	7  <--This is the actual light value
                      

                      So in my case to monitor the light value in openhab I use this address: MySensors/100/100/1/0/23

                      zuolanZ Offline
                      zuolanZ Offline
                      zuolan
                      wrote on last edited by zuolan
                      #13

                      @Martin-Tellblom
                      OK. I am not getting any from 'mygateway1-in/#'. Let me check.

                      Just to be clear, in the above sketch

                      sendSketchInfo("Light Sensor", "1.0",true);

                      send(msg.set(lightLevel));

                      should have caused messages in 'mygateway1-in/#'?

                      Thanks,

                      Martin TellblomM 1 Reply Last reply
                      0
                      • zuolanZ zuolan

                        @Martin-Tellblom
                        OK. I am not getting any from 'mygateway1-in/#'. Let me check.

                        Just to be clear, in the above sketch

                        sendSketchInfo("Light Sensor", "1.0",true);

                        send(msg.set(lightLevel));

                        should have caused messages in 'mygateway1-in/#'?

                        Thanks,

                        Martin TellblomM Offline
                        Martin TellblomM Offline
                        Martin Tellblom
                        wrote on last edited by
                        #14

                        @zuolan
                        Hi.

                        That's correct, whats shown is the presentation and the last row the LightValue, MySensors/100/100/1/0/23

                        First of all I don't think there is any problem at all in your sensor sketch, the only thing I have changed in my is that I have changed is that I added this row:
                        #define MY_NODE_ID 100

                        What I think the problem is that you are subscribing the wrong topic:

                        As I mentioned before my MQTT settings are:

                        // Set this nodes subscripe and publish topic prefix
                        #define MY_MQTT_PUBLISH_TOPIC_PREFIX "MySensors"
                        #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "MySensors-out"
                        

                        Observerve that the MQTT topics is case sensative ie MySensors is NOT the same as mysensors.

                        I use MQTT-SPY (java based listener) to look at the messages and here you can look at every message sent when subscribing to # (And there is a BIG differense if you publish to MySensors or /MySensors). I suggest that you use MQTT-SPY and subscribe to both /# and # and that should catch all messages that comes to your broker (exept system messages)

                        Here you can se the differense between using the correct upper and lowercase and not. The first picture subribes to MySensors/#
                        alt text

                        And this one subscribes to mysensors/#
                        alt text

                        MySensors MQTT Client Gateway, Openhab, Dashing, Razberry, 1-wire

                        zuolanZ 3 Replies Last reply
                        0
                        • Martin TellblomM Martin Tellblom

                          @zuolan
                          Hi.

                          That's correct, whats shown is the presentation and the last row the LightValue, MySensors/100/100/1/0/23

                          First of all I don't think there is any problem at all in your sensor sketch, the only thing I have changed in my is that I have changed is that I added this row:
                          #define MY_NODE_ID 100

                          What I think the problem is that you are subscribing the wrong topic:

                          As I mentioned before my MQTT settings are:

                          // Set this nodes subscripe and publish topic prefix
                          #define MY_MQTT_PUBLISH_TOPIC_PREFIX "MySensors"
                          #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "MySensors-out"
                          

                          Observerve that the MQTT topics is case sensative ie MySensors is NOT the same as mysensors.

                          I use MQTT-SPY (java based listener) to look at the messages and here you can look at every message sent when subscribing to # (And there is a BIG differense if you publish to MySensors or /MySensors). I suggest that you use MQTT-SPY and subscribe to both /# and # and that should catch all messages that comes to your broker (exept system messages)

                          Here you can se the differense between using the correct upper and lowercase and not. The first picture subribes to MySensors/#
                          alt text

                          And this one subscribes to mysensors/#
                          alt text

                          zuolanZ Offline
                          zuolanZ Offline
                          zuolan
                          wrote on last edited by
                          #15

                          @Martin-Tellblom
                          Thanks again.

                          I installed mqttspy and changed #define MY_NODE_ID 100.

                          I subscribe to the following topics:
                          mygateway1-in
                          /#

                          I'm still not getting any messages in mygateway1-in.
                          Especially not this one: "MySensors/100/255/3/0/6 Light Sensor" that you are getting.
                          All the messages I can see still in mygateway1-out/255/255/3/0/3 topic.
                          So I think data from my Light Sensor node is not getting through.

                          Your thoughts? And how to debug this?

                          On the COM port of the Light Sensor I got below. Do you see any indication showing it is sending data to mqtt? What about the !TSM:FALILURE?

                          !TSM:CHKID:FAIL (ID=255)
                          !TSM:FAILURE

                          TSM:PDT
                          TSM:INIT
                          TSM:RADIO:OK
                          TSM:FPAR
                          TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                          TSP:MSG:READ 0-0-255 s=255,c=3,t=8,pt=1,l=1,sg=0:0
                          TSP:MSG:FPAR RES (ID=0, dist=0)
                          TSP:MSG:PAR OK (ID=0, dist=1)
                          TSM:FPAR:OK
                          TSM:ID
                          TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
                          TSM:ID
                          TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
                          TSM:ID
                          TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
                          TSM:ID
                          TSP:MSG:SEND 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,ft=0,st=ok:
                          !TSM:CHKID:FAIL (ID=255)
                          !TSM:FAILURE
                          TSM:PDT
                          TSM:INIT
                          TSM:RADIO:OK
                          TSM:FPAR

                          1 Reply Last reply
                          0
                          • Martin TellblomM Martin Tellblom

                            @zuolan
                            Hi.

                            That's correct, whats shown is the presentation and the last row the LightValue, MySensors/100/100/1/0/23

                            First of all I don't think there is any problem at all in your sensor sketch, the only thing I have changed in my is that I have changed is that I added this row:
                            #define MY_NODE_ID 100

                            What I think the problem is that you are subscribing the wrong topic:

                            As I mentioned before my MQTT settings are:

                            // Set this nodes subscripe and publish topic prefix
                            #define MY_MQTT_PUBLISH_TOPIC_PREFIX "MySensors"
                            #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "MySensors-out"
                            

                            Observerve that the MQTT topics is case sensative ie MySensors is NOT the same as mysensors.

                            I use MQTT-SPY (java based listener) to look at the messages and here you can look at every message sent when subscribing to # (And there is a BIG differense if you publish to MySensors or /MySensors). I suggest that you use MQTT-SPY and subscribe to both /# and # and that should catch all messages that comes to your broker (exept system messages)

                            Here you can se the differense between using the correct upper and lowercase and not. The first picture subribes to MySensors/#
                            alt text

                            And this one subscribes to mysensors/#
                            alt text

                            zuolanZ Offline
                            zuolanZ Offline
                            zuolan
                            wrote on last edited by
                            #16

                            @Martin-Tellblom

                            I actually have the problem below solved. Since I already finished writing, so I am leaving this here for other people.

                            More information on this.

                            Although the Light Sensor data is not getting through, the Light Sensor node does cause all these MQTT messages to be sent.

                            Before I turn on the Light Sensor node, there is no MQTT message on the mqttspy and on the GatewayW5100MQTTClient COM port it is very quiet and I got this:
                            0_1472865801909_upload-09c39b2c-b30d-4e72-ad66-cfebf0e577f9

                            After I turn on the Light Sensor node the MQTT messages started comming and on the GatewayW5100MQTTClient COM port:

                            0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0)
                            0;255;3;0;9;TSM:INIT
                            0;255;3;0;9;TSM:RADIO:OK
                            0;255;3;0;9;TSM:GW MODE
                            0;255;3;0;9;TSM:READY
                            IP: 192.168.1.108
                            0;255;3;0;9;No registration required
                            0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
                            IP: 192.168.1.108
                            0;255;3;0;9;Attempting MQTT connection...
                            0;255;3;0;9;MQTT connected
                            0;255;3;0;9;TSP:SANCHK:OK
                            0;255;3;0;9;TSP:SANCHK:OK
                            0;255;3;0;9;TSP:SANCHK:OK
                            0;255;3;0;9;TSP:SANCHK:OK

                            <<Light Sensor Turned on>>

                            0;255;3;0;9;TSP:MSG:READ 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
                            0;255;3;0;9;TSP:MSG:BC
                            0;255;3;0;9;TSP:MSG:FPAR REQ (sender=255)
                            0;255;3;0;9;TSP:CHKUPL:OK
                            0;255;3;0;9;TSP:MSG:GWL OK
                            0;255;3;0;9;TSP:MSG:SEND 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0
                            0;255;3;0;9;TSP:MSG:READ 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
                            0;255;3;0;9;TSP:MSG:BC
                            0;255;3;0;9;TSP:MSG:FPAR REQ (sender=255)
                            0;255;3;0;9;TSP:CHKUPL:OK (FLDCTRL)
                            0;255;3;0;9;TSP:MSG:GWL OK
                            0;255;3;0;9;TSP:MSG:SEND 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0
                            0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                            0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3
                            0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                            0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3
                            0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                            0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3
                            0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                            0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3
                            0;255;3;0;9;TSP:MSG:READ 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
                            0;255;3;0;9;TSP:MSG:BC
                            0;255;3;0;9;TSP:MSG:FPAR REQ (sender=255)
                            0;255;3;0;9;TSP:CHKUPL:OK
                            0;255;3;0;9;TSP:MSG:GWL OK
                            0;255;3;0;9;TSP:MSG:SEND 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=bc:0
                            0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                            0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3
                            0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                            0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3
                            0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                            0;255;3;0;9;Sending message on topic: mygateway1-out/255/255/3/0/3
                            0;255;3;0;9;TSP:MSG:READ 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
                            .......

                            So question is why the messages from Light Sensor do not get through (or I am still not capturing them) while causing messages being sent on mygateway1-out/255/255/3/0/3?

                            See next post.

                            1 Reply Last reply
                            0
                            • Martin TellblomM Martin Tellblom

                              @zuolan
                              Hi.

                              That's correct, whats shown is the presentation and the last row the LightValue, MySensors/100/100/1/0/23

                              First of all I don't think there is any problem at all in your sensor sketch, the only thing I have changed in my is that I have changed is that I added this row:
                              #define MY_NODE_ID 100

                              What I think the problem is that you are subscribing the wrong topic:

                              As I mentioned before my MQTT settings are:

                              // Set this nodes subscripe and publish topic prefix
                              #define MY_MQTT_PUBLISH_TOPIC_PREFIX "MySensors"
                              #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "MySensors-out"
                              

                              Observerve that the MQTT topics is case sensative ie MySensors is NOT the same as mysensors.

                              I use MQTT-SPY (java based listener) to look at the messages and here you can look at every message sent when subscribing to # (And there is a BIG differense if you publish to MySensors or /MySensors). I suggest that you use MQTT-SPY and subscribe to both /# and # and that should catch all messages that comes to your broker (exept system messages)

                              Here you can se the differense between using the correct upper and lowercase and not. The first picture subribes to MySensors/#
                              alt text

                              And this one subscribes to mysensors/#
                              alt text

                              zuolanZ Offline
                              zuolanZ Offline
                              zuolan
                              wrote on last edited by
                              #17

                              @Martin-Tellblom
                              Your advice of changing the MY_NODE_ID made the difference. I foolishly left it in the MyConfig.h file so it is conflicting with the gateway.

                              0_1472868188693_upload-d04ad5d6-6464-4ea1-a04b-7041c0c69d11
                              So on mqttspy I now get this!!!!!!!!!!!!!!!!!!!!!!!!!!!
                              0_1472868619367_upload-c2f43e88-cef2-4e4d-ab66-4630557a3035

                              Thanks so much for helping me.

                              1 Reply Last reply
                              0
                              • zuolanZ Offline
                                zuolanZ Offline
                                zuolan
                                wrote on last edited by
                                #18

                                On the topic of editing header files, I found (maybe this is obvious for other people) many including the #define MY_SOFTSPI should be done in the sketch (before the corresponding header file is included?). In this way you don't have to worry about changing it back or conflict.
                                0_1472869645982_upload-baa7801e-73be-4043-939f-26d87b164866

                                1 Reply Last reply
                                0
                                • Martin TellblomM Offline
                                  Martin TellblomM Offline
                                  Martin Tellblom
                                  wrote on last edited by
                                  #19

                                  Thats good that you found the problem.

                                  MySensors MQTT Client Gateway, Openhab, Dashing, Razberry, 1-wire

                                  1 Reply Last reply
                                  0
                                  • zuolanZ Offline
                                    zuolanZ Offline
                                    zuolan
                                    wrote on last edited by zuolan
                                    #20

                                    Thanks.

                                    I now try to get MQTT to talk to openhab by following the RelayActuator example. I only have the openhab demo running.

                                    I am not sure I have enough information in the above instruction to comple the mqtt.items file. For the following MQTT topics setup of mine,

                                    0_1472974737805_upload-cf617565-c688-456b-b996-24ef8efdf40b

                                    I will try the following for the first line:
                                    String Garage_Door "Garage Door [%s]" (gGarage, Windows) {mqtt="<[broker:mygateway1-out/102/1/1/0/2:state:MAP(1closed0open.map)]"}

                                    For the second line I am really stuck about how the do the "/2/2/0/0/2/"part:
                                    Switch MQTTTestSwitch "MQTT Test Switch" (gBasement) {mqtt=">[broker:mygateway1-in/2/2/0/0/2:command:ON:1],>[broker:mygateway1-in/2/2/0/0/2:command:OFF:0]"}

                                    How should one figure out?
                                    OK. To answer my own question the information is clearly here:
                                    https://www.mysensors.org/download/serial_api_20#sensor-types

                                    I will be reading up.

                                    1 Reply Last reply
                                    0
                                    • Meshx86M Offline
                                      Meshx86M Offline
                                      Meshx86
                                      wrote on last edited by
                                      #21

                                      My delimma here is Address distribution, i can't get openhab to distribute Address to the nodes when connecting, the MQTT Gateway sketch of my sensors doesn't do that right ?

                                      Any tips that would be great

                                      1 Reply Last reply
                                      0
                                      • Martin TellblomM Offline
                                        Martin TellblomM Offline
                                        Martin Tellblom
                                        wrote on last edited by
                                        #22

                                        @Meshx86 said:

                                        s distribution, i can't get openhab to distribute Address to the nodes when connecting, the MQTT Gateway sketch of my sensors doesn't do that right ?

                                        Any tips that would be great

                                        Set a static node id using

                                        #define  MY_NODE_ID 20  
                                        

                                        20 in this case is the node id.

                                        MySensors MQTT Client Gateway, Openhab, Dashing, Razberry, 1-wire

                                        Meshx86M 1 Reply Last reply
                                        0
                                        • Martin TellblomM Martin Tellblom

                                          @Meshx86 said:

                                          s distribution, i can't get openhab to distribute Address to the nodes when connecting, the MQTT Gateway sketch of my sensors doesn't do that right ?

                                          Any tips that would be great

                                          Set a static node id using

                                          #define  MY_NODE_ID 20  
                                          

                                          20 in this case is the node id.

                                          Meshx86M Offline
                                          Meshx86M Offline
                                          Meshx86
                                          wrote on last edited by
                                          #23

                                          @Martin-Tellblom cheers

                                          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