This project demonstrates a simple MQTT Pub-Sub system that stores data in an external MongoDB database. The MQTT broker used is adafruit.io's free service.
The data published is 'faked' using randomised 'temperatures' from two 'locations', inside and outside an address.
Requirements are given in the requirements.txt file.
Use pip install -r requirements.txt
to install the required packages.
This project uses a free MQTT broker service and the free MongoDB Atlas service that allows for testing of a small sharded MongoDB cluster.
The following brokers provide free services for testing / low data volume:
- test.mosquitto.org
- broker.hivemq.com
- iot.eclipse.org
Adafruit.io (https://io.adafruit.com/) provides a secured low volume free service that may be upscaled to larger volumes of data/events by subscription.
TODO: Add details of creating free service account
The following articles were used to assist in the creation of this example code:
- MQTT Beginners Guide - Medium - Code & Dogs
- How to use MQTT in Python (Paho) - EMQX
- How to Use The Paho MQTT Python Client for Beginners - Steve's Internet Guide
- Python Database Programming with MongoDB
- Python Database Programming with MongoDB for Beginners - Developer.com - Phil Hajjar
- Python and MongoDB Database Development - Developer.com - Phil Hajjar
- How to Use Python with MongoDB
- add testing
- add flask based front end
- organise into sections using folders