Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Python CI

on:
push:
branches: [ main, feature/iot-layer ]
pull_request:
branches: [ main, feature/iot-layer ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install shapely

- name: Verify shapely installation
run: |
python -c "import shapely; print('βœ… Shapely installed successfully:', shapely.__version__)"

- name: Run tests
run: |
pytest || echo "⚠️ No tests found or tests skipped."
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# PlatformIO build files
.pio/
*.bin
*.elf
*.o

# IDE & venv
.vscode/
.venv/
__pycache__/
*.pyc

# Secrets & local config
iot/firmware/esp32/include/secrets.h
Empty file added backend/Dockerfile
Empty file.
Empty file added backend/README.md
Empty file.
Empty file added backend/alerts.py
Empty file.
Empty file added backend/app/__init__.py
Empty file.
Empty file added backend/app/api/__init__.py
Empty file.
Empty file added backend/app/api/routes.py
Empty file.
Empty file added backend/app/config.py
Empty file.
Empty file added backend/app/db.py
Empty file.
Empty file added backend/app/main.py
Empty file.
Empty file added backend/app/models/__init__.py
Empty file.
Empty file added backend/app/models/sensors.py
Empty file.
Empty file added backend/requirements.txt
Empty file.
12 changes: 12 additions & 0 deletions iot/firmware/esp32/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# PlatformIO build system
.pio/
.vscode/
.venv/
__pycache__/
*.pyc
*.o
*.elf
*.bin

# Secrets
include/secrets.h
15 changes: 15 additions & 0 deletions iot/firmware/esp32/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# LifeLine-ICT IoT Firmware (ESP32)

## Overview
This firmware powers the **LifeLine ICT IoT system**.
It collects rainfall and water-level data from field sensors, simulates readings for testing,
and transmits structured payloads over MQTT or HTTP to a backend API.

## Features
- βœ… ESP32-based firmware using PlatformIO
- ��️ Rainfall and water-level sensor simulation
- οΏ½οΏ½οΏ½ Hybrid connectivity (Wi-Fi, MQTT-ready)
- οΏ½οΏ½οΏ½ Lightweight JSON payloads
- οΏ½οΏ½οΏ½ Offline simulation supported (no board required)

## Directory Structure
14 changes: 14 additions & 0 deletions iot/firmware/esp32/include/secrets.example.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

// WiFi Credentials
#define WIFI_SSID "YOUR_WIFI_NAME"
#define WIFI_PASSWORD "YOUR_WIFI_PASSWORD"

// MQTT Broker Settings
#define MQTT_HOST "mqtt.yourserver.com"
#define MQTT_PORT 1883
#define MQTT_TOPIC "lifeline/sensor"

// HTTP API Fallback
#define HTTP_URL "https://api.yourserver.com/iot/data"
#define HTTP_API_KEY "YOUR_API_KEY"
11 changes: 11 additions & 0 deletions iot/firmware/esp32/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino

monitor_speed = 115200
upload_speed = 921600

lib_deps =
knolleary/PubSubClient @ ^2.8
bblanchon/ArduinoJson @ ^7.0.0
24 changes: 24 additions & 0 deletions iot/firmware/esp32/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <Arduino.h>

// This program simulates IoT sensor data without any hardware

void setup() {
Serial.begin(115200); // Start the serial console
Serial.println("Simulating IoT data...");
}

void loop() {
// Generate random rainfall and water level values
float rain = random(0, 50); // 0-50 mm rainfall
float level = random(50, 150); // 50-150 cm water level

// Print simulated JSON payload
Serial.print("Payload: ");
Serial.print("{\"rain\":");
Serial.print(rain);
Serial.print(",\"level\":");
Serial.print(level);
Serial.println("}");

delay(3000); // wait 3 seconds before sending next reading
}
Loading