Quick end-to-end data-flow proof using only what's on the ESP32-C6- DevKitC-1 itself (no sensors on the bare devkit -- confirmed via research: BOOT button, WS2812 LED, no external sensors): - drivers::chip_temperature_* wraps ESP-IDF's built-in temperature_sensor driver (SoC die temperature). - drivers::rgb_led_* wraps the onboard WS2812 (GPIO8) via the espressif/led_strip managed component (another external registry dependency, like mdns/mqtt). - profiles::ChipTemperatureSensor is the first real implementation of the Sensor interface designed earlier, converting the driver's float reading to the fixed-point convention once at the boundary. - transport/mqtt.cpp publishes chip temperature as an HA "temperature" sensor every 30s, and exposes the LED as an HA "light" entity (rgb_command_topic) -- the first use of MQTT subscribe in this project, not just publish. Added a ChipTemperature SensorChannel (distinct from AmbientTemperature -- different meaning/range) to sensor.h. Verified live: both the chip temperature reading and LED color control work from Home Assistant against the real device. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
sensors
Turns raw drivers readings into typed sensor values (e.g. debounced contact state, calibrated analog readings). Knows values, not hardware. REQUIRES drivers.
Common interface: include/sensor.h defines Sensor and SensorValue, deliberately modeled on Zephyr's sensor API:
- fetch()/get() split:
fetch()triggers one hardware read and caches it;get(channel, out)pulls a single channel out of that cache. Multi-channel sensors (e.g. BME280: temperature + humidity + pressure) pay the hardware cost once perfetch(), not once per channel. - Fixed-point
SensorValue:val1 + val2 * 1e-6, nofloat/double. ESP32-C6 has no hardware FPU, so this avoids software-emulated floating point on every sample. - Fine-grained
SensorChannelenum (AmbientTemperature,Humidity,AccelX, ...), mirroring Zephyr'sSENSOR_CHAN_*granularity.supports(channel)letsprofilesdiscover capabilities generically. set_trigger()for interrupt-driven sensors (data-ready pin, threshold, reed switch edge), so wake-on-event is possible instead of pure polling -- matters for the battery-first sleep/wake philosophy inAGENTS.md. Defaults to unsupported; polling-only sensors don't override it.
Every concrete sensor (reed switch, DS18B20, BME280, ...) implements Sensor, so profiles and lua_runtime can consume any of them uniformly.