Skip to content
  • 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
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

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.
  • Z Offline
    Z Offline
    Zeph
    Hero Member
    wrote on last edited by Zeph
    #30

    The other extension that occurs to me, in the gateway-as-transparent-switch model, is that if we ever wanted to encode binary values OTA from the gateway to the node, the plug-in would have to tell the gateway which payload_type to use. In the Semicolon Separted Values format, that could be another parameter, eg:

    <node id>;<child id>;<command>;<ack>;<v_code>;<payload_type>;<value>
    

    Or it could be added to one of the other fields with a comma sub-delimiter, etc.

    How would a controller plug in tell the MQTT gateway to use payload type P_UNIT16 to send to node 7?

    I'm thinking that it would be done in the value string, rather than encoded into the topic. So maybe the value string goes from "321" to "4,321" or something like that.

    1 Reply Last reply
    0
    • JohnJ Offline
      JohnJ Offline
      John
      Plugin Developer
      wrote on last edited by
      #31

      @Damme
      What happens if a node does not receive it's address when it requests one (because of failed send). It is not registered within the broker?

      My Domotica project: http://www.pidome.org

      1 Reply Last reply
      0
      • DammeD Damme

        @ToSa I'll update mqtt later with option to not translate V_TYPE into name string but to keep it as a byte, that would save a lot of memory and might solve problem you have. I'll keep you posted

        T Offline
        T Offline
        ToSa
        Code Contributor
        wrote on last edited by
        #32

        @Damme said:

        @ToSa I'll update mqtt later with option to not translate V_TYPE into name string but to keep it as a byte, that would save a lot of memory and might solve problem you have. I'll keep you posted

        I could not follow the discussions the last few days - will definitely have a look over the weekend and let you know if that worked. Thanks!

        1 Reply Last reply
        0
        • JohnJ Offline
          JohnJ Offline
          John
          Plugin Developer
          wrote on last edited by
          #33

          @Damme
          When the MQTT gateway prints information about itself like "started", is this done with node id 0 or 255?

          My Domotica project: http://www.pidome.org

          DammeD 1 Reply Last reply
          0
          • JohnJ John

            @Damme
            When the MQTT gateway prints information about itself like "started", is this done with node id 0 or 255?

            DammeD Offline
            DammeD Offline
            Damme
            Code Contributor
            wrote on last edited by
            #34

            @John 'started' is only a internal log message, I've changed how that part works.

            I've also fixed a couple of bugs and will test the changes tomorrow before I publish them.
            New functionallity there user can choose of MQTT should translate ID to V_TYPE or not too.

            1 Reply Last reply
            0
            • JohnJ Offline
              JohnJ Offline
              John
              Plugin Developer
              wrote on last edited by
              #35

              @Damme
              Ok, my plugin will then just try to reconnect.

              Ok, i will check that then probably the day after tomorrow, i will make my code take no translation as first and if not found try the naming (internally), because the server takes over the semantics anyway because it also is going to include a MQTT broker service.

              Currently the MQTT implementation is being tested with an end user. Maybe he will help test the new possibility without V_TYPE translation when your changes are implemented.

              My Domotica project: http://www.pidome.org

              1 Reply Last reply
              0
              • JohnJ Offline
                JohnJ Offline
                John
                Plugin Developer
                wrote on last edited by
                #36

                @Damme
                When does exactly the messages like "MyMQTT/[NODEID]/255/V_SKETCH_NAME" and/or "MyMQTT/[NODEID]/255/V_SKETCH_VERSION" appear? is this only when an address is assigned or always when a node is started?

                My Domotica project: http://www.pidome.org

                DammeD 1 Reply Last reply
                0
                • JohnJ John

                  @Damme
                  When does exactly the messages like "MyMQTT/[NODEID]/255/V_SKETCH_NAME" and/or "MyMQTT/[NODEID]/255/V_SKETCH_VERSION" appear? is this only when an address is assigned or always when a node is started?

                  DammeD Offline
                  DammeD Offline
                  Damme
                  Code Contributor
                  wrote on last edited by Damme
                  #37

                  @John then node is started, There was a bug not processing that message which is fixed now.
                  hasn't been pulled to official yet but can be found at https://github.com/Damme/MQTTGateway/commit/f10843f5efd9c37900624fe57275be11c69e3942

                  JohnJ 1 Reply Last reply
                  0
                  • DammeD Damme

                    @John then node is started, There was a bug not processing that message which is fixed now.
                    hasn't been pulled to official yet but can be found at https://github.com/Damme/MQTTGateway/commit/f10843f5efd9c37900624fe57275be11c69e3942

                    JohnJ Offline
                    JohnJ Offline
                    John
                    Plugin Developer
                    wrote on last edited by
                    #38

                    @Damme
                    Thnx, was struggling with this with a user. Will need to wait for the next release :).

                    My Domotica project: http://www.pidome.org

                    1 Reply Last reply
                    0
                    • FrancoisF Offline
                      FrancoisF Offline
                      Francois
                      wrote on last edited by
                      #39

                      @Damme when will the new release be available?

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        adrianmihai83
                        wrote on last edited by adrianmihai83
                        #40

                        Dear colleagues,

                        I have been using OpenHAB for a couple of days now, everything is going the right way, I've been using it with mosquitto broker for Windows, everything is solid, working well an fast. Decided to go a step further and use the MQTT Gateway presented here.

                        I've made a MQTT Gateway but get the "Not connected to broker" message from OpenHAB. First of all, the Gateway is an arduino uno with a w5100 shield on top in which I inserted the RF module (NRF24L01). Configured my ip in the gateway sketch (192.168.1.11) and uploaded to the arduino.

                        The first test was to connect with a phone (using MQTT from Playstore - used it many times before) and with a PC (using WMQTT Utility - used it many times before) and things don't look that promising, the problem beeing that client somethimes disconnects, and I cannot receive the message published in a topic (topic that I am subscribed to on the phone, pc and tablet using MQTT clients). I somethimes get the message in the serial monitor of the arduino, somethimes not.

                        Configured openhab.cfg to use the mqtt broker at 192.168.1.11 (before I was using mosquitto on pc 192.168.1.10 and working without problems) and everythime I change state of something in the dashboard of openhab I get this Broker Connection not Started even if after starting openhab I get serial output from arduino for some time, after this everything drops. Here is the serial output:serial_output.txt

                        Last two entries are: I opened the MQTT client on my phone, connected to MQTT Gateway and subscribed to topic home/# and the last one is me publishing from the phone to topic home/test the message "test message". None of the messages come back to the clients on the phone, tablet, pc, all of them subscribed to home/#

                        And here is the output from openhab: openhab_output.txt Ignore the samsung connect stuff, I have pull it off the network, i have managed to get it working well.

                        Best regards,

                        Adrian

                        1 Reply Last reply
                        0
                        • DammeD Offline
                          DammeD Offline
                          Damme
                          Code Contributor
                          wrote on last edited by Damme
                          #41

                          @adrianmihai83 "home/openHAB/out/Temperature_GF_Corridor/state" is probobly long string, 47 chars. I have not investigated exacly how long it can be but keep it short. And the adress layout is also wrong, is should be something like MyMQTT/21/1/V_LIGHT . MQTTGateway is not compatible with the mosquitto broker you're using.

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            adrianmihai83
                            wrote on last edited by adrianmihai83
                            #42

                            @Damme , your instructions were highly appreciated, got it working the first time. I will start creating the network now, I guess that everything will be ok. Will follow this forum for info and knowledge.

                            Now I will migrate openHAB to Rasberry Pi and add all the sensors one by one, there are a few.

                            A question though: I am using the humidity sketch and get MyMQTT/0/1/V_TEMP and MyMQTT/0/0/V_HUM reading fine but I cannot get sketch name... I don't know what I am doing wrong... Read above and I guess I have to wait for new version?

                            Thank you.

                            Adrian

                            Edit: Read more about Rasbery Pi capabilities regarding openHAB and I think I will use a cubietruck... Does anybody use one, cubieboard 2 or cubietruck?

                            DammeD 1 Reply Last reply
                            0
                            • A adrianmihai83

                              @Damme , your instructions were highly appreciated, got it working the first time. I will start creating the network now, I guess that everything will be ok. Will follow this forum for info and knowledge.

                              Now I will migrate openHAB to Rasberry Pi and add all the sensors one by one, there are a few.

                              A question though: I am using the humidity sketch and get MyMQTT/0/1/V_TEMP and MyMQTT/0/0/V_HUM reading fine but I cannot get sketch name... I don't know what I am doing wrong... Read above and I guess I have to wait for new version?

                              Thank you.

                              Adrian

                              Edit: Read more about Rasbery Pi capabilities regarding openHAB and I think I will use a cubietruck... Does anybody use one, cubieboard 2 or cubietruck?

                              DammeD Offline
                              DammeD Offline
                              Damme
                              Code Contributor
                              wrote on last edited by
                              #43

                              @adrianmihai83 Sketch-name was a bug that I fixed in development branch, thought @hek updated master branch also. I can post the fix later on in here.

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                adrianmihai83
                                wrote on last edited by
                                #44

                                Maybe a dumb question but I don't figure things, here is my problem:

                                Uploaded the relay sketch to the same arduino that I used for humidity/temperature node (I don't know if this is relevant, the network has only one node, this one). Modified the pin that the relay is connected to: #define RELAY_1 4.

                                I am using the MQTT Gateway openHAB and cannot activate the relay...

                                Serial output of relay sketch is:
                                repeater started, id 0
                                send: 0-0-0-0 s=255,c=0,t=18,pt=0,l=3,st=ok:1.4
                                send: 0-0-0-0 s=255,c=3,t=6,pt=1,l=1,st=ok:0
                                send: 0-0-0-0 s=255,c=3,t=11,pt=0,l=5,st=ok:Relay
                                send: 0-0-0-0 s=255,c=3,t=12,pt=0,l=3,st=ok:1.0
                                send: 0-0-0-0 s=1,c=0,t=3,pt=0,l=3,st=ok:1.4

                                Serial output of gateway is:
                                Started!
                                0;0;3;0;9;read: 0-0-0 s=255,c=0,t=18,pt=0,l=3:1.4
                                0;0;3;0;9;read: 0-0-0 s=255,c=3,t=6,pt=1,l=1:0
                                0;0;3;0;9;read: 0-0-0 s=255,c=3,t=11,pt=0,l=5:Relay
                                0;0;3;0;9;read: 0-0-0 s=255,c=3,t=12,pt=0,l=3:1.0
                                0;0;3;0;9;read: 0-0-0 s=1,c=0,t=3,pt=0,l=3:1.4

                                My openHAB configuration is:

                                Switch node2_sw1 "sw2" (node2,all) {mqtt=">mysensor:MyMQTT/0/1/V_LIGHT:command:ON:1],>[mysensor:MyMQTT/0/1/V_LIGHT:command:OFF:0]"}

                                What am I doing wrong?

                                Thank you!

                                1 Reply Last reply
                                0
                                • FrancoisF Offline
                                  FrancoisF Offline
                                  Francois
                                  wrote on last edited by
                                  #45

                                  If I run the MQTTGateway my temperature shows in fahrenheit when I run the same nodes on a SerialGateway it is showing Celsius why will this be the case?

                                  1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    adrianmihai83
                                    wrote on last edited by adrianmihai83
                                    #46

                                    Downloaded from https://github.com/Damme/MQTTGateway latest MQTT Gateway (the one that responds on serial with "Ok!" not "Started!", with the modifications to MySensors.cpp) but no difference, still no sketch name and with the above settings, openHAB cannot control the relay sensor...

                                    I used the same arduino that is working with Temp_Humidity sensor so the setup is good, the relay pins are specified in the sketch. I used the Clean_Eeprom_Config before uploading, I even used other Arduino Uno, no diffrerence, still cannot control the relay sensor from openHAB.

                                    Anyone has a clue, a hint or something? The serial output from both the sensor and the gateway, together with openHAB configuration are two posts up.

                                    Edit: 3 hours later and managed to make many of the sensors (Door, Distance, Dust, Gas, Humidity, Light, Motion) everyone working in conjunction with MQTT Gateway and openHAB except the Relay one...

                                    Any help is appreciated.

                                    Regards,
                                    Adrian

                                    1 Reply Last reply
                                    0
                                    • A Offline
                                      A Offline
                                      adrianmihai83
                                      wrote on last edited by
                                      #47

                                      Callback for incomming messages does not occur so I guess that the message does not get to the relay sensor. Is there someone that is using this with MQTT Gateway and openHAB?

                                      1 Reply Last reply
                                      0
                                      • FrancoisF Offline
                                        FrancoisF Offline
                                        Francois
                                        wrote on last edited by Francois
                                        #48

                                        @adrianmihai83 I was testing this today and it was working with the MQTTGateway. Here is my config file same as above:

                                        Switch node2_sw2 "Study Lights" (node2,all) { mqtt=">[mysensor:MyMQTT/2/1/V_LIGHT:command:ON:1],>[mysensor:MyMQTT/2/1/V_LIGHT:command:OFF:0],<[mysensor:MyMQTT/2/1/V_LIGHT:command:MAP(1on0off.map)]" }

                                        Here is the info from the serial port monitor.

                                        upload-805fea56-06b2-4632-a2c0-fb8cd80a8ec5

                                        1 Reply Last reply
                                        0
                                        • A Offline
                                          A Offline
                                          adrianmihai83
                                          wrote on last edited by adrianmihai83
                                          #49

                                          Will test it tomorrow morning and come back with result, what i see is exactly the same configuration, the only difference is that your's is on the 3'rd node and mine on 1'st node. Anyway, will see.

                                          Thank you for your answer.

                                          I am still waiting for my other NRF24L01 ( I ordered 30 pcs), they will arive this week. Maybe there is a problem running the sketch on node one, id 0. Tomorrow I will go and buy 2 of the NRF24 from a store even if they are 4 times more expensive, this not working is killing me :)

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


                                          17

                                          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
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular