# dergary/all-in-one-sensor-device architecture

> Architecture diagram of the GitHub repository dergary/all-in-one-sensor-device, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dergary/all-in-one-sensor-device
- Repository: https://github.com/dergary/all-in-one-sensor-device

## Overview

This repository describes a DIY ESPHome smart-home sensor device, its firmware configurations, automations, and printable enclosure revisions. The intended workflow is local sensing—presence/motion, light, and air quality—followed by lighting or air-quality status automation and Home Assistant integration. The tree documents multiple device generations and connectivity options. Source excerpts only show the custom C4001 component, so links among the broader YAML-defined features are dashed and unverified; README-backed product relationships are cited to the README.

Main entry points: [`automations/control_leds.yaml`](https://github.com/dergary/all-in-one-sensor-device/blob/main/automations/control_leds.yaml) (Lighting automations), [`sensors/ld2410.yaml`](https://github.com/dergary/all-in-one-sensor-device/blob/main/sensors/ld2410.yaml) (Presence and motion), [`sensors/bh1750.yaml`](https://github.com/dergary/all-in-one-sensor-device/blob/main/sensors/bh1750.yaml) (Illuminance sensing), [`sensors/bme680.yaml`](https://github.com/dergary/all-in-one-sensor-device/blob/main/sensors/bme680.yaml) (Air and climate sensing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_firmware["Device firmware"]
  node_v1["V1 firmware<br/>[README.md]"]
  node_v2["V2 firmware<br/>[common.yaml]"]
  node_v21["V2.1 firmware<br/>[device.yaml]"]
  node_ultimate["Ultimate firmware<br/>[device.yaml]"]
  node_wifi["Network connectivity<br/>[wifi.yaml]"]
  node_thread["Thread connectivity<br/>[thread.yaml]"]
end

subgraph group_sensing["Sensors"]
  node_motion["Presence and motion<br/>[ld2410.yaml]"]
  node_light["Illuminance sensing<br/>[bh1750.yaml]"]
  node_air["Air and climate sensing<br/>[bme680.yaml]"]
  node_other_sensors["Other sensor configs"]
  node_c4001["C4001 UART component<br/>[c4001.cpp]"]
  node_c4001_entities["C4001 control entities<br/>[__init__.py]"]
end

subgraph group_automation["Automations"]
  node_lighting["Lighting automations<br/>[control_leds.yaml]"]
  node_air_status["Air-quality status"]
  node_led_status["Status LED<br/>[status_led.yaml]"]
end

subgraph group_hardware["Device hardware"]
  node_enclosure["Printed enclosures<br/>[models]"]
  node_sensor_device["ESP32 sensor device"]
end

node_ha(("Home Assistant"))

node_sensor_device -->|"integrates with"| node_ha
node_sensor_device -.->|"detects presence"| node_motion
node_sensor_device -.->|"measures brightness"| node_light
node_sensor_device -.->|"measures air quality"| node_air
node_sensor_device -.->|"uses sensor configs"| node_other_sensors
node_sensor_device -.->|"uses connectivity"| node_wifi
node_sensor_device -.->|"offers connectivity"| node_thread
node_c4001_entities -->|"configures"| node_c4001
node_c4001 -.->|"runs on ESP32"| node_sensor_device
node_motion -.->|"triggers lighting"| node_lighting
node_light -.->|"informs lighting"| node_lighting
node_air -.->|"informs status"| node_air_status
node_lighting -.->|"controls LEDs"| node_led_status
node_sensor_device -.->|"fits enclosure"| node_enclosure
node_v1 -.->|"defines revision"| node_sensor_device
node_v2 -.->|"defines revision"| node_sensor_device
node_v21 -.->|"defines revision"| node_sensor_device
node_ultimate -.->|"defines revision"| node_sensor_device

click node_v1 "https://github.com/dergary/all-in-one-sensor-device/blob/main/V1/README.md"
click node_v2 "https://github.com/dergary/all-in-one-sensor-device/blob/main/V2/common.yaml"
click node_v21 "https://github.com/dergary/all-in-one-sensor-device/blob/main/V2.1/device.yaml"
click node_ultimate "https://github.com/dergary/all-in-one-sensor-device/blob/main/Ultimate/device.yaml"
click node_wifi "https://github.com/dergary/all-in-one-sensor-device/blob/main/connectivity/wifi.yaml"
click node_thread "https://github.com/dergary/all-in-one-sensor-device/blob/main/connectivity/thread.yaml"
click node_motion "https://github.com/dergary/all-in-one-sensor-device/blob/main/sensors/ld2410.yaml"
click node_light "https://github.com/dergary/all-in-one-sensor-device/blob/main/sensors/bh1750.yaml"
click node_air "https://github.com/dergary/all-in-one-sensor-device/blob/main/sensors/bme680.yaml"
click node_other_sensors "https://github.com/dergary/all-in-one-sensor-device/tree/main/sensors"
click node_c4001 "https://github.com/dergary/all-in-one-sensor-device/blob/main/components/c4001/c4001.cpp"
click node_c4001_entities "https://github.com/dergary/all-in-one-sensor-device/blob/main/components/c4001/number/__init__.py"
click node_lighting "https://github.com/dergary/all-in-one-sensor-device/blob/main/automations/control_leds.yaml"
click node_air_status "https://github.com/dergary/all-in-one-sensor-device/blob/main/automations/set_air_quality_status_bme680.yaml"
click node_led_status "https://github.com/dergary/all-in-one-sensor-device/blob/main/automations/status_led.yaml"
click node_enclosure "https://github.com/dergary/all-in-one-sensor-device/tree/main/V2.1/models"

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_v1,node_v2,node_v21,node_ultimate,node_wifi,node_thread toneBlue
class node_motion,node_light,node_air,node_other_sensors,node_c4001,node_c4001_entities toneAmber
class node_lighting,node_air_status,node_led_status toneMint
class node_enclosure,node_sensor_device toneRose
class node_ha toneIndigo
```

## Components

### Device firmware

- [V1 firmware](https://github.com/dergary/all-in-one-sensor-device/blob/main/V1/README.md): `V1/README.md`
- [V2 firmware](https://github.com/dergary/all-in-one-sensor-device/blob/main/V2/common.yaml): `V2/common.yaml`
- [V2.1 firmware](https://github.com/dergary/all-in-one-sensor-device/blob/main/V2.1/device.yaml): `V2.1/device.yaml`
- [Ultimate firmware](https://github.com/dergary/all-in-one-sensor-device/blob/main/Ultimate/device.yaml): `Ultimate/device.yaml`
- [Network connectivity](https://github.com/dergary/all-in-one-sensor-device/blob/main/connectivity/wifi.yaml): `connectivity/wifi.yaml`
- [Thread connectivity](https://github.com/dergary/all-in-one-sensor-device/blob/main/connectivity/thread.yaml): `connectivity/thread.yaml`

### Sensors

- [Presence and motion](https://github.com/dergary/all-in-one-sensor-device/blob/main/sensors/ld2410.yaml): `sensors/ld2410.yaml`
- [Illuminance sensing](https://github.com/dergary/all-in-one-sensor-device/blob/main/sensors/bh1750.yaml): `sensors/bh1750.yaml`
- [Air and climate sensing](https://github.com/dergary/all-in-one-sensor-device/blob/main/sensors/bme680.yaml): `sensors/bme680.yaml`
- [Other sensor configs](https://github.com/dergary/all-in-one-sensor-device/tree/main/sensors): `sensors`
- [C4001 UART component](https://github.com/dergary/all-in-one-sensor-device/blob/main/components/c4001/c4001.cpp): `components/c4001/c4001.cpp`
- [C4001 control entities](https://github.com/dergary/all-in-one-sensor-device/blob/main/components/c4001/number/__init__.py): `components/c4001/number/__init__.py`

### Automations

- [Lighting automations](https://github.com/dergary/all-in-one-sensor-device/blob/main/automations/control_leds.yaml): `automations/control_leds.yaml`
- [Air-quality status](https://github.com/dergary/all-in-one-sensor-device/blob/main/automations/set_air_quality_status_bme680.yaml): `automations/set_air_quality_status_bme680.yaml`
- [Status LED](https://github.com/dergary/all-in-one-sensor-device/blob/main/automations/status_led.yaml): `automations/status_led.yaml`

### Device hardware

- [Printed enclosures](https://github.com/dergary/all-in-one-sensor-device/tree/main/V2.1/models): `V2.1/models`
- **ESP32 sensor device**

### Other components

- **Home Assistant**

## Connections

- ESP32 sensor device → Home Assistant: integrates with (evidence: `README.md`)
- ESP32 sensor device → Presence and motion: detects presence
- ESP32 sensor device → Illuminance sensing: measures brightness
- ESP32 sensor device → Air and climate sensing: measures air quality
- ESP32 sensor device → Other sensor configs: uses sensor configs
- ESP32 sensor device → Network connectivity: uses connectivity
- ESP32 sensor device → Thread connectivity: offers connectivity
- C4001 control entities → C4001 UART component: configures (evidence: `components/c4001/number/__init__.py`)
- C4001 UART component → ESP32 sensor device: runs on ESP32
- Presence and motion → Lighting automations: triggers lighting
- Illuminance sensing → Lighting automations: informs lighting
- Air and climate sensing → Air-quality status: informs status
- Lighting automations → Status LED: controls LEDs
- ESP32 sensor device → Printed enclosures: fits enclosure
- V1 firmware → ESP32 sensor device: defines revision
- V2 firmware → ESP32 sensor device: defines revision
- V2.1 firmware → ESP32 sensor device: defines revision
- Ultimate firmware → ESP32 sensor device: defines revision
