How beckalexander/esphome-component-dfrobot-c4001 works
This ESPHome component integrates the DFRobot C4001 mmWave presence sensor over UART. Users configure a sensor mode and expose entities; the hub exchanges commands and sensor reports with the module, then publishes occupancy, target measurements, versions, and configuration state. Configuration entities update hub settings, and the config-save action sends settings to the sensor for persistent storage. The README documents both Presence and Speed and Distance modes. Some entity implementations were not sampled, so their internal wiring is shown only where documented.
Main entry points: dfrobot_c4001.cpp C4001 hub · __init__.py Component setup · commands.cpp Commands and queue · number.cpp Numeric settings
Components 11
ESPHome Integration
- Component setup
components/dfrobot_c4001/__init__.py - C4001 hub
components/dfrobot_c4001/dfrobot_c4001.cpp
Sensor Protocol
- Commands and queue
components/dfrobot_c4001/commands.cpp
Entities
- Occupancy and config state
components/dfrobot_c4001/binary_sensor.py - Target measurements
components/dfrobot_c4001/sensor.py - Version reporting
components/dfrobot_c4001/text_sensor.py - Numeric settings
components/dfrobot_c4001/number/number.cpp - Setting switches
components/dfrobot_c4001/switch/switch.cpp - Control buttons
components/dfrobot_c4001/button/button.cpp
Other components
- ESPHome user
- UART sensor
Connections 15
- ESPHome user → Component setup: configures
- Component setup → C4001 hub: registers hub
- C4001 hub → Commands and queue: queues commands
- C4001 hub → UART sensor: sends and reads
- UART sensor → C4001 hub: sensor reports
- Commands and queue → C4001 hub: updates state
- C4001 hub → Occupancy and config state: publishes occupancy
- C4001 hub → Target measurements: publishes targets
- C4001 hub → Version reporting: publishes versions
- Numeric settings → C4001 hub: sets parameters
- Setting switches → C4001 hub: sets switches
- Control buttons → C4001 hub: invokes actions
- ESPHome user → Numeric settings: adjusts settings
- ESPHome user → Setting switches: toggles settings
- ESPHome user → Control buttons: presses controls