Skip to content

SverreNystad/communication-systems

Repository files navigation

Communication Systems Project

CI

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

Prerequisites

Installation

Clone the repository using the following command in the terminal:

git clone https://github.com/SverreNystad/communication-systems.git
cd communication-systems

Environment variables

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

Usage

To run MQTT broker run the following command in the terminal:

docker compose up --build

Run Client Application

Then run the following commands on the client:

python src/app.py

Run Server Application Raspberry Pi:

Run the following commands on the server:

python src/server.py

Run Scooter Service on Raspberry Pi (Sense HAT):

python src/scooter_service.py

Tests

To run the tests, run the following commands in the terminal:

docker compose run backend python -m pytest

About

An e-scooter system with a server, cli client and a scooter communicating with MQTT

Topics

Resources

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages