# keefo/open-plant-pulse architecture

> Architecture diagram of the GitHub repository keefo/open-plant-pulse, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/keefo/open-plant-pulse
- Repository: https://github.com/keefo/open-plant-pulse

## Overview

Open Plant Pulse pairs a battery-powered sensor with an always-on local hub. The sensor samples soil, ambient conditions, and battery state, then broadcasts BTHome reports; the hub receives and decodes them, persists history, and serves plant monitoring and management. Distinct hub capabilities include plant profiles and care insights, sensor configuration and firmware updates, and scheduled grow-light control. The sensor also provides a local console and can be discovered directly by Home Assistant. Relationships for unsampled subsystems are included only where the README documents them; prototype end-to-end validation remains incomplete.

Main entry points: [`hub/src/open_plant_pulse_hub/web.py`](https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/web.py) (Hub web application), [`sensor/firmware/main/app_main.c`](https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/app_main.c) (Sensor application), [`hub/src/open_plant_pulse_hub/application/store.py`](https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/application/store.py) (History and state), [`sensor/firmware/main/report_delivery.c`](https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/report_delivery.c) (Report delivery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensor_sampling["Sensor sampling"]
  node_soil_probe["Soil probe<br/>[soil_probe.c]"]
  node_ambient_sensor["SHT45 monitor<br/>[sht45_monitor.c]"]
  node_battery_monitor["Battery monitor<br/>[battery_monitor.c]"]
  node_sample_orchestrator["Sensor application<br/>[app_main.c]"]
end

subgraph group_sensor_delivery["Sensor delivery"]
  node_report_delivery["Report delivery<br/>[report_delivery.c]"]
  node_report_queue[("Report queue<br/>[report_queue.c]")]
  node_bthome_encoder["BTHome encoder<br/>[bthome_payload.c]"]
  node_bthome_broadcaster["BLE broadcaster"]
end

subgraph group_hub_ingestion["Hub collection"]
  node_ble_receiver["BLE subscriber<br/>[ble.py]"]
  node_advertisement_ingestion["Advertisement ingestion<br/>[ingestion.py]"]
  node_bthome_decoder["BTHome decoder<br/>[bthome.py]"]
  node_hub_store[("History and state<br/>[store.py]")]
end

subgraph group_plant_management["Plant management"]
  node_plant_insights["Profiles and care<br/>[plant_profiles.py]"]
  node_care_events["Care event detection<br/>[care_events.py]"]
  node_hub_web["Hub web application<br/>[web.py]"]
  node_hub_dashboard["Browser dashboard<br/>[app.js]"]
  node_light_service["Light scheduling<br/>[service.py]"]
  node_light_drivers["Light integrations<br/>[neewer_gl1c.py]"]
end

subgraph group_device_services["Device services"]
  node_device_configuration["Sensor configuration"]
  node_firmware_library["Firmware updates<br/>[firmware.py]"]
  node_sensor_console["Sensor console<br/>[web_ui.c]"]
end

node_household(("Household user"))
node_home_assistant["Home Assistant"]

node_sample_orchestrator -.->|"samples soil"| node_soil_probe
node_sample_orchestrator -.->|"samples air"| node_ambient_sensor
node_sample_orchestrator -.->|"reads battery"| node_battery_monitor
node_sample_orchestrator -.->|"submits sample"| node_report_delivery
node_report_delivery -.->|"queues reports"| node_report_queue
node_report_delivery -.->|"encodes reports"| node_bthome_encoder
node_bthome_broadcaster -.->|"broadcasts BLE"| node_household
node_bthome_broadcaster -.->|"broadcasts BTHome"| node_home_assistant
node_ble_receiver -->|"passes advertisements"| node_advertisement_ingestion
node_advertisement_ingestion -->|"decodes payload"| node_bthome_decoder
node_advertisement_ingestion -->|"records readings"| node_hub_store
node_household -.->|"manages plants"| node_hub_dashboard
node_hub_dashboard -.->|"uses HTTP app"| node_hub_web
node_hub_web -->|"reads and writes"| node_hub_store
node_hub_store -->|"uses plant profiles"| node_plant_insights
node_hub_store -.->|"stores care history"| node_care_events
node_hub_web -->|"routes light control"| node_light_service
node_light_service -->|"dispatches drivers"| node_light_drivers
node_hub_web -.->|"manages sensor settings"| node_device_configuration
node_hub_web -.->|"offers firmware updates"| node_firmware_library
node_household -.->|"views device console"| node_sensor_console

click node_soil_probe "https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/soil_probe.c"
click node_ambient_sensor "https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/sht45_monitor.c"
click node_battery_monitor "https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/battery_monitor.c"
click node_sample_orchestrator "https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/app_main.c"
click node_report_delivery "https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/report_delivery.c"
click node_report_queue "https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/components/report_queue/report_queue.c"
click node_bthome_encoder "https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/components/bthome_payload/bthome_payload.c"
click node_bthome_broadcaster "https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/bthome_broadcaster.c"
click node_ble_receiver "https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/ingestion/ble.py"
click node_advertisement_ingestion "https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/application/ingestion.py"
click node_bthome_decoder "https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/ingestion/bthome.py"
click node_hub_store "https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/application/store.py"
click node_plant_insights "https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/domain/plant_profiles.py"
click node_care_events "https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/domain/care_events.py"
click node_hub_web "https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/web.py"
click node_hub_dashboard "https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/static/app.js"
click node_light_service "https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/lighting/service.py"
click node_light_drivers "https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/lighting/neewer_gl1c.py"
click node_device_configuration "https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/ingestion/device_configuration.py"
click node_firmware_library "https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/application/firmware.py"
click node_sensor_console "https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/web_ui.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_soil_probe,node_ambient_sensor,node_battery_monitor,node_sample_orchestrator,node_household toneBlue
class node_report_delivery,node_report_queue,node_bthome_encoder,node_bthome_broadcaster toneAmber
class node_ble_receiver,node_advertisement_ingestion,node_bthome_decoder,node_hub_store toneMint
class node_plant_insights,node_care_events,node_hub_web,node_hub_dashboard,node_light_service,node_light_drivers toneRose
class node_device_configuration,node_firmware_library,node_sensor_console,node_home_assistant toneIndigo
```

## Components

### Sensor sampling

- [Soil probe](https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/soil_probe.c): `sensor/firmware/main/soil_probe.c`
- [SHT45 monitor](https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/sht45_monitor.c): `sensor/firmware/main/sht45_monitor.c`
- [Battery monitor](https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/battery_monitor.c): `sensor/firmware/main/battery_monitor.c`
- [Sensor application](https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/app_main.c): `sensor/firmware/main/app_main.c`

### Sensor delivery

- [Report delivery](https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/report_delivery.c): `sensor/firmware/main/report_delivery.c`
- [Report queue](https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/components/report_queue/report_queue.c): `sensor/firmware/components/report_queue/report_queue.c`
- [BTHome encoder](https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/components/bthome_payload/bthome_payload.c): `sensor/firmware/components/bthome_payload/bthome_payload.c`
- [BLE broadcaster](https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/bthome_broadcaster.c): `sensor/firmware/main/bthome_broadcaster.c`

### Hub collection

- [BLE subscriber](https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/ingestion/ble.py): `hub/src/open_plant_pulse_hub/ingestion/ble.py`
- [Advertisement ingestion](https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/application/ingestion.py): `hub/src/open_plant_pulse_hub/application/ingestion.py`
- [BTHome decoder](https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/ingestion/bthome.py): `hub/src/open_plant_pulse_hub/ingestion/bthome.py`
- [History and state](https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/application/store.py): `hub/src/open_plant_pulse_hub/application/store.py`

### Plant management

- [Profiles and care](https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/domain/plant_profiles.py): `hub/src/open_plant_pulse_hub/domain/plant_profiles.py`
- [Care event detection](https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/domain/care_events.py): `hub/src/open_plant_pulse_hub/domain/care_events.py`
- [Hub web application](https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/web.py): `hub/src/open_plant_pulse_hub/web.py`
- [Browser dashboard](https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/static/app.js): `hub/src/open_plant_pulse_hub/static/app.js`
- [Light scheduling](https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/lighting/service.py): `hub/src/open_plant_pulse_hub/lighting/service.py`
- [Light integrations](https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/lighting/neewer_gl1c.py): `hub/src/open_plant_pulse_hub/lighting/neewer_gl1c.py`

### Device services

- [Sensor configuration](https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/ingestion/device_configuration.py): `hub/src/open_plant_pulse_hub/ingestion/device_configuration.py`
- [Firmware updates](https://github.com/keefo/open-plant-pulse/blob/main/hub/src/open_plant_pulse_hub/application/firmware.py): `hub/src/open_plant_pulse_hub/application/firmware.py`
- [Sensor console](https://github.com/keefo/open-plant-pulse/blob/main/sensor/firmware/main/web_ui.c): `sensor/firmware/main/web_ui.c`

### Other components

- **Household user**
- **Home Assistant**

## Connections

- Sensor application → Soil probe: samples soil (evidence: `README.md`)
- Sensor application → SHT45 monitor: samples air (evidence: `README.md`)
- Sensor application → Battery monitor: reads battery (evidence: `README.md`)
- Sensor application → Report delivery: submits sample (evidence: `README.md`)
- Report delivery → Report queue: queues reports (evidence: `README.md`)
- Report delivery → BTHome encoder: encodes reports (evidence: `README.md`)
- BLE broadcaster → Household user: broadcasts BLE (evidence: `README.md`)
- BLE broadcaster → Home Assistant: broadcasts BTHome (evidence: `README.md`)
- BLE subscriber → Advertisement ingestion: passes advertisements (evidence: `hub/src/open_plant_pulse_hub/ingestion/ble.py`)
- Advertisement ingestion → BTHome decoder: decodes payload (evidence: `hub/src/open_plant_pulse_hub/application/ingestion.py`)
- Advertisement ingestion → History and state: records readings (evidence: `hub/src/open_plant_pulse_hub/application/ingestion.py`)
- Household user → Browser dashboard: manages plants (evidence: `README.md`)
- Browser dashboard → Hub web application: uses HTTP app (evidence: `README.md`)
- Hub web application → History and state: reads and writes (evidence: `hub/src/open_plant_pulse_hub/web.py`)
- History and state → Profiles and care: uses plant profiles (evidence: `hub/src/open_plant_pulse_hub/application/store.py`)
- History and state → Care event detection: stores care history (evidence: `README.md`)
- Hub web application → Light scheduling: routes light control (evidence: `hub/src/open_plant_pulse_hub/web.py`)
- Light scheduling → Light integrations: dispatches drivers (evidence: `hub/src/open_plant_pulse_hub/lighting/service.py`)
- Hub web application → Sensor configuration: manages sensor settings (evidence: `README.md`)
- Hub web application → Firmware updates: offers firmware updates (evidence: `README.md`)
- Household user → Sensor console: views device console (evidence: `README.md`)
