Skip to content

Landflier/Flask-Web-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Flask Web App

A flask web app for controlling lamps from the ESP8266 project.

Deployment

Connection

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

Using

Frontend Interface

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 Communication

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.

Built With

  • 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.

Authors

Vasil Yordanov
For further information contact [email protected]

License

This project is licensed under the GPLv3 License - see the GPLv3 site for details.

About

The user application for the lamp controller, based on flask and javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published