A simple system with 2 servers: a HTTP server for handling the data from the IoT devices, and a WebSocket server for sending real-time data to the client, which then will render the chart accordingly.
The rendered real-time data page.
This project is built with all the following frameworks/libraries/plugins:
You MUST have Python, Flask and MySQL installed, if not, Google how to. Most of the required Python libraries are noted the requirement.txt
file, so run the following command to automatically install them:
pip install -r requirement.txt
Just clone the repo and run. All the JavaScript libraries have been included in the vendors
folder so the WebSocket server can be deployed locally without Internet connection.
git clone https://github.com/B5u2423/Display-Realtime-Data-Python-Flask-MySQL.git python-display-realtime
Run http-server.py
if you want to receive data from the sensors and save it to the database. I use an ESP32 with a DHT11 sensor to gather data on temperature and humidity. The HTTP server is running on port 8090
, configure the URL according to your IP and the port in the device sketch. Example source code of the ESP32 is included the sketch
folder.
Run websock-server.py
, the WebSocket server is running on port 8091
, connect to it at localhost:8091
.
Distributed under the MIT License - see LICENSE the for more details.