Add sleep mode and documentation

- Sleep/wake endpoints for Home Assistant webhooks
- Sleep state: dim ( -_-)zzZ with slow breathing animation
- Updated CLAUDE.md with full technical reference
- Added README.md with user guide and HA integration examples

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-02 21:43:25 -06:00
parent af4ccb9a35
commit 53e6f0bcdd
4 changed files with 238 additions and 30 deletions

View File

@@ -25,12 +25,9 @@ Sentry-Emote is a minimalist system status monitor designed for an old Pixel pho
## Quick Start
```bash
# Setup
python -m venv venv
source venv/bin/activate # or .\venv\Scripts\activate on Windows
pip install -r requirements.txt
# Run everything
python sentry.py
```
@@ -38,7 +35,7 @@ UI available at http://localhost:5000
## Configuration
Edit `config.json` to configure the aggregator URL, enable/disable detectors, and set thresholds.
Edit `config.json` to configure detectors:
```json
{
@@ -49,11 +46,7 @@ Edit `config.json` to configure the aggregator URL, enable/disable detectors, an
"name": "cpu",
"enabled": true,
"script": "detectors/cpu.py",
"env": {
"CHECK_INTERVAL": "30",
"THRESHOLD_WARNING": "85",
"THRESHOLD_CRITICAL": "95"
}
"env": { "CHECK_INTERVAL": "30", "THRESHOLD_WARNING": "85", "THRESHOLD_CRITICAL": "95" }
}
]
}
@@ -73,35 +66,43 @@ All detectors support: `AGGREGATOR_URL`, `CHECK_INTERVAL`, `THRESHOLD_WARNING`,
## API Endpoints
- `POST /event` — Register event: `{"id": "name", "priority": 1-4, "message": "optional", "ttl": optional_seconds}`
- `POST /clear` — Clear event: `{"id": "name"}`
- `GET /status` — Current state JSON
- `GET /events` — List active events
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/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) |
| `/wake` | POST | Exit sleep mode |
| `/status` | GET | Current state JSON |
| `/events` | GET | List active events |
## Priority System
Lower number = higher priority. Events with a `ttl` auto-expire (heartbeat pattern).
| Priority | State | Emote | Color | Behavior |
|----------|----------|----------|--------|----------|
| 1 | Critical | `( x_x)` | Red | Shaking animation |
| 2 | Warning | `( o_o)` | Yellow | Breathing animation |
| 3 | Notify | `( 'o')` | Blue | Popping animation, 10s default TTL |
| 4 | Optimal | `( ^_^)` | Green | Default when no events |
| Priority | State | Emote | Color | Animation |
|----------|-------|-------|-------|-----------|
| 1 | Critical | `( x_x)` | Red | shaking |
| 2 | Warning | `( o_o)` | Yellow | breathing |
| 3 | Notify | `( 'o')` | Blue | popping |
| 4 | Optimal | varies | Green | varies |
## Testing Events
## Personality System
```bash
# Warning with 30s TTL
curl -X POST -H "Content-Type: application/json" \
-d '{"id":"test","priority":2,"message":"Test warning","ttl":30}' \
http://localhost:5000/event
The optimal state cycles through emotes with paired animations every 5 minutes:
# Clear manually
curl -X POST -H "Content-Type: application/json" \
-d '{"id":"test"}' \
http://localhost:5000/clear
```
| Emote | Animation | Vibe |
|-------|-----------|------|
| `( ^_^)` | breathing | calm |
| `( ᵔᴥᵔ)` | floating | dreamy |
| `(◕‿◕)` | bouncing | cheerful |
| `( ・ω・)` | swaying | curious |
| `( ˘▽˘)` | breathing | cozy |
Additional states:
- **Idle expressions** (15% chance): `( -_^)`, `( ^_~)`, `( ᵕ.ᵕ)` with blink animation
- **Recovery celebration**: `\(^o^)/` with bounce for 5 seconds after issues resolve
- **Connection lost**: `( ?.?)` gray, searching animation
- **Sleep mode**: `( -_-)zzZ` dim, very slow breathing
## File Structure