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.
  • N nizoo91

    Hello guys,

    I am trying to build a temperature monitoring system for a fridge, which tracks data and in-case it goes above a certain temperature, it would send an email alert. Would be nice if I am able to display data logs on a touch screen.

    I have the following setup:
    Raspberri Pi 3 with OpenHabian installed
    Arduino Uno hooked up to 2 DS18B20 (One Wire temp sensors)
    2x nRFl01+ (one for the Pi & one on the Uno)

    Things I have done previously:
    I tested the nRF24 connections and was able to send/receive simple "hello world" from Arduino to Rp3
    I have been able to read temperature data on the Arduino via serial monitor

    I have followed This Guide, however I am stuck in STEP 3, to be more specific, I don't know how to transfer data from Uno to Rp and check if it is working or not via MQTT,

    additionally, OpenHab is brand new to me, and I wasn't able to find any examples on how to configure it, I would really appreciate it if someone can link a few videos/tutorials that can get me going, as the amount of information my brain has consumed over the few days is vast, and I am about to lose my mind!

    Also I tried following the instructions on MySensors.org trying to just use serial communication, but that didn't really work and I was stuck around the same stage.

    Need clarification:

    1. Can I transmit and receive data using the MySensors libraries without installing MySensors in OpenHab? (because I don't have it, according to the tutorial it wasn't installed)

    2. Where the hell do I define my Node IDs ? (Do I simply place "#define MY_NODE_ID 1" ontop of my Uno Code?)?

    3. For the MQTT Broker on PaperUI, I was only able to get it online by using "LocalHost" is that right?

    I have a lot of questions, but will start with these, I will keep reading/watching videos in the meantime :thinking_face:

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

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

    Can I transmit and receive data using the MySensors libraries without installing MySensors in OpenHab? (because I don't have it, according to the tutorial it wasn't installed)

    For the MQTT Broker on PaperUI, I was only able to get it online by using "LocalHost" is that right?

    You don't need the mysensors binding if all you're doing is taking in readings. you'd probably be better for it.

    localhost/127.0.0.1/the actual ip should all work. if localhost works, just use that. don't make it complicated.

    1 Reply Last reply
    0
    • mfalkviddM mfalkvidd

      Hi @nizoo91, welcome to the MySensors community :-)

      I only know the answer to one of your questions, so I'll just answer that.

      1. Where the ^^^^ do I define my Node IDs ? (Do I simply place "#define MY_NODE_ID 1" ontop of my Uno Code?)?

      Yes. Before including MySensors.h

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

      @mfalkvidd, @bgunnarb & @waspie

      Thank you for the help guys, to be honest I felt fairly out dated because I wasn't able to get it working first try! as usually I am a tech guru, and I am able to just get things working the way I want fairly easily!

      Anyhow, I will keep digging and see what I can do! I definitely need to get my head around it, but also need to get this up and running for my school project, as this will be my project for end of the semester! and will be using it in our family Restaurant after :) and yes, free food for everyone that helps me out haha ;)

      Will report back with any questions :)

      @waspie I would love to make it as simple as possible for the school project purposes, so I can get it done and take my time tinkering later on with MQTT and everything else, but I absolutely need a working device to present within 2 months :)

      Cheers

      W 1 Reply Last reply
      1
      • N nizoo91

        @mfalkvidd, @bgunnarb & @waspie

        Thank you for the help guys, to be honest I felt fairly out dated because I wasn't able to get it working first try! as usually I am a tech guru, and I am able to just get things working the way I want fairly easily!

        Anyhow, I will keep digging and see what I can do! I definitely need to get my head around it, but also need to get this up and running for my school project, as this will be my project for end of the semester! and will be using it in our family Restaurant after :) and yes, free food for everyone that helps me out haha ;)

        Will report back with any questions :)

        @waspie I would love to make it as simple as possible for the school project purposes, so I can get it done and take my time tinkering later on with MQTT and everything else, but I absolutely need a working device to present within 2 months :)

        Cheers

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

        @nizoo91

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

        N 1 Reply Last reply
        0
        • 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


                            14

                            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