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. Openhab MQTT Example

Openhab MQTT Example

Scheduled Pinned Locked Moved OpenHAB
openhab mqtt ex
49 Posts 8 Posters 73.0k Views 1 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.
  • M Offline
    M Offline
    Marcus
    wrote on last edited by
    #36

    @John Thank u very much. I think i will stop with Openhab and give PiDome a try. it seems to be better described what to do to get it run.

    In the thread u mentioned i looked for some examples but didnt get them to work and no one could help.

    J 1 Reply Last reply
    0
    • M Marcus

      @b0rmann Please read the whole thread and tell me what to do now!!! I only want openhab and mysensors work together. But i want to use my mqtt-ethernet-gateway. Not the serial way.

      B Offline
      B Offline
      b0rmann
      wrote on last edited by
      #37

      @Marcus mqtt client gateway is not serial way :)

      i have mqtt-client-gateway + raspi (mosquitto + openhab + nodered)

      1 Reply Last reply
      0
      • M Marcus

        @John Thank u very much. I think i will stop with Openhab and give PiDome a try. it seems to be better described what to do to get it run.

        In the thread u mentioned i looked for some examples but didnt get them to work and no one could help.

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

        @Marcus Wish i could help, too bad it doesn't work. Others are using it successfully as far as i know. Maybe different openhab version install. Well, let me know if there are any issues or help needed with PiDome.

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

        1 Reply Last reply
        1
        • T Offline
          T Offline
          tboha
          wrote on last edited by
          #39

          @Marcus: Sorry I'm in a hurry so...
          But what to do now??? -> is your broker really ok?

          1. open two terminal windows on your Raspberry.

          2. one window:

            mosquitto_sub -t /test -v

          3. second window:

            mosquitto_pub -t /test -m "test message"

          If it's all fine, the test message should show up in the first window.

          How do i connect mosquitto to Openhab?
          OpenHab -> mosquitto
          If your still got the OpenHab sitemap from above, the swtiches 1+3 should be functional like desribed, switch 2 will result in an errormessage in the log (as "intended").

          Reverse direction (mosquitto -> Openhab).
          You may populate your broker with some messages for the given topic.
          e.g. mosquitto_pub -t MyMQTT/20/255/V_SKETCH_NAME -m "fake sketch name"

          How do i connect mosquitto to Openhab?
          I use the serial Gateway connected via USB to my Raspberry and a little Node.js script.
          If you are interested - let me know.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Marcus
            wrote on last edited by
            #40

            Thank u anyway for your help @tboha . I think this is too much complicated. I tried ur last idea, but i got connection refused error. Really frustrating.... I want to see results. I hope pidome gave me faster results than openhab.

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tboha
              wrote on last edited by
              #41

              Connection refused means (in 99%) your broker is not up or you got the wrong address.
              I supposed you to run mosquitto_sub/pub on the same machine your broker runs on.
              On a different machine you have to add the host address like:

              mosquitto_sub -h 192.168.1.10 -t /topic -m "message".
              

              No - at last its not really complicated, but I think you had just a bad start. MySensors and OpenHab tend to start right out of the box - but you need the right box......

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Marcus
                wrote on last edited by Marcus
                #42

                Please stop helping me now. Now i have pidome and the first sensor is running after 30 minutes with my ethernet mqtt gateway ;-)

                That is what i want. Maybe one day there are nice tutorials for Openhab. Thank u very much for trying to help. If i now start with mosquitto to get openhab run is the same as when i make a patch for a patch....

                It seems that pidome has wait for me it is really nice and not much complicated.

                This thread can be closed here.Unbenannt.JPG

                C 1 Reply Last reply
                0
                • M Marcus

                  Please stop helping me now. Now i have pidome and the first sensor is running after 30 minutes with my ethernet mqtt gateway ;-)

                  That is what i want. Maybe one day there are nice tutorials for Openhab. Thank u very much for trying to help. If i now start with mosquitto to get openhab run is the same as when i make a patch for a patch....

                  It seems that pidome has wait for me it is really nice and not much complicated.

                  This thread can be closed here.Unbenannt.JPG

                  C Offline
                  C Offline
                  C.r.a.z.y.
                  wrote on last edited by
                  #43

                  @Marcus Try Tim's files and JAR file for serial openHab http://forum.mysensors.org/topic/655/serial-gateway-connection-to-openhab/2
                  I added a motion sensor and its fine.

                  J 1 Reply Last reply
                  0
                  • C C.r.a.z.y.

                    @Marcus Try Tim's files and JAR file for serial openHab http://forum.mysensors.org/topic/655/serial-gateway-connection-to-openhab/2
                    I added a motion sensor and its fine.

                    J Offline
                    J Offline
                    John
                    Plugin Developer
                    wrote on last edited by John
                    #44

                    @Marcus Good to see you have it working! The MySensors MQTT plugin and serial drivers are quite stable. Some parts of the server can behave a little strange, cause still in heavy development.

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

                    C 1 Reply Last reply
                    0
                    • J John

                      @Marcus Good to see you have it working! The MySensors MQTT plugin and serial drivers are quite stable. Some parts of the server can behave a little strange, cause still in heavy development.

                      C Offline
                      C Offline
                      C.r.a.z.y.
                      wrote on last edited by
                      #45

                      @John There was a problem with serial....1.6.1.jar it doesnt show this correctly;

                      ArduinoUpdate -> 0;0;3;0;9;read: 14-14-0 s=1,c=1,t=16,pt=0,l=1:0
                      14;1;1;0;16;0

                      i think its related with baud rate for jar file because i saw  these kind of things in terminal ����BO�"U��²e��B&��i�

                      J 1 Reply Last reply
                      0
                      • C C.r.a.z.y.

                        @John There was a problem with serial....1.6.1.jar it doesnt show this correctly;

                        ArduinoUpdate -> 0;0;3;0;9;read: 14-14-0 s=1,c=1,t=16,pt=0,l=1:0
                        14;1;1;0;16;0

                        i think its related with baud rate for jar file because i saw  these kind of things in terminal ����BO�"U��²e��B&��i�

                        J Offline
                        J Offline
                        John
                        Plugin Developer
                        wrote on last edited by
                        #46

                        @C.r.a.z.y. That's highly possible, or there was a wrong choice of encoding at the wrong moment.

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

                        1 Reply Last reply
                        0
                        • H Offline
                          H Offline
                          Hacker007
                          wrote on last edited by
                          #47

                          Hi.
                          I have OpenHAB, MQTT and battery powered units (http://iot-playground.com/2-uncategorised/10-low-power-door-window-sensor). I cannot receive battery status in Openhab (other things from the same unit are transmitted OK). What is wrong?

                          1. I send: gw.sendBatteryLevel(batLevel);
                          2. Number node4_bat "Bat [%.1f %%]" <temperature> (node4, GBattery) {mqtt="<[mysensor:MyMQTT/4/255/50:state:default]"}

                          I have seen somewhere that battery state is transmitted via '50'?!?

                          1 Reply Last reply
                          0
                          • H Offline
                            H Offline
                            Hacker007
                            wrote on last edited by Hacker007
                            #48

                            Hi. I have figured it out. It is presented as "mysensor:MyMQTT/4/255/V_:state:default". No number in current version from mysensors!!!
                            The next step was to edit MyMQTT.cpp: char V_50[] PROGMEM = ""; into char V_50[] PROGMEM = "50";. Now I get battery status via "mysensor:MyMQTT/4/255/V_50:state:default".

                            So in conclusion I have answered my own questions and have solved them...

                            1 Reply Last reply
                            1
                            • F Offline
                              F Offline
                              francis
                              wrote on last edited by
                              #49

                              coming back to the initial issue, is there anyone that can post items and maps configuration to test the binary switch example of mysensors? my configuration is arduino uno+w5100 and mqtt gateway, opnhab on windows pc on the same network

                              1 Reply Last reply
                              0

                              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                              With your input, this post could be even better 💗

                              Register Login
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              16

                              Online

                              12.0k

                              Users

                              11.2k

                              Topics

                              113.4k

                              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