- Collect temperature and humidity data from sensor.
- Show data on LCD.
- Send data to MQTT Broker every 10 seconds.
- Receive data from MQTT Broker.
- Save data to SQLite.
- Access from LAN.
- Show data in graph mode and web auto update without refresh.
- If you want to have an own virtual environment
$ python3 -m venv venv
$ source venv/bin/activate
$ python3 -m pip install -r requirements.txt
- Or you can use my virtual environment
$ source tutorial-env/bin/activate
- Change source code to fit your need.
- Go to esp32 source code folder and read README.md for more information.
- Go to app folder
$ cd app
- Initialize database or you can change to fit your need in sql file before initialize.
$ python init_db.py
- Run
Flask
app
$ python app.py
- You can use http://127.0.0.1:5000 to access from your pc/laptop
- Or use http://192.168.0.128:5000 (this is my IP, replace with your) to access from your LAN device.
- If you want your Flask app can access over Internet, you can use
ngrok
. - You can go to the ngrok home or Miguel Grinberg's blog guide for more information.
- By the way opening a parallel terminal and activate your virtual environment and run
ngrok
correspondingFlask
app port.
$ source tutorial-env/bin/activate
$ ngrok http 5000
- You can use the
Forwarding address
to access from any network.
- You need to accept to visit the site
- The result