This repository contains a Flask project that serves web pages to display sensor data from Firebase and a local database. The project also includes functionality to update the LED state in the local database.
-
Clone the repository:
git clone https://github.com/bacemhlabba/IoT-platform.git cd IoT-platform -
Create a virtual environment and activate it:
python3 -m venv venv source venv/bin/activate -
Install the required dependencies:
pip install -r requirements.txt
-
Run the Flask app:
./run.sh
-
Go to the Firebase Console and create a new project.
-
Add a new web app to the project and follow the instructions to register the app.
-
Download the
firebase.jsonfile from the Firebase Console and place it in the root directory of the project. -
Update the file with the Firebase configuration details.
- Run the migration script to create the
sensor_datatable and insert initial data:python3 migrate.py
OR
./run.sh-
Make sure Docker and Docker Compose are installed on your machine.
-
Build and start the containers:
docker-compose up --build
-
Open a web browser and go to
http://127.0.0.1:5000/to access the index page.
-
Make sure the virtual environment is activated and the required dependencies are installed.
-
Run the Flask app:
./run.sh
-
Open a web browser and go to
http://127.0.0.1:5000/to access the index page. -
Use the navigation links to go to Page 1 and Page 2 to view the sensor data and update the LED state.
After installing the dependencies, run the test suite using pytest:
pytestIoT-platform/
├── app/
│ ├── static/
│ ├── templates/
│ ├── __init__.py
│ ├── routes.py
│ └── models.py
├── migrations/
├── screenshots/
├── venv/
├── .gitignore
├── docker-compose.yml
├── Dockerfile
├── firebase.json
├── migrate.py
├── README.md
├── requirements.txt
└── run.sh
- Python
- Flask
- Firebase
- SQLite
- Docker
- Docker Compose
- HTML/CSS
- JavaScript
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature-branch). - Open a pull request.









