API containing backend logic to handle moisture readings from sensors across my house. Exposes endpoints to allows NodeMCU ESP8266 to add moisture data to the database, and then a Frontend to display the data.
- Python 3.10.8+
The following query must be made for the input_reading/
command:
<origin>api/v1/input_reading/?moisture_level=<moisture level value>
The following headers must be provided:
Plant-ID
Authorization
: Value must be:API-Key <API key value>
The following endpoint returns the transformed meter readings for different plants in the following format:
{
"plants_array": [
{
"id": <plant ID>,
"plant_name": "<name of plant>",
"room_name": "<Room where plant is located>",
"room_location": "<location of plant in room>",
"moisture_percentage": <moisture percentage using config values in config.py>
}
.
.
.
]
}
Best way to download the required python packages and run the app locally is to start a virtual environment
pip install virtualenv
python -m venv .venv
source .venv/bin/activate
poetry shell
poetry install
Run locally:
./manage.py runserver 0.0.0.0:8000
flake8
Create new branch from release branch:
git checkout -b feat/<branch name>
Committing branch changes (must start with feat:
or fix:
):
git add .
git commit -m "<commit message>"
git push
Adding new Python libraries:
- Add library to
pyproject.toml
- run
poetry lock
to add topoetry.lock
file - run
poetry export --without-hashes --format=requirements.txt > requirements.txt
to add torequirements.txt
file