Skip to content

Commit cfc9422

Browse files
authored
Merge branch 'main' into codex/update-entity-definitions-in-docs/entities.json
2 parents 949a92f + 803bc72 commit cfc9422

3 files changed

Lines changed: 325 additions & 187 deletions

File tree

docs/AI_Codex_Guide.md

Lines changed: 69 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ AI execution rules: this file + docs/AI_GUIDELINES.md (if present)
1111
0) Mission & Constraints
1212
Mission
1313

14-
Implement the Home, Rooms, Security, and Control Center screens as per the low-fi wireframes. Produce small, reviewable changes that run smoothly on device.
14+
Implement the Rooms, CCTV, Weather, Media, and Settings experiences as per the low-fi wireframes.
15+
Produce small, reviewable changes that run smoothly on device.
1516

1617
Hard Constraints (do not deviate)
1718

@@ -33,14 +34,19 @@ Keep interaction animations ≥50 FPS, ambient ≥30 FPS.
3334
AI_Codex_Guide.md ← this file (you are here)
3435
AI_GUIDELINES.md ← optional extra rules
3536

36-
/ui
37-
ui_theme.h ← tokens (spacing, colors, radii, motion)
38-
ui_components.* ← shared cards/chips/sliders/toasts
39-
ui_home.* ← Home screen
40-
ui_rooms.* ← Rooms screen
41-
ui_security.* ← Security (Frigate) screen
42-
ui_control_center.* ← Control Center sheet
43-
ui_debug.* ← optional debug overlay (FPS, heap)
37+
/custom/ui
38+
ui_theme.* ← tokens (spacing, colors, radii, motion)
39+
ui_nav_rail.* ← navigation rail & gestures
40+
ui_root.* ← screen container + page routing
41+
ui_wallpaper.* ← shared wallpaper helper
42+
pages/
43+
ui_page_rooms.* ← Rooms cards + detail events
44+
ui_page_cctv.* ← CCTV view + event list
45+
ui_page_weather.* ← Local climate metrics
46+
ui_page_media.* ← Media controls & scenes
47+
ui_page_settings.* ← Settings sliders + testers
48+
ui_rooms_model.* ← shared Rooms state helpers
49+
widgets/ ← shared cards/chips/sliders/toasts
4450

4551
/assets
4652
icons/ ← 1x assets sized to final use, RGB565
@@ -83,27 +89,37 @@ Do not invent new tokens, colors, or timings. If you need one, add it to docs/wi
8389

8490
Implement exactly these behaviors:
8591

86-
Home
92+
Rooms (ui_page_rooms.*)
8793

88-
Cards: tap → expand; long-press Quick Action → confirm sheet.
94+
- Grid of room cards populated from `ui_rooms_model.*`.
95+
- Tap the toggle on a card to fire `UI_PAGE_ROOMS_EVENT_TOGGLE` with optimistic feedback.
96+
- Long-press a card body to request the per-room sheet via `UI_PAGE_ROOMS_EVENT_OPEN_SHEET`.
97+
- Cards surface temperature/humidity badges and availability state.
8998

90-
Status chips: navigate to relevant screen; anomaly colors: accent/warn/alert.
99+
CCTV (ui_page_cctv.*)
91100

92-
Rooms
101+
- Primary camera card with Prev/Next controls, quality picker, and mute toggle shell.
102+
- Live feed placeholder sized per spec; keep toggles hidden on camera/event cards.
103+
- Event cards list recent clips; tapping should emit an open-clip signal when bindings arrive.
93104

94-
List left, detail right; two-finger swipe changes room.
105+
Weather (ui_page_weather.*)
95106

96-
Long-press a light → per-entity detail sheet.
107+
- Living Room card shows indoor temperature, humidity, and HVAC mode metrics.
108+
- Outdoor card surfaces raw sensor IDs with current readings.
109+
- Forecast row presents 3 quick-glance day summaries with iconography.
97110

98-
Security
111+
Media (ui_page_media.*)
99112

100-
Camera carousel + Live tile; event chips open clip/PiP.
113+
- Now Playing card renders album art, metadata, transport buttons, and a volume slider.
114+
- Quick Scenes card exposes preset buttons for lighting/media moods.
115+
- Hide unused default room-card specs/toggles when not applicable.
101116

102-
Alert mode: frame screen in warn/alert, focus automatically.
117+
Settings (ui_page_settings.*)
103118

104-
Control Center
105-
106-
Swipe-down to open; brightness, volume, toggles; sleep action.
119+
- Connectivity testers display pill states (Online/Degraded/Offline) per status callbacks.
120+
- Theme block combines dark-mode switch and theme dropdown; changes propagate via async payloads.
121+
- Brightness slider updates the numeric pill; action buttons (OTA, diagnostics, logs)
122+
forward events.
107123

108124
Global
109125

@@ -159,29 +175,42 @@ Fallback chain: HLS → MJPEG → snapshot (UI shows badge).
159175

160176
Skeleton screens (layout only)
161177

162-
Create empty ui_home.*, ui_rooms.*, ui_security.*, ui_control_center.* with layout objects and placeholder components from ui_components.*.
178+
- Stand up `custom/ui/ui_root.*` with nav rail scaffolding.
179+
- Create empty `ui_page_rooms.*`, `ui_page_cctv.*`, `ui_page_weather.*`, `ui_page_media.*`,
180+
and `ui_page_settings.*` with layout placeholders using shared widgets.
163181

164-
Hook tab navigation & gestures.
182+
Rooms iteration
165183

166-
Components
184+
- Build the room card grid with `ui_room_card` widgets and wire toggle/long-press events.
185+
- Populate cards from `ui_rooms_model.*`; surface climate badges and availability state.
167186

168-
Shared Card, Chip, Slider, Toast, Tabs, Confirm Sheet—styled via ui_theme.h.
187+
CCTV iteration
169188

170-
Bindings
189+
- Compose the live camera card with toolbar controls and video placeholder.
190+
- Lay out event cards for recent clips; stub tap handlers for future bindings.
171191

172-
Wire Home card values to mock data → then swap to MQTT/Frigate bindings.
192+
Weather iteration
173193

174-
Motion & feedback
194+
- Add Living Room and Outdoor cards with metric stacks.
195+
- Render the forecast row with icon + high/low pairs.
196+
197+
Media iteration
175198

176-
Add expand/contract, color pulse, toast confirmations; error states.
199+
- Flesh out the Now Playing card (album art, metadata, transport controls, volume slider).
200+
- Add Quick Scenes buttons and make them emit scene selection events.
177201

178-
Control Center
202+
Settings iteration
203+
204+
- Implement connectivity testers, theme toggle/dropdown, brightness slider, and action buttons.
205+
- Expose async setters for status/theme/brightness updates.
206+
207+
Motion & feedback
179208

180-
Brightness/volume toggles; sleep action; publish to HA where applicable.
209+
- Add transitions for card/toolbars, slider feedback, and toast confirmations; cover error states.
181210

182211
Debug & Perf
183212

184-
Hidden overlay; verify FPS/allocations.
213+
- Hidden overlay; verify FPS/allocations.
185214

186215
Each step should be a small PR (see checklist below).
187216

@@ -209,7 +238,14 @@ Each step should be a small PR (see checklist below).
209238

210239
Use a standard preface when asking the AI for changes:
211240

212-
Context: You are working in baba-dev/M5Tab5-UserDemo. Read docs/wireframes.md and docs/AI_Codex_Guide.md. Build only what those files describe. Use LVGL on Tab5 at 1280×720 landscape. Respect tokens in ui_theme.h. Keep changes minimal and isolated: prefer editing ui_home.*, ui_rooms.*, ui_security.*, ui_control_center.*, ui_components.*, or integration/*. Preload RGB565 assets sized to display; no runtime scaling. Use optimistic UI with rollback on timeout. Add a short note on performance and video of the result.
241+
Context: You are working in baba-dev/M5Tab5-UserDemo.
242+
Read docs/wireframes.md and docs/AI_Codex_Guide.md.
243+
Build only what those files describe. Use LVGL on Tab5 at 1280×720 landscape.
244+
Respect tokens in ui_theme.h. Keep changes minimal and isolated: prefer editing custom/ui/ui_root.*,
245+
custom/ui/pages/ui_page_*.*, custom/ui/pages/ui_rooms_model.*,
246+
custom/ui/widgets/*, or integration/*.
247+
Preload RGB565 assets sized to display; no runtime scaling.
248+
Use optimistic UI with rollback on timeout. Add a short note on performance and video of the result.
213249

214250
Example task prompts (no code requested here)
215251

docs/TASKS.md

Lines changed: 114 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -30,64 +30,129 @@ prerequisites, and deliver a focused change.
3030
- Considerations: update `docs/ARCHITECTURE.md` with the decision.
3131
- **M0.3 — Mock providers** (status: ☐)
3232
- Dependencies: M0.1.
33-
- Outcome: add mock data sources for Home, Rooms, and Security screens under
34-
`custom/integration/` behind a build flag.
35-
- Considerations: unblock UI work while MQTT is offline.
33+
- Outcome: add mock data sources for Rooms, CCTV, Weather, Media, and
34+
Settings pages under `custom/integration/` behind a build flag so each
35+
module in `custom/ui/pages/` has sample data.
36+
- Considerations: unblock UI work while MQTT is offline and document how to
37+
switch between real and mock providers.
3638

37-
### Milestone 1 — UI skeleton
39+
### Milestone 1 — Page scaffolding
3840

39-
- **M1.1 — Screen scaffolding** (status: )
41+
- **M1.1 — Rooms page scaffolding** (status: )
4042
- Dependencies: M0.3.
41-
- Outcome: create persistent LVGL objects for `ui_home.*`, `ui_rooms.*`,
42-
`ui_security.*`, and `ui_control_center.*` that match the layout spec.
43-
- Considerations: reuse placeholder widgets from `custom/ui/ui_components.*`.
44-
- **M1.2 — Shared components** (status: ☐)
45-
- Dependencies: M1.1.
46-
- Outcome: implement cards, chips, sliders, tabs, and confirm sheets styled
47-
via `ui_theme.h`.
48-
- Considerations: centralize styles so future screens stay consistent.
49-
- **M1.3 — Navigation and gestures** (status: ☐)
43+
- Outcome: create persistent LVGL layout for `ui_page_rooms.*`, including the
44+
toolbar, wallpaper, and grid of `ui_room_card` widgets managed by
45+
`ui_root.c`.
46+
- Current state: `ui_page_rooms_create` renders three cards with static
47+
descriptors, plays intro animations, and emits toggle/sheet events backed by
48+
mock `rooms_state_t` data inside the module.
49+
- Considerations: keep card gestures coordinated with
50+
`custom/ui/pages/ui_rooms_model.*` when real data arrives.
51+
- **M1.2 — CCTV page scaffolding** (status: ☑)
52+
- Dependencies: M0.3.
53+
- Outcome: build the CCTV layout in `ui_page_cctv.*` with toolbar controls,
54+
a `ui_room_card` wrapper for the live feed, and an events row prepared for
55+
camera history chips.
56+
- Current state: the page renders placeholder labels, hides unused toggles,
57+
and shows a stub "Live feed" container without switching logic or data.
58+
- Considerations: align toolbar button styles with shared assets from
59+
`custom/ui/ui_theme.h`.
60+
- **M1.3 — Weather page scaffolding** (status: ☑)
61+
- Dependencies: M0.3.
62+
- Outcome: assemble the climate dashboard in `ui_page_weather.*`, featuring
63+
indoor/outdoor cards and a flexible forecast row that can accept dynamic
64+
metrics.
65+
- Current state: static strings populate each metric block and forecast item,
66+
and the card toggles/specs are hidden until bindings are available.
67+
- Considerations: confirm copy and iconography match `docs/wireframes.md`.
68+
- **M1.4 — Media page scaffolding** (status: ☑)
69+
- Dependencies: M0.3.
70+
- Outcome: layout the media experience in `ui_page_media.*`, including now
71+
playing metadata, transport controls, quick scenes, and volume slider ready
72+
for callbacks.
73+
- Current state: album art, track labels, and transport buttons display
74+
placeholder content with no LVGL event handlers attached.
75+
- Considerations: ensure button spacing matches the reusable metrics from
76+
`custom/ui/ui_theme.h`.
77+
- **M1.5 — Settings page scaffolding** (status: ☑)
78+
- Dependencies: M0.3.
79+
- Outcome: implement the settings hierarchy in `ui_page_settings.*` with
80+
connectivity tests, theme controls, network tools, OTA prompts, and backup
81+
actions surfaced through `ui_page_settings_actions_t`.
82+
- Current state: the page constructs all sections, exposes setters such as
83+
`ui_page_settings_set_connection_status`, and binds actions via
84+
`app_launcher/view`, but integration calls still return placeholder states
85+
when hardware services are offline.
86+
- Considerations: document the action wiring in `docs/ARCHITECTURE.md` when
87+
integration matures.
88+
89+
### Milestone 2 — Data plumbing
90+
91+
- **M2.1 — Rooms state pipeline** (status: ☐)
5092
- Dependencies: M1.1.
51-
- Outcome: wire the tab rail, edge swipes, and control center sheet
52-
interactions.
53-
- Considerations: include optimistic animations for taps and long presses.
54-
55-
### Milestone 2 — Feature scaffolding
56-
57-
- **M2.1 — Home bindings** (status: ☐)
58-
- Dependencies: M1.2.
59-
- Outcome: connect Home cards to mock providers with optimistic updates ready
60-
for MQTT swap.
61-
- Considerations: keep command helpers in `custom/integration/`.
62-
- **M2.2 — Rooms interactions** (status: ☐)
63-
- Dependencies: M1.2.
64-
- Outcome: implement room detail updates, two-finger swipe navigation, and
65-
long-press sheets.
66-
- Considerations: validate gestures on hardware for reliability.
67-
- **M2.3 — Security carousel** (status: ☐)
93+
- Outcome: move the static room descriptors and `INITIAL_STATE` out of
94+
`ui_page_rooms.c` into a provider so `ui_page_rooms_set_state` consumes data
95+
supplied by `custom/integration/`.
96+
- Current state: not started; the page seeds its own mock entities and ignores
97+
external updates.
98+
- Considerations: surface toggle events via a shared bus so integrations can
99+
publish commands.
100+
- **M2.2 — CCTV event model** (status: ☐)
68101
- Dependencies: M1.2.
69-
- Outcome: build the camera carousel and event chips backed by mock Frigate
70-
data.
71-
- Considerations: respect the HLS → MJPEG → snapshot fallback described in
72-
the AI guide.
102+
- Outcome: define data structures for camera rotation and timeline chips,
103+
exposing setters on `ui_page_cctv.*` so integrations can drive the view.
104+
- Current state: not started; toolbar labels and chips are hard-coded.
105+
- Considerations: plan for Frigate clip metadata and snapshot fallbacks.
106+
- **M2.3 — Weather and climate adapter** (status: ☐)
107+
- Dependencies: M1.3.
108+
- Outcome: add an adapter layer that formats indoor, outdoor, and forecast
109+
data for `ui_page_weather.*`, including unit conversions and icon mapping.
110+
- Current state: not started; the page renders placeholder Fahrenheit/Celsius
111+
values without conversion helpers.
112+
- Considerations: reuse formatting helpers across Settings where applicable.
113+
- **M2.4 — Media control hooks** (status: ☐)
114+
- Dependencies: M1.4.
115+
- Outcome: attach LVGL callbacks in `ui_page_media.*` that emit play/pause,
116+
skip, volume, and quick-scene events to a media controller in
117+
`custom/integration/`.
118+
- Current state: not started; controls are visual only.
119+
- Considerations: coordinate icon/text updates when playback state changes.
120+
- **M2.5 — Settings telemetry bridge** (status: ☐⚙)
121+
- Dependencies: M1.5.
122+
- Outcome: finish threading connection test results, OTA progress, and theme
123+
persistence through `custom/integration/settings_controller.*` so UI status
124+
pills stay in sync.
125+
- Current state: partially implemented; `SettingsController` posts events but
126+
lacks coverage for every action and has stubbed fallback messages when
127+
platform services are unavailable.
128+
- Considerations: audit async callbacks to ensure they survive suspend/resume
129+
of the worker thread.
73130

74131
### Milestone 3 — Home Assistant integration
75132

76-
- **M3.1 — MQTT for Home and Rooms** (status: ☐)
77-
- Dependencies: M2.1 and M2.2.
78-
- Outcome: replace mock providers with real MQTT subscriptions and publish
79-
helpers.
80-
- Considerations: extend `docs/mqtt_contract.md` with payload schemas.
81-
- **M3.2 — Frigate live view** (status: ☐)
82-
- Dependencies: M2.3.
83-
- Outcome: stream live video with fallback handling and update the event
84-
timeline from Frigate.
85-
- Considerations: measure frame times against `docs/PERFORMANCE.md`.
86-
- **M3.3 — Control center commands** (status: ☐)
133+
- **M3.1 — MQTT bindings for Rooms** (status: ☐)
87134
- Dependencies: M2.1.
88-
- Outcome: publish brightness, volume, and toggle commands with rollback
89-
timers.
90-
- Considerations: log failures for debugging and expose status to the UI.
135+
- Outcome: subscribe to room sensor and light topics defined in
136+
`docs/mqtt_contract.md`, translate them into `rooms_state_t`, and publish
137+
toggle commands emitted by `ui_page_rooms`.
138+
- Current state: not started; Rooms still relies on compile-time mocks.
139+
- Considerations: debounce slider updates so MQTT traffic stays bounded.
140+
- **M3.2 — Climate and weather ingestion** (status: ☐)
141+
- Dependencies: M2.3.
142+
- Outcome: map MQTT sensor payloads to the weather adapter and refresh indoor
143+
metrics alongside settings-managed preferences like units and themes.
144+
- Current state: not started; all weather values are placeholders.
145+
- Considerations: document required topics and units in
146+
`docs/mqtt_contract.md`.
147+
- **M3.3 — Media and Settings integration** (status: ☐)
148+
- Dependencies: M2.4 and M2.5.
149+
- Outcome: hook media control events into Assist/Home Assistant transports and
150+
persist device settings (theme, brightness, updates) through MQTT or REST as
151+
defined in `custom/integration/`.
152+
- Current state: not started; media commands are local stubs and settings
153+
persistence runs on in-memory defaults.
154+
- Considerations: record integration quirks in `docs/ARCHITECTURE.md` and
155+
expand `docs/mqtt_contract.md` when new topics are introduced.
91156

92157
### Milestone 4 — Quality and automation
93158

0 commit comments

Comments
 (0)