Update docs for auth, time, discovery, and history changes
This commit is contained in:
@@ -34,15 +34,19 @@ Function names below are C++ references. Rust naming/layout may differ, but the
|
||||
- sync-request cadence 15 s while unsynced.
|
||||
- Receiver behavior:
|
||||
- decode/reconstruct sparse timestamps.
|
||||
- ACK each decoded batch promptly.
|
||||
- ACK accepted batches promptly.
|
||||
- reject unknown/mismatched sender identities before ACK and before SD/MQTT/web updates.
|
||||
- update MQTT, web status, SD logging.
|
||||
- Persistence:
|
||||
- Wi-Fi/MQTT/NTP/web credentials in Preferences namespace `dd3cfg`.
|
||||
- Web auth defaults:
|
||||
- `WEB_AUTH_REQUIRE_STA=true`
|
||||
- `WEB_AUTH_REQUIRE_AP=true`
|
||||
- Web and display time rendering:
|
||||
- local timezone from `TIMEZONE_TZ`.
|
||||
- SD logging:
|
||||
- CSV columns include both `ts_utc` and `ts_hms_utc`.
|
||||
- history parser expects this current layout.
|
||||
- CSV columns include both `ts_utc` and `ts_hms_local`.
|
||||
- history parser supports both current (`ts_utc,ts_hms_local,p_w,...`) and legacy (`ts_utc,p_w,...`) layouts.
|
||||
|
||||
## 3. Protocol and Data Contracts
|
||||
|
||||
@@ -58,7 +62,14 @@ Function names below are C++ references. Rust naming/layout may differ, but the
|
||||
- Timestamp constraints:
|
||||
- receiver rejects decoded data whose timestamps are below `MIN_ACCEPTED_EPOCH_UTC`
|
||||
- CSV header (current required layout):
|
||||
- `ts_utc,ts_hms_utc,p_w,p1_w,p2_w,p3_w,e_kwh,bat_v,bat_pct,rssi,snr,err_m,err_d,err_tx,err_last`
|
||||
- `ts_utc,ts_hms_local,p_w,p1_w,p2_w,p3_w,e_kwh,bat_v,bat_pct,rssi,snr,err_m,err_d,err_tx,err_last`
|
||||
- Home Assistant discovery contract:
|
||||
- topic: `homeassistant/sensor/<device_id>/<key>/config`
|
||||
- `unique_id`: `<device_id>_<key>`
|
||||
- `device.identifiers`: `["<device_id>"]`
|
||||
- `device.name`: `<device_id>`
|
||||
- `device.model`: `DD3-LoRa-Bridge`
|
||||
- `device.manufacturer`: `AcidBurns`
|
||||
|
||||
## 4. Module and Function Requirements
|
||||
|
||||
@@ -126,8 +137,9 @@ Function names below are C++ references. Rust naming/layout may differ, but the
|
||||
- configure NTP servers and timezone env.
|
||||
- `uint32_t time_get_utc()`
|
||||
- return epoch or `0` when not plausible.
|
||||
- updates "clock plausible" state independently from sync state.
|
||||
- `bool time_is_synced()`
|
||||
- sync status helper.
|
||||
- true only after explicit sync signals (NTP callback/status or trusted `time_set_utc`).
|
||||
- `void time_set_utc(uint32_t)`
|
||||
- set system time and sync flags.
|
||||
- `void time_get_local_hhmm(char*, size_t)`
|
||||
@@ -136,6 +148,8 @@ Function names below are C++ references. Rust naming/layout may differ, but the
|
||||
- `uint32_t time_get_last_sync_age_sec()`
|
||||
- Internal behavior-critical helpers:
|
||||
- `note_last_sync`
|
||||
- `mark_synced`
|
||||
- `ntp_sync_notification_cb`
|
||||
- `ensure_timezone_set`
|
||||
|
||||
## `src/lora_transport.cpp`
|
||||
@@ -202,12 +216,14 @@ Function names below are C++ references. Rust naming/layout may differ, but the
|
||||
- `fault_text`
|
||||
- `mqtt_connect`
|
||||
- `publish_discovery_sensor`
|
||||
- discovery payload uses canonical device identity fields and `manufacturer=AcidBurns`
|
||||
|
||||
## `src/wifi_manager.cpp`
|
||||
|
||||
- `void wifi_manager_init()`
|
||||
- `bool wifi_load_config(WifiMqttConfig&)`
|
||||
- `bool wifi_save_config(const WifiMqttConfig&)`
|
||||
- returns `false` when any Preferences write/verify fails.
|
||||
- `bool wifi_connect_sta(const WifiMqttConfig&, uint32_t timeout_ms)`
|
||||
- `void wifi_start_ap(const char*, const char*)`
|
||||
- `bool wifi_is_connected()`
|
||||
@@ -223,7 +239,7 @@ Function names below are C++ references. Rust naming/layout may differ, but the
|
||||
- `fault_text`
|
||||
- `ensure_dir`
|
||||
- `format_date_utc`
|
||||
- `format_hms_utc`
|
||||
- `format_hms_local`
|
||||
|
||||
## `src/display_ui.cpp`
|
||||
|
||||
@@ -395,6 +411,7 @@ These functions define end-to-end firmware behavior and must have equivalents:
|
||||
- bootstrap guardrail, retry counts, schedule intervals, min accepted epoch.
|
||||
- Preserve CSV output layout exactly:
|
||||
- consumers (history parser and external tooling) depend on it.
|
||||
- preserve reader compatibility for both current and legacy layouts.
|
||||
- Preserve enum meanings:
|
||||
- `FaultType`, `RxRejectReason`, `LoraMsgKind`.
|
||||
|
||||
@@ -415,5 +432,5 @@ Suggested Rust primitives:
|
||||
- Duplicate batch handling updates counters and suppresses duplicate publish/log.
|
||||
- Web UI shows `epoch (HH:MM:SS TZ)` local time.
|
||||
- SD CSV header/fields match expected order.
|
||||
- History endpoint reads only current CSV layout successfully.
|
||||
- History endpoint reads current and legacy CSV layouts successfully.
|
||||
- MQTT state/fault payload fields match existing names and semantics.
|
||||
|
||||
Reference in New Issue
Block a user