A modular scooter-rental system using MQTT and STMPY state machines. With the following features:
- User/Admin flows with robust state machines
- MQTT-based decoupled architecture
- Dockerized services with configurable IP/ports via
.env
- Type-safe events with
StrEnum
and sensor data modeled as@dataclass
- Sense HAT integration for real-time scooter feedback
- Ensure that git is installed on your machine. Download Git
- Docker is used for the backend and database setup. Download Docker
- Python 3.8 or higher is required for the backend. Download Python
Clone the repository using the following command in the terminal:
git clone https://github.com/SverreNystad/communication-systems.git
cd communication-systems
Copy the .env.example
file to .env
and set the required environment variables. The .env
file is used to configure the MQTT broker and database connection.
cp .env.example .env
Configure the pre-commit hooks by running the following command in the terminal:
pip install pre-commit
pre-commit install
Setup the virtual environment by running the following command in the terminal:
python -m venv venv
Activate the virtual environment by running the following command in the terminal:
source venv/bin/activate
Install the required packages by running the following command in the terminal:
pip install -r requirements.txt
To run MQTT broker run the following command in the terminal:
docker compose up --build
Then run the following commands on the client:
python src/app.py
Run the following commands on the server:
python src/server.py
python src/scooter_service.py
To run the tests, run the following commands in the terminal:
docker compose run backend python -m pytest