A flask web app for controlling lamps from the ESP8266 project.
To deploy locally, please edit the following variables in the backend_GPIO_Control.py script :
webpage_address -> the address on which your webpage will be served
webpage_port -> the port on which the webpage will be served, default set to 5000
mqtt_broker_address -> The address, where the mqtt-broker is running
mqtt_broker_port -> The port on which mqtt-broker is running, usually 1883
When done with the setup, run the backend_GPIO_Control.py script and open in a browser the webpage_address:webpage_port address
set in the connection setup.
A login screen should appear. Currently users are set in the python script in the users array.
The default logins are user1:pass1 and user2:pass2
The templates for the current webpages are located withing the templates directory. It is addvised to add webpages
to that directory only, since the python render_template package will look for html files there.
Backend and frontend communication is done through the SocketIO framework. The buttons in the current version send messages
to two "topics": 'Relay_action' and 'PWM_action'. Their respective messages are handled by the python backend script in the @socketio.on() functions
For the mqtt communication with ESP8266 devices, the topic is set in the device_topic variable.
Currently messages are sent to a default group "A". To set up the ESP8266 devices, just send a message on the "lamps_set" topic
and refer to the README on the ESP8266 project page.
- Flask - Main framework for the whole app.
- SocketIO - The SocketIO framework. Additional link to the flask-socketio documentation
- Flask-Login - package for user management.
- Paho-MQTT- MQTT protocol communication for python.
- Bootstrap - Library for developing the frontend interface.
Vasil Yordanov
For further information contact [email protected]
This project is licensed under the GPLv3 License - see the GPLv3 site for details.