Learn how to use MQTT with a Flask based backend running mosquitto on a Rasberry Pi and following up with a worker on an ESP8266 chip
MQTT is the lightest form of messaging available out there. When designing my bookshelf, I chose to use MQTT over REST because I would not need to hardcode IP addresses, or attempt to register the nodemcus with a service discovery agent.
There were some initial setbacks with the setup, and in this article, I will cover the following:
- Running mosquitto on a Raspberry Pi
- Writing messages to mosquitto from Flask
- Reading messages from mosquitto in MicroPython
- Writing messages from mosquitto in MicroPython
- Reading messages from mosquitto in Python using paho-python
- Chaining things together.
- Tips and Tricks