How mario26rgl/homecloud-iot works
Project type and purpose
• This is a Raspberry Pi–based client-side IoT application (“HomeCloud”) that reads environmental data from an Arduino sensor module and publishes it via MQTT. It also collects its own logs and metrics locally (via Filebeat) and pushes them into an Elasticsearch engine (spin-up via Docker Compose).
File structure
• Top level:
• application/ – Python client code
• arduino/ – sensor firmware
• extra/ – deployment/config (docker-compose.yml, Elastic repo & Filebeat config)
• startup.sh – Pi startup script
• application/ contains:
• main.py – orchestrator (initializes login, collects or subscribes to data, kicks off emits)
• login.py – handles user credentials and authentication
• emit.py – wraps MQTT publish logic
• scripts/init.sh – environment setup (e.g., install prerequisites)
• test.py – local test harness
• extra/docker-compose.yml brings up Elasticsearch (and possibly Kibana), extra/filebeat.yml pushes application logs into Elasticsearch.
Extract insights from README
• Confirms: “RaspberryPi client-side MQTT application.”
• No server code here — this repo focuses on the Pi-side data producer and log shipper.
Main components and their relationships
a. Hardware & Firmware
• Arduino Sensor Node (sensor.ino)
→ Reads temperature/humidity/other metrics
→ Publishes raw sensor readings (serial or direct MQTT)
b. Client Application (Raspberry Pi)
• main.py
‑ loads config & credentials via login.py
‑ spawns emit.py to publish data
‑ writes structured logs to disk
• emit.py
‑ connects to MQTT broker
‑ publishes sensor payloads
• test.py & scripts/init.sh
‑ local test flows & environment bootstrap
c. External Services
• MQTT Broker (could be local Mosquitto or cloud-hosted)
• Elasticsearch (spun up via Docker Compose)
• Filebeat
‑ tails the Python app’s log files
‑ forwards to Elasticsearch for indexing
Architectural patterns and design principles
• Publisher / Subscriber (MQTT) for decoupled sensor-to-application communication
• Modular separation of concerns:
‑ login/authentication
‑ message emission
‑ orchestration (main)
• Side-car log shipping pattern:
‑ app writes logs → Filebeat side-car reads and ships → Elasticsearch stores
• Infrastructure as code: Docker Compose defines observable services