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. Troubleshooting
  3. N00b + MQTT gw + openHAB2

N00b + MQTT gw + openHAB2

Scheduled Pinned Locked Moved Troubleshooting
26 Posts 5 Posters 6.8k Views 5 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.
  • gohanG Offline
    gohanG Offline
    gohan
    Mod
    wrote on last edited by
    #12

    Your sketch seems ok, just make it ethernet gateway instead of mqtt.
    UDP and controller IP are nor necessary.

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      Qu3Uk
      wrote on last edited by
      #13

      I use MQTT and Openhab2 - I find it more flexible then the Ethernet GW but yes you need to have a good understanding on all systems I suppose.

      Somethings to note

      • MySensors binding doesn't support MQTT gateway as far as I know, you need to use the MQTT binding and configure your OH items accordingly.
      • MySensors binding is in the IOT market place and not openhab-addons
      • You'll need to assign node ID to your nodes manually.

      Not entirely sure what your problem is here but don't think you've got all the right pieces for the puzzle yet.

      gohanG 1 Reply Last reply
      0
      • Q Qu3Uk

        I use MQTT and Openhab2 - I find it more flexible then the Ethernet GW but yes you need to have a good understanding on all systems I suppose.

        Somethings to note

        • MySensors binding doesn't support MQTT gateway as far as I know, you need to use the MQTT binding and configure your OH items accordingly.
        • MySensors binding is in the IOT market place and not openhab-addons
        • You'll need to assign node ID to your nodes manually.

        Not entirely sure what your problem is here but don't think you've got all the right pieces for the puzzle yet.

        gohanG Offline
        gohanG Offline
        gohan
        Mod
        wrote on last edited by
        #14

        @Qu3Uk I remember that Mysensors binding works both ethernet and MQTT, but anyway ethernet is the best solution for beginners because you can use myscontroller to debug messages while connected to controller.

        Q E 2 Replies Last reply
        0
        • gohanG gohan

          @Qu3Uk I remember that Mysensors binding works both ethernet and MQTT, but anyway ethernet is the best solution for beginners because you can use myscontroller to debug messages while connected to controller.

          Q Offline
          Q Offline
          Qu3Uk
          wrote on last edited by
          #15

          @gohan Ah really? I've loosely been following last i saw there was a proof of concept mentioned.

          1 Reply Last reply
          0
          • gohanG gohan

            @Qu3Uk I remember that Mysensors binding works both ethernet and MQTT, but anyway ethernet is the best solution for beginners because you can use myscontroller to debug messages while connected to controller.

            E Offline
            E Offline
            ericvdb
            wrote on last edited by ericvdb
            #16

            @gohan said in N00b + MQTT gw + openHAB2:

            but anyway ethernet is the best solution for beginners because you can use myscontroller to debug messages while connected to controller.

            With MQTT you can also debug using MQTT-Spy or MQTTLens or various other MQTT apps.

            MQTT is easy in interconnecting various systems without they have to know about each-other.

            As long as you have a MQTT broker (RabbitMQ, Mosquitto, ActiveMQ, ...) you're all set.

            In OpenHab in conf/services create a file called mqtt.cfg, and past the following:

            mqtt:broker.url=tcp://ip-address-of-mqttbroker:1883
            mqtt:broker.clientId=openhab
            mqtt:broker.retain=true
            mqtt:broker.async=false
            

            Then in your items file you can do:

            Switch Light_GV_Hall    			"Ceiling"       	(GV_Hall, Lights) {mqtt=">[broker:myhome/room/switch1:command:ON:1],>[broker:myhome/room/switch1:command:OFF:0],<[broker:myhome/room/switch1:state:ON:1],<[broker:myhome/room/switch1:state:OFF:0"}
            

            And now you can turn on/off the light from OpenHab as wel as from any other device that publishes to the same toppic (yes, even from MQTT-Spy and MQTTLens)

            gohanG 1 Reply Last reply
            0
            • E ericvdb

              @gohan said in N00b + MQTT gw + openHAB2:

              but anyway ethernet is the best solution for beginners because you can use myscontroller to debug messages while connected to controller.

              With MQTT you can also debug using MQTT-Spy or MQTTLens or various other MQTT apps.

              MQTT is easy in interconnecting various systems without they have to know about each-other.

              As long as you have a MQTT broker (RabbitMQ, Mosquitto, ActiveMQ, ...) you're all set.

              In OpenHab in conf/services create a file called mqtt.cfg, and past the following:

              mqtt:broker.url=tcp://ip-address-of-mqttbroker:1883
              mqtt:broker.clientId=openhab
              mqtt:broker.retain=true
              mqtt:broker.async=false
              

              Then in your items file you can do:

              Switch Light_GV_Hall    			"Ceiling"       	(GV_Hall, Lights) {mqtt=">[broker:myhome/room/switch1:command:ON:1],>[broker:myhome/room/switch1:command:OFF:0],<[broker:myhome/room/switch1:state:ON:1],<[broker:myhome/room/switch1:state:OFF:0"}
              

              And now you can turn on/off the light from OpenHab as wel as from any other device that publishes to the same toppic (yes, even from MQTT-Spy and MQTTLens)

              gohanG Offline
              gohanG Offline
              gohan
              Mod
              wrote on last edited by
              #17

              @ericvdb I know, I am talking for a beginner perspective. The more advanced users know how to debug over mqtt and stuff

              1 Reply Last reply
              0
              • MasMatM Offline
                MasMatM Offline
                MasMat
                wrote on last edited by
                #18

                Update.
                After much trying the Ethernet gw would not connect to Domoticz.
                Then, tried my mqtt sketch again and presto! I have connection AND I can control the two relays on board the mqtt-gw.
                Had a cold one...or four!
                Thanks for the recommendations and help. I'm sure I will need more later on. Now I'm going to explore the Domoticz forum for answers.
                Unless someone with the same setup can tell me why the lights are crossed (on = off in reality and off=light on)?

                1 Reply Last reply
                0
                • gohanG Offline
                  gohanG Offline
                  gohan
                  Mod
                  wrote on last edited by
                  #19

                  Depends on relay board

                  1 Reply Last reply
                  0
                  • MasMatM Offline
                    MasMatM Offline
                    MasMat
                    wrote on last edited by
                    #20

                    I just have the modules. low=relay on.
                    I think it would be easier to change it in Domoticz or do I have to change it in the sketches (I think this will be more work when I add new sensors and relays)?

                    1 Reply Last reply
                    0
                    • gohanG Offline
                      gohanG Offline
                      gohan
                      Mod
                      wrote on last edited by
                      #21

                      Just do everything in code so you present relay status not pin status

                      MasMatM 1 Reply Last reply
                      0
                      • gohanG gohan

                        Just do everything in code so you present relay status not pin status

                        MasMatM Offline
                        MasMatM Offline
                        MasMat
                        wrote on last edited by
                        #22

                        @gohan How do I do that? I tried reversing the:
                        #define RELAY_ON 0 // GPIO value to write to turn on attached relay
                        #define RELAY_OFF 1 // GPIO value to write to turn off attached relay

                        I switched around the 0 and 1 but no real change...

                        1 Reply Last reply
                        0
                        • gohanG Offline
                          gohanG Offline
                          gohan
                          Mod
                          wrote on last edited by
                          #23

                          Did you get a debug log where you actually see the node receiving the message to change the relay status? Because setting the defines as you said should be correct

                          1 Reply Last reply
                          0
                          • MasMatM Offline
                            MasMatM Offline
                            MasMat
                            wrote on last edited by
                            #24

                            I see the mqtt message going out. I have to double check the 0 vs 1 in the messages.

                            I'm about to build another sensor that has only relays. So I will troubleshoot this code & mqtt to make it match.

                            1 Reply Last reply
                            0
                            • gohanG Offline
                              gohanG Offline
                              gohan
                              Mod
                              wrote on last edited by
                              #25

                              Actually I mean the serial debug of the node, not the mqtt log

                              MasMatM 1 Reply Last reply
                              1
                              • gohanG gohan

                                Actually I mean the serial debug of the node, not the mqtt log

                                MasMatM Offline
                                MasMatM Offline
                                MasMat
                                wrote on last edited by
                                #26

                                @gohan gonna examine that too before actually hooking it up. Thanks

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


                                20

                                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