Feat: notification queue — buffer rapid /notify calls, play sequentially

When multiple /notify calls arrive in quick succession, they now queue up
and display one at a time rather than clobbering each other. Each notification
plays for its full duration before the next is promoted.

- /notify returns `queued: true` and `notify_queue_size` when buffered
- Cleanup thread auto-advances the queue when the playing notification expires
- /clear on the playing notification promotes the next immediately
- /clear on a queued (not-yet-playing) notification removes it from the queue
- /clear-all also drains the queue
- Status response includes `notify_queue_size` for frontend awareness

Bump to v2.3.3. Update OpenAPI spec, README, TODO.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 23:32:06 -06:00
parent 9f48dec4fc
commit 9a10a6e10c
6 changed files with 100 additions and 25 deletions

View File

@@ -16,6 +16,7 @@ Turn an old phone (with its OLED screen) into a glanceable ambient display for y
- **Extensible** — Add custom detectors for any metric
- **Personality** — Rotating expressions, celebration animations, sleep mode
- **Sound effects** — Optional audio cues for state changes (tap to enable)
- **Notification queue** — Rapid `/notify` bursts are buffered and played sequentially, never clobbering
- **Home Assistant ready** — Webhook endpoints for notifications and automation
## Quick Start
@@ -191,6 +192,8 @@ automation:
service: rest_command.kao_wake
```
Rapid `/notify` calls are queued automatically — each plays for its full `duration` before the next is shown. `/clear-all` drains the queue.
**Notify options:**
- `emote`: Any ASCII emote (e.g., `( °o°)`, `\\(^o^)/`)
- `color`: Hex color (e.g., `#FF9900`)
@@ -225,7 +228,7 @@ Navigate with `↑↓` or `Tab`, press `Enter` to fire, `Q` to quit. A toast con
| `/event` | POST | Register an event |
| `/clear` | POST | Clear an event by ID |
| `/clear-all` | POST | Clear all active events |
| `/notify` | POST | Simple notification `{"message": "", "duration": 5}` |
| `/notify` | POST | Queued notification `{"message": "", "duration": 5}` — buffered if one is playing |
| `/sleep` | POST | Enter sleep mode |
| `/wake` | POST | Exit sleep mode |
| `/docs` | GET | Interactive API documentation (Swagger UI) |