feat(tv-power): implement server PR1 with tests and documentation

This commit is contained in:
2026-04-01 08:07:18 +00:00
parent b5f5f30005
commit 3fc7d33e43
15 changed files with 1997 additions and 3 deletions

View File

@@ -18,6 +18,36 @@ This document describes the MQTT message structure used by the Infoscreen system
- **Format**: Integer (group ID)
- **Purpose**: Assigns clients to groups
### TV Power Intent (Phase 1)
- **Topic**: `infoscreen/groups/{group_id}/power/intent`
- **QoS**: 1
- **Retained**: Yes
- **Format**: JSON object
- **Purpose**: Group-level desired power state for clients assigned to that group
Phase 1 is group-only. Per-client power intent topics and client state/ack topics are deferred to Phase 2.
Example payload:
```json
{
"schema_version": "tv-power-intent.v1",
"intent_id": "9cf26d9b-87a3-42f1-8446-e90bb6f6ce63",
"group_id": 12,
"desired_state": "on",
"reason": "active_event",
"issued_at": "2026-03-31T10:15:30Z",
"expires_at": "2026-03-31T10:17:00Z",
"poll_interval_sec": 30,
"source": "scheduler"
}
```
Contract notes:
- `intent_id` changes only on semantic transition (`desired_state`/`reason` changes).
- Heartbeat republishes keep `intent_id` stable while refreshing `issued_at` and `expires_at`.
- Expiry is poll-based: `max(3 x poll_interval_sec, 90)`.
## Message Structure
### General Principles