What is the 'go-to' MQTT broker software for local home setup - Page 1
Forum section: electronics / projects

author: Wilson__
author_rank: Frequent Contributor
timestamp: April 26, 2024, 04:22:53 am
content: Which MQTT broker software is widely used, active community, run on home LAN (not facing internet), low traffic temperature sensors, small number of subscriber?Is Mosquitto on Raspberry Pi good?Pointer to learning material, get-started PDF guide, youtube, etc. Many thanks

author: mianos
author_rank: Regular Contributor
timestamp: April 26, 2024, 06:30:35 am
content: I have run Mosquitto at home for years.Nothing exciting, just faultlessly working.I have about 30 devices at the moment and also use Node-red with it. Half of the devices are my own software and publish to mqtt.Not all wifi, a bunch of zigbee, 433Mhz RF, infra-red and bluetooth all bridged into mqtt.I run it in an LXD container on my N100, but I'm sure it'll run great on a newish raspberrypi.I'd just install it and use the command line "mosquitto_sub -h localhost <TOPIC>' and 'mosquitto_pub -h localhost <TOPIC>' to start learning it.chat gpt knows it pretty well if you want help.

author: selcuk
author_rank: Frequent Contributor
timestamp: April 26, 2024, 07:02:59 am
content: I have been using it for years as well. It is on a computer along with a database and web server. I recommend using a plugin like "mosquitto-auth-plug" to read authentication info from database if you plan to increase the subscriber count. Otherwise you can define the access rights on mosquitto config files manually.

author: Wilson__
author_rank: Frequent Contributor
timestamp: April 26, 2024, 11:16:09 am
content: How database and web server interface with mosquitto?Do you need to do below tasks or many 'common tasks' have ready-available software that you can configure and use.Do you write your own program to subscribe to broker, get data, insert into (SQL) database. and then another software read data base and generate html file to feed the web server

author: artag
author_rank: Super Contributor
timestamp: April 26, 2024, 11:28:38 am
content: It's purely a broker : it maintains an internal database of live and retained data but not time-series data. If you want to build a complete monitoring and control system you will need other components.In the past I worked on a system that used mosquitto, redis and node red. Node red was used to associate data from the MQTT sensor and actuator systems and apply rules but I'm not sure what redis did - I was working only on the MQTT part.It used an older raspberry pi and arduinos with an ethernet connection. Initially it had the problem that if there was a failure it was common to trash the raspberry pi's filesystem. Later we moved the Pi's log system to ram so it wasn't constantly writing to SD card and it became much more resilient.

author: selcuk
author_rank: Frequent Contributor
timestamp: April 26, 2024, 12:20:23 pm
content: The auth plugins only pull data about password and etc. from given tables. For a complete system with database and web interface, I think you should do your custom setup. I don't know a ready made solution.For my project, I wrote a not-complex C application using libmosquitto and libpq. This app was a MQTT subscriber. There was a php web application as well. My app susbcribes to all topics of the devices so each sensor data arrives to it and then it stores them to database. Web app reads and writes only to database and it can read the saved sensor data any time user loads the page. In this scenario, you don't need and interaction between web pages and MQTT.

author: mianos
author_rank: Regular Contributor
timestamp: April 26, 2024, 12:26:45 pm
content: Quote from: Wilson__ on April 26, 2024, 11:16:09 amIt depends on your preference. I am a professional C++ and python developer.There have been times I have written stuff using the python 'paho' mqtt client library. It's pretty simple if you are a developer but you have to start the service and keep it running, I used systemd units.Over time I have just replaced all that with node-red modules. You can source and sink to and from databases with easy to install custom nodes.I use node-red dashboard to make basic GUIs to make basic meter, do little graphs, do entry and make buttons. Pretty crappy but quite easy if you watch a youtube vid or so.For fancy graphs, like my fermenting system, I run the data straight into influx with a node and use grafana to look at it.For all my own producers, like my mmwave radars, sound generators, vapour controller, I use C++ on the esp to generate the mqtt.I used to use the arduino pubsubclient. It's pretty simple, but it's a bit of a joke compared to the increased stability of code done in esp-idf on the esp32.For a beginner, I reckon hit GPT up with some instructions on how to get node-red installed and make a few flows. It'll be fun and games,

author: onsokumaru
author_rank: Contributor
timestamp: April 26, 2024, 02:48:04 pm
content: mosquitto just works, and it's pretty robust, usually you install it and forget about any maintenance. Recently I've been using rumqttd (a broker that comes with the rust mqtt package) on a development environment and I can say it works fine, but I haven't tested on long term deployments to compare against mosquitto.