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. Temp-Monitoring using OpenHab, MQTT, Pi 3 & Uno

Temp-Monitoring using OpenHab, MQTT, Pi 3 & Uno

Scheduled Pinned Locked Moved Troubleshooting
16 Posts 5 Posters 2.1k Views 4 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.
  • W waspie

    @nizoo91

    Sorry to be a pain, but where exactly are things failing right now?

    N Offline
    N Offline
    nizoo91
    wrote on last edited by
    #7

    Thank you @waspie, for the follow-up

    I have actually made a big mess of everything trying to use different tutorials, OH documentation, ect...

    I am a little more familiar with OpenHab now, especial thanks to @bgunnarb 's comment, it helped me understand the "sequence" and breakdown each step separately.

    I decided to start with a fresh OpenHabian install and go at it again.

    I am curious about MQTT Broker version to use, in the tutorial it says:
    "There are compatibility issues on the latest release of openHAB (2.4). I will review this i more depth but for the moment you can add the compatibility with legacy bindings and install MQTT1 instead of the new binding."

    is the above statement still valid? does MQTT1 actually still work? should I absolutely not use the new MQTT Broker? because I have read other posts that got the new broker working...

    Thank you

    1 Reply Last reply
    0
    • W Offline
      W Offline
      waspie
      wrote on last edited by
      #8

      2.4 works well enough. there were some big bugs squished with 2.5m1 hot on 2.4's heels.
      If you're planning to use this more and more (and you likely will once you start to see what you can do) stick with the 2.x implementation of MQTT. I don't know how openhabian handles things. If you can, disable whatever bundled MQTT broker openhabian has and use the built in broker (for the sake of simplicity).

      Enable/install the embedded (built in) broker by using PaperUI. Go to Add-ons->Misc and install the Embedded MQTT Broker.
      Once installed, you'll have a new item in the PaperUI Inbox. That item will be the broker - add it. If you don't get it in your inbox you may still have an external broker running which will keep the embedded one from starting (two processes are trying to use a single port).

      1 Reply Last reply
      0
      • N Offline
        N Offline
        nizoo91
        wrote on last edited by
        #9

        Not sure if you are able to help me out here, but here is what I got so far,

        my MQTT1 Broker is running with following config:

        mosquitto.url=tcp://localhost:1883
        mosquitto.qos=1
        mosquitto.retain=true
        mosquitto.async=false
        mosquitto.user=openhabian
        mosquitto.pwd="" 
        
        • no pwd for mosquitto.

        I used the following commmand when installing the MySensors:

        ./configure --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mygateway1-out --my-mqtt-subscribe-topic-prefix=mygateway1-in --my-mqtt-client-id=mysensors-1 --my-mqtt-user=openhabian --my-mqtt-password=
        
        • Again no password
        • I am assuming 127.0.0.1 is localhost as usual, so I left it as 127.0.0.1
          Below is the result of : sudo ./bin/mysgw
          alt text

        .
        Arduino code to test connection:

        // Enable debug prints to serial monitor
        #define MY_DEBUG
        
        // Enables and select radio type (if attached)
        #define MY_RADIO_RF24
        //#define MY_RADIO_RFM69
        //#define MY_RADIO_RFM95
        
        #define MY_GATEWAY_MQTT_CLIENT
        #define MY_NODE_ID 1
        
        // Set this node's subscribe and publish topic prefix
        #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
        #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
        
        // Set MQTT client id
        #define MY_MQTT_CLIENT_ID "mysensors-1"
        
        // Enable these if your MQTT broker requires username/password
        #define MY_MQTT_USER "openhabian"
        #define MY_MQTT_PASSWORD ""
        
        // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
        //#define MY_IP_ADDRESS 192, 168, 0, 19
        
        // If using static ip you can define Gateway and Subnet address as well
        //#define MY_IP_GATEWAY_ADDRESS 192, 168, 0, 19
        //#define MY_IP_SUBNET_ADDRESS 255,255,255,0
        
        // MQTT broker ip address or url. Define one or the other.
        //#define MY_CONTROLLER_URL_ADDRESS 192, 168, 0, 19
        #define MY_CONTROLLER_IP_ADDRESS 192, 168, 0, 19
        
        // The MQTT broker port to to open
        #define MY_PORT 1883
        
        #include <Ethernet.h>
        #include <MySensors.h>
        
        void setup()
        {
            // Setup locally attached sensors
        }
        
        void presentation()
        {
            // Present locally attached sensors here
        }
        
        void loop()
        {
            // Send locally attached sensors data here
        }
        

        • Result:
        0 MCO:BGN:INIT GW,CP=RNNGA---,REL=255,VER=2.3.1
        4 TSM:INIT
        5 TSF:WUR:MS=0
        11 TSM:INIT:TSP OK
        13 TSM:INIT:GW MODE
        15 TSM:READY:ID=0,PAR=0,DIS=0
        17 MCO:REG:NOT NEEDED
        641 !GWT:TPC:DHCP FAIL
        643 MCO:BGN:STP
        645 MCO:BGN:INIT OK,TSP=1
        1268 !GWT:TPC:DHCP FAIL
        1271 TSM:READY:NWD REQ
        1308 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
        1937 !GWT:TPC:DHCP FAIL
        2561 !GWT:TPC:DHCP FAIL
        3184 !GWT:TPC:DHCP FAIL
        3809 !GWT:TPC:DHCP FAIL
        4432 !GWT:TPC:DHCP FAIL    
        

        Please let me know what stupid thing I have done now :(

        1 Reply Last reply
        0
        • W Offline
          W Offline
          waspie
          wrote on last edited by
          #10

          I think all the MQTT/OH stuff looks right but I'm not sure what's going on with the arduino part.
          You're using an UNO with an ethernet shield?

          N 1 Reply Last reply
          0
          • W waspie

            I think all the MQTT/OH stuff looks right but I'm not sure what's going on with the arduino part.
            You're using an UNO with an ethernet shield?

            N Offline
            N Offline
            nizoo91
            wrote on last edited by
            #11

            @waspie

            No I am not, I think I spent too much time yesterday on it, and made a mess again :/

            I am going to give it an another shot now and see what I can do :)

            W 1 Reply Last reply
            0
            • N nizoo91

              @waspie

              No I am not, I think I spent too much time yesterday on it, and made a mess again :/

              I am going to give it an another shot now and see what I can do :)

              W Offline
              W Offline
              waspie
              wrote on last edited by
              #12

              @nizoo91 right, well then there's no need to be setting IPs and such in the arduino...

              1 Reply Last reply
              0
              • N Offline
                N Offline
                nizoo91
                wrote on last edited by
                #13

                @waspie said in Temp-Monitoring using OpenHab, MQTT, Pi 3 & Uno:

                @nizoo91 right, well then there's no need to be setting IPs and such in the arduino...

                Okay I am going to start from the beginning again then, because I just found another post that confused me even more!
                @gohan said in Sending data from Arduino to Raspberry Pi via NRF24L01+:

                "he serial gateway is supposed to be connected via USB and it is sending data over the usb serial port, so for your project you would need an extra Arduino as a sensor node where you will connect the 2 sensors (look at the MySensors library examples) with a NRF24 module that will be sending data to the other Arduino with the other NRF24 configured as serial gateway and connected to the RPI3 via USB. MySensors library allows you to setup your gateway also as Ethernet (with a W5100 shield) or Ethernet with MQTT client (also need the W5100 shield)."

                Attached is a picture of what I want to achieve, preferably without an Ethernet shield. alt text

                Any advice would be appropriated :/

                1 Reply Last reply
                0
                • W Offline
                  W Offline
                  waspie
                  wrote on last edited by
                  #14

                  No Ethernet, just mqtt

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

                    That's fine, just look on instruction on how to build a raspberry gateway

                    1 Reply Last reply
                    0
                    • N Offline
                      N Offline
                      nizoo91
                      wrote on last edited by
                      #16

                      Wohoo got it to finally work :)

                      not using MQTT but via serial gateway which is good enough for now :)

                      1 Reply Last reply
                      2
                      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