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. MQTT Broker gateway

MQTT Broker gateway

Scheduled Pinned Locked Moved Controllers
132 Posts 34 Posters 115.6k Views 7 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.
  • siodS Offline
    siodS Offline
    siod
    wrote on last edited by
    #116

    Hi guys,

    I dind´t read all comments so I hope this wasn´t answered before: I would like to know how to setup an arduino + NRF24L01 Node:

    • how to initialize the node
    • what should the Arduino sketch look like to start MQTT

    Thanks for your help!!

    still learning...

    1 Reply Last reply
    0
    • siodS Offline
      siodS Offline
      siod
      wrote on last edited by
      #117

      Ok,forget my last post, I have a new problem:

      When I uplaod the EthernetGW Sketch to my arduino nano I can see MQTT messages coming in from one node int the arduino serial monitor. So now I uploaded the MQTTGW sketch to my nano because I would like to use openhab. But after uploading the sketch all info I get from serial monitor is "Started!", nothing else is showing up.
      I can still ping the MQTT gateway but it seems like it´s not receiving any mqtt message, at least no the state of my node. Could you please help and support me here? Thanks in advance!

      still learning...

      1 Reply Last reply
      0
      • siodS Offline
        siodS Offline
        siod
        wrote on last edited by
        #118

        nobody experiencing this problem? Any idea how I could start fixing this? Pls help!

        still learning...

        1 Reply Last reply
        0
        • engyE Offline
          engyE Offline
          engy
          wrote on last edited by
          #119

          Hello,

          I have made this gateway with W5100.
          Everything looks OK, except random connection failures.
          Clients - MyMQTT (android), Openhab are loosing contact with the broker time after time.
          The issue can occur every 5 - 60 mins.

          Any ideas what could be the problem?

          Thank you in advance.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            drock1985
            wrote on last edited by
            #120

            Hi,

            Was hoping someone could help a MQTT and openHab newb here. i have Openhab configured and running with Phillips Hue and Wemo, and trying to integrate MySensors. I build the 1.5 version MQTT gateway using the W5100 module, and all is working (can ping the gateway noproblem, and receiving data from a sensor). The problem is, i'm not sure how to add the line into the items and sitemap file....

            Here is the output that I am getting from the MQTT serial monitor. The sensor I have connected is a 3-in-1 with motion PIR, and DHT22 temp/humid and a hard configured Node_ID of 3 (or, should be).

            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:23.3
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:44.1
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:23.2
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:44.0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:43.9
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:44.0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:23.3
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:44.1
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:23.2
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:43.9
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:23.3
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:44.0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:44.1
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:44.0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:44.1
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:44.0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:44.1
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:44.0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:44.1
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:44.0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:44.1
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:44.0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:23.4
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
            

            Can someone help me get the information to display in OpenHab? Please.

            My Projects
            2 Door Chime Sensor
            Washing Machine Monitor

            1 Reply Last reply
            0
            • dakkyD Offline
              dakkyD Offline
              dakky
              wrote on last edited by
              #121
              Contact contact_99        "Contact node 99 sensor 3: [MAP(de.map):%s]"        { mqtt="<[mysensors:sensor-gw1-out/99/3/1/0/16:state:MAP(mqttToCloseOpen.map)]" }
              

              this is an item which
              reads a message from mqtt broker:

              • < input, reads message
              • mysensors => mqtt connection as decribes in opnehab.cfg
              • sensor-gw1-out => topics as configured in your mqtt gateway sketch
              • 99/3/1/0/16 have a look at serial api: node 99, child 3 etc

              I found it very helpful to subscribe myself to the mqtt broker and read the incoming messages there

              Controller: Raspberry Pi 2 :: Openhab2 :: with @TimO MySensors Binding
              Gateway: Arduino MEGA 2560 R3 :: W5100 :: Ethernet GW

              Software: MySensors 2.0development

              1 Reply Last reply
              0
              • D Offline
                D Offline
                drock1985
                wrote on last edited by
                #122

                Hi @dakky

                Thanks for the help. So far, I can get my temperature and humidity to update, but I cannot get my motion sensor on the same node to update at all.

                Here are the lines I have in default.items

                /* MySensors MQTT */
                Number		node1_temp					"Temp [%.1f °C]"     						(node1)		{mqtt="<[mysensor:MyMQTT/1/1/V_TEMP:state:default]"}
                Number		node1_humid					"Humid [%.1f %%Rh]" 						(node1)		{mqtt="<[mysensor:MyMQTT/1/0/V_HUM:state:default]"}
                Contact 	node1_motion        		"Motion Sensor 3: [MAP(1on0off.map):%s]"     (node1)	{ mqtt="<[mysensors:MyMQTT/1/2/V_TRIPPED:state:MAP(1on0off.map)]" }
                

                And here is my default.sitemap file

                Frame label="Sensor Data" {
                        Text label="Sensors" icon="mysensors" {
                		Group item=node1 label="Man Cave Climate" icon="temperature" 
                		Chart item=node1_humid period=W refresh=10000
                		}
                

                And finally, this is what I am reading from screen when the message appear on the MQTT broker sketch. The node_id is 1, not 3 like I originally though.

                >>30 17 00 14 4D 79 4D 51 54 54 2F 31 2F 32 2F 56 5F 54 52 49 50 50 45 44 30
                0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5,sg=0:47.1
                                                                    MyMQTT/1/0/V_HUM
                >>30 16 00 10 4D 79 4D 51 54 54 2F 31 2F 30 2F 56 5F 48 55 4D 34 37 2E 31
                0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
                                                                  MyMQTT/1/2/V_TRIPPED
                >>30 17 00 14 4D 79 4D 51 54 54 2F 31 2F 32 2F 56 5F 54 52 49 50 50 45 44 30
                0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
                                                                  MyMQTT/1/2/V_TRIPPED
                >>30 17 00 14 4D 79 4D 51 54 54 2F 31 2F 32 2F 56 5F 54 52 49 50 50 45 44 30
                0;0;3;0;9;read: 1-1-0 s=1,c=1,t=0,pt=7,l=5,sg=0:21.8
                                                                    MyMQTT/1/1/V_TEMP
                >>30 17 00 11 4D 79 4D 51 54 54 2F 31 2F 31 2F 56 5F 54 45 4D 50 32 31 2E 38
                0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
                                                                  MyMQTT/1/2/V_TRIPPED
                >>30 17 00 14 4D 79 4D 51 54 54 2F 31 2F 32 2F 56 5F 54 52 49 50 50 45 44 30
                0;0;3;0;9;read: 1-1-0 s=2,c=1,t=16,pt=0,l=1,sg=0:0
                                                                  MyMQTT/1/2/V_TRIPPED
                >>30 17 00 14 4D 79 4D 51 54 54 2F 31 2F 32 2F 56 5F 54 52 49 50 50 45 44 30
                

                Any ideas on what I am missing? Also, when trying to implement persistence, I went with MySQL as per directions here but the data doesn't actually go into the chart. Other than adding mysql to the openhab.cfg file, what else is there? The log isn't showing any errors from what I can see.

                Thanks!

                My Projects
                2 Door Chime Sensor
                Washing Machine Monitor

                1 Reply Last reply
                0
                • dakkyD Offline
                  dakkyD Offline
                  dakky
                  wrote on last edited by dakky
                  #123

                  Typing from tablet => short Version

                  Contact items needs Open or Closed not On vor Off. Make a new map translating 0 to closed etc and it should work. or use the correct item: switch seems a better choice
                  https://github.com/openhab/openhab/wiki/Explanation-of-items#itemtype

                  Controller: Raspberry Pi 2 :: Openhab2 :: with @TimO MySensors Binding
                  Gateway: Arduino MEGA 2560 R3 :: W5100 :: Ethernet GW

                  Software: MySensors 2.0development

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    drock1985
                    wrote on last edited by
                    #124

                    Hi @dakky

                    well, some luck. I made a new map contact.map with
                    0=Closed
                    1=Open
                    -=unknown

                    so far the swtich now shows "Unknown" all the time; but no status updates from the sensor (even though it is showing in serial console as 1, and 0 when it is off).

                    Not sure why it isn't updating like it should now. Might have to reboot the server.

                    My Projects
                    2 Door Chime Sensor
                    Washing Machine Monitor

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      drock1985
                      wrote on last edited by
                      #125

                      Ok, got it. Had to do the following to my items and sitemap to get a PIR to work right:

                      entry in default.items

                      Switchnode6_motion	 "LR Motion Test [MAP(motion.map):%s]"  (FF_Living,All) {mqtt=">[mysensor:MyMQTT/6/1/V_TRIPPED:command:ON:1],>[mysensor:MyMQTT/6/1/V_TRIPPED:command:OFF:0],<[mysensor:MyMQTT/6/1/V_TRIPPED:command:MAP(motion.map)]"}
                      

                      and default.sitemap

                      Text item=node6_motion label="PIR Test LR [%s]" icon="pir"
                      

                      And last, the transform file (named motion.map)

                      1=ON
                      0=OFF
                      

                      At least now it registers the data in text as On or Off. Thanks again @dakky

                      My Projects
                      2 Door Chime Sensor
                      Washing Machine Monitor

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        moskovskiy82
                        wrote on last edited by
                        #126

                        Is there a way to redirect all the messages from the serial console of the wifi gateway to some tcp port so they can be read via putty?

                        1 Reply Last reply
                        0
                        • SoloamS Offline
                          SoloamS Offline
                          Soloam
                          Hardware Contributor
                          wrote on last edited by
                          #127

                          Hello, sorry to reopen this post, but maybe someone can help me! I'm still waiting the arrival of my arduinos to make my nodes and gateways, but I already installed openhab to start configuring the layout and MQTT. All is working, I can post to MTQQ from openhab and used the tutorial on this post to make the same button send and recieve.

                          The problem is that when I click the button with the code "sw2 send + recieve example" openhab enters in loop mode, it seems that keeps sending and reviving the same MTQQ request. I use MQTT.fx to test the MTQQ posts, and when I click the button, the program also crashes and takes my CPU to max.

                          Can any one help me?
                          Best Regards
                          Soloam

                          1 Reply Last reply
                          0
                          • SoloamS Offline
                            SoloamS Offline
                            Soloam
                            Hardware Contributor
                            wrote on last edited by
                            #128

                            Hello, the problem persists, the map function keeps sending the same request over and over again, If I make a click in a few seconds my mqtt client is full of requests, over 500 with the same message. Wasn't it supposed to send only one message for click?

                            1 Reply Last reply
                            0
                            • Y Offline
                              Y Offline
                              yancym
                              wrote on last edited by yancym
                              #129

                              I don't believe you can put both inbound and outbound mqtt messages in the switch definition. This is what creates the infinite loop since you are both sending and receiving on the same message topic. Every time the broker receives the message, it publishes it out to all subscribers. Since your switch item is also a subscriber it picks it up again and the loop continues.

                              Use only inbound in the definition then either a rule and/or proxy item to handle the outbound command. Set your rule definition "when item received command". That way it will only fire when you click on the switch item in openHAB. If you use any other option, ie. received update or changed, it will also continue the infinite loop.

                              Hope this makes sense.

                              1 Reply Last reply
                              0
                              • SoloamS Offline
                                SoloamS Offline
                                Soloam
                                Hardware Contributor
                                wrote on last edited by
                                #130

                                That makes perfect seance, I was only mirroring the solution presented on the 1st post of this topic. I will try your approach!

                                Thank You

                                1 Reply Last reply
                                0
                                • SoloamS Offline
                                  SoloamS Offline
                                  Soloam
                                  Hardware Contributor
                                  wrote on last edited by Soloam
                                  #131

                                  It didn't worked, the rule also changes when I receive the MQTT in openhab:

                                  rule "Send Requst"
                                  when
                                      Item node2_sw2 received command
                                  then
                                  	if(node2_sw2.state == ON){
                                  		sendCommand(node2_sw1,ON)
                                  	}
                                  	else{
                                  		sendCommand(node2_sw1,OFF)
                                  	}
                                   end
                                  

                                  I don't believe this is a new problem to the forum, didn't any one made, a switch on the openhab with inptut and output.

                                  1 Reply Last reply
                                  0
                                  • SoloamS Offline
                                    SoloamS Offline
                                    Soloam
                                    Hardware Contributor
                                    wrote on last edited by
                                    #132

                                    Found the solution tanks to watou user in OpenHab Forum.

                                    Switch node2_sw2  "sw2 send + recieve example"  (node2,all)	  {mqtt=">[mysensor:MyMQTT/21/2/V_LIGHT:command:OFF:0],>[mysensor:MyMQTT/21/2/V_LIGHT:command:ON:1],<[mysensor:MyMQTT/21/2/V_LIGHT:state:MAP(1on0off.map)]"}
                                    

                                    The secret is in the :state: declaration on the MAP!

                                    Thank you all

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