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
StrEnumand 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-systemsCopy 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 .envConfigure the pre-commit hooks by running the following command in the terminal:
pip install pre-commit
pre-commit installSetup the virtual environment by running the following command in the terminal:
python -m venv venvActivate the virtual environment by running the following command in the terminal:
source venv/bin/activateInstall the required packages by running the following command in the terminal:
pip install -r requirements.txtTo run MQTT broker run the following command in the terminal:
docker compose up --buildThen run the following commands on the client:
python src/app.pyRun the following commands on the server:
python src/server.pypython src/scooter_service.pyTo run the tests, run the following commands in the terminal:
docker compose run backend python -m pytest