This Python application continuously monitors a sensor hub and manages HVAC (Heating, Ventilation, and Air Conditioning) system actions based on received sensor data.
It leverages signalrcore
to maintain a real-time connection to the sensor hub and utilizes requests
to send GET requests to a remote HVAC control endpoint.
This application uses pipenv
, a tool that aims to bring the best of all packaging worlds to the Python world.
- Python 3.8+
- pipenv
Install the project's dependencies:
pipenv install
After setup, you can start the program with the following command:
pipenv run start
To ensure the quality of the code, run the unit tests using the following command:
pipenv run test
The application logs important events such as connection open/close and error events to help in troubleshooting.
There are placeholders in the code for sending events to a database and handling request exceptions. These sections should be completed as per the requirements of your specific application.
Build the Docker image with the following command:
sudo docker build -t oxygencs-grp1-eq6:latest .
Test the Docker image locally by mapping the port and using the .env
file:
sudo docker run --env-file .env oxygencs-grp1-eq6:latest
Tag the Docker image for DockerHub:
sudo docker tag oxygencs-grp1-eq6:latest log680equipe6ete24/oxygencs-grp1-eq6:latest
Log in to DockerHub and push the image:
sudo docker login
sudo docker push log680equipe6ete24/oxygencs-grp1-eq6:latest
-
Pull the Docker image from DockerHub:
sudo docker pull log680equipe6ete24/oxygencs-grp1-eq6:latest
-
Run the Docker image with the port mapping:
sudo docker run --env-file .env -p 5000:5000 log680equipe6ete24/oxygencs-grp1-eq6:latest
-
Access the application:
Open your browser and go to
http://localhost:5000
orhttp://127.0.0.1:5000
to verify that the application is working correctly.
MIT
For more information, please feel free to contact the repository owner.
L'application utilise les variables d'environnement suivantes, configurées dans un fichier .env
:
HOST
: Adresse de l'habitationTOKEN
: Token de la pièceT_MAX
: Température maximaleT_MIN
: Température minimaleDATABASE_URL
: URL de connexion à la base de données
HOST=example_host
TOKEN=example_token
T_MAX=25
T_MIN=18
DATABASE_URL=postgresql://user:password@localhost:5432/mydatabase