Add /notify endpoint for Home Assistant integration

- New /notify endpoint: simple {"message": "", "duration": 5} API
- Uses Priority 3 (Notify) with auto-expiring TTL
- Updated CLAUDE.md with HA integration examples
- Updated README.md with new features and endpoints
- Added Docker detector to documentation
- Removed completed TODO items

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-03 21:15:32 -06:00
parent 66c9790d2b
commit d149580387
3 changed files with 125 additions and 34 deletions

View File

@@ -61,6 +61,7 @@ Edit `config.json` to configure detectors:
| Memory | `detectors/memory.py` | — |
| Service | `detectors/service.py` | `SERVICES` (comma-separated process names) |
| Network | `detectors/network.py` | `HOSTS` (comma-separated hostnames/IPs) |
| Docker | `detectors/docker.py` | `CONTAINERS` (optional, monitors all if empty) |
All detectors support: `AGGREGATOR_URL`, `CHECK_INTERVAL`, `THRESHOLD_WARNING`, `THRESHOLD_CRITICAL`
@@ -70,7 +71,8 @@ All detectors support: `AGGREGATOR_URL`, `CHECK_INTERVAL`, `THRESHOLD_WARNING`,
|----------|--------|-------------|
| `/event` | POST | Register event: `{"id": "name", "priority": 1-4, "message": "optional", "ttl": seconds}` |
| `/clear` | POST | Clear event: `{"id": "name"}` |
| `/sleep` | POST | Enter sleep mode (for Home Assistant) |
| `/notify` | POST | Simple notification: `{"message": "text", "duration": 5}` |
| `/sleep` | POST | Enter sleep mode |
| `/wake` | POST | Exit sleep mode |
| `/status` | GET | Current state JSON |
| `/events` | GET | List active events |
@@ -93,7 +95,7 @@ The optimal state cycles through emotes with paired animations every 5 minutes:
| Emote | Animation | Vibe |
|-------|-----------|------|
| `( ^_^)` | breathing | calm |
| `( ᵔᴥᵔ)` | floating | dreamy |
| `( ˙▿˙)` | floating | content |
| `(◕‿◕)` | bouncing | cheerful |
| `( ・ω・)` | swaying | curious |
| `( ˘▽˘)` | breathing | cozy |
@@ -104,6 +106,43 @@ Additional states:
- **Connection lost**: `( ?.?)` gray, searching animation
- **Sleep mode**: `( -_-)zzZ` dim, very slow breathing
## Home Assistant Integration
Add REST commands to `configuration.yaml`:
```yaml
rest_command:
kao_notify:
url: "http://kao-host:5100/notify"
method: POST
content_type: "application/json"
payload: '{"message": "{{ message }}", "duration": {{ duration | default(5) }}}'
kao_sleep:
url: "http://kao-host:5100/sleep"
method: POST
kao_wake:
url: "http://kao-host:5100/wake"
method: POST
```
Use in automations:
```yaml
# Doorbell notification
- service: rest_command.kao_notify
data:
message: "Someone at the door"
duration: 10
# Bedtime routine
- service: rest_command.kao_sleep
# Morning routine
- service: rest_command.kao_wake
```
## File Structure
```
@@ -116,7 +155,8 @@ Additional states:
│ ├── cpu.py
│ ├── memory.py
│ ├── service.py
── network.py
── network.py
│ └── docker.py
├── requirements.txt
└── SPEC.md # Original project specification
```