Sensors first implementation¶
Historical plan from 22 September 2026. This records the original sensor-only scope; it is not the current feature list or development workflow. See development and manual pump commands for current instructions.
Implement the user-approved Grow plan: one Rust sensor-only application, native macOS tests, cached ARMv6 cross-build and bounded SSH smoke test on pi@192.168.1.213, calibrated and raw moisture readings, MQTT discovery/availability, examples and systemd packaging. No pumps or output GPIO. No live service replacement. No commit or publication required.
Task 1: Sensor model, configuration and hardware¶
Own src/config.rs, src/sensor.rs, src/hardware.rs, src/lib.rs and examples/*.toml only. Root owns manifest, main, tooling and docs. Build small tested abstractions, no general framework.
Implement TOML Config with fields device_id (stable ASCII identifier), name, backend (simulated or hardware), sample_interval_ms (default 5000), stale_after_ms (default 15000), measurement_window_ms (default 1000), gpio_chip (default /dev/gpiochip0), sensors (Vec
Sensor interface: trait SensorSource: Send { fn read(&mut self) -> Vec<(u8, Result
Linux hardware driver: HardwareSource::new(&Config)->anyhow::Result
Examples: simulated.toml runnable without MQTT and hardware.toml with hardware_confirmed=false and uncalibrated channels 1..3; no invented plant calibration. Focused unit tests for config, calibration (both directions/clamping), invalid data and stale transitions. Prefix terminal commands rtk; use Zsh. No commits, no subagents. Report APIs and test evidence at .superpowers/sdd/implementation-plan/task-1-report.md.
Task 2: MQTT and application¶
Add bounded diagnostic CLI and long-lived run command. Use rumqttc 0.25 without TLS native dependencies, async Tokio single-threaded MQTT event loop and blocking sensor worker. Stable device IDs and per-channel discovery; raw Hz always exposed, calibrated percent only when configured; per-entity health/availability avoids presenting old samples as current. Retained discovery, nonretained state with expiry, retained availability and Last Will, reconnect and HA birth republish. Never replay a queue of stale measurements after reconnection. Test with a disposable local MQTT broker, including outage/reconnect and process death. No live credentials committed.
Task 3: Build loop, packaging and commissioning¶
Native cargo-zigbuild + Zig installed in ignored .tools; ARMv6 target arm-unknown-linux-gnueabihf with glibc2.28. Cross-smoke minimal executable, then full application. One bounded command builds/copies changed runtime files/runs isolated Pi diagnostics, keeps prior executable and records elapsed time. Ship docs, example credentials instructions and hardened systemd service. Confirm actual sensor and HA behaviour if commissioning inputs and Pi connectivity available; clearly report unavailable evidence without inventing success.