feat: implement status monitoring, fault detection, and comms watchdog
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
21
Readme.md
21
Readme.md
@@ -11,7 +11,7 @@ This project implements a bridge between Zigbee (Home Assistant) and UART-based
|
||||
- UART communication at 9600 baud 8N1 for MideaUART protocol
|
||||
- Zigbee ZCL Thermostat cluster implementation
|
||||
- Bidirectional communication between Zigbee and UART layers
|
||||
- Status monitoring and error handling
|
||||
- Status monitoring with periodic AC polling, fault detection, and a communication watchdog
|
||||
- Configurable timing controls (50ms command spacing)
|
||||
|
||||
## Directory Structure
|
||||
@@ -22,6 +22,7 @@ src/
|
||||
midea_protocol.c/h - MideaUART protocol encoding/decoding
|
||||
zigbee_zcl.c/h - Zigbee ZCL Thermostat cluster
|
||||
integration_layer.c/h- Integration between Zigbee and UART layers
|
||||
status_monitor.c/h - AC status polling, fault detection, and comms watchdog
|
||||
main.c - Application entry point
|
||||
|
||||
test/
|
||||
@@ -29,6 +30,7 @@ test/
|
||||
midea_protocol_test.c - Unit tests for MideaUART protocol
|
||||
zigbee_zcl_test.c - Unit tests for Zigbee ZCL
|
||||
integration_layer_test.c - Unit tests for integration layer
|
||||
status_monitor_test.c - Unit tests for status monitoring
|
||||
|
||||
docs/
|
||||
protocol.md - MideaUART protocol details
|
||||
@@ -62,6 +64,23 @@ make upload
|
||||
make test
|
||||
```
|
||||
|
||||
## Status Monitoring
|
||||
|
||||
The `status_monitor` module (see `src/status_monitor.c/h`) provides:
|
||||
|
||||
- Periodic AC status polling: sends a MideaUART status-request frame over the UART
|
||||
driver, receives the response, and decodes it into a `midea_status_t`.
|
||||
- ZCL mapping: decoded status is mapped to ZCL Thermostat attributes
|
||||
(`local_temperature`, `system_mode`) for Home Assistant reporting.
|
||||
- Fault detection: any non-zero `error_code` or `alarm_mask` from the AC raises a
|
||||
fault flag (`status_monitor_has_fault`) and records the fault code.
|
||||
- Communication watchdog: tracks the time of the last successful poll and trips a
|
||||
timeout when the poll interval (plus per-attempt timeout) is exceeded or when
|
||||
`max_retries` consecutive attempts fail.
|
||||
|
||||
Configuration (`status_monitor_config_t`) exposes `poll_interval_ms` (default
|
||||
5000ms), `timeout_ms` (default 1000ms), and `max_retries` (default 3).
|
||||
|
||||
## Implementation Progress
|
||||
|
||||
See `docs/plans/2026-07-05-ballu-ac-esp32c6-controller-implementation.md` for detailed implementation plan and progress tracking.
|
||||
|
||||
Reference in New Issue
Block a user