Add HAOS-Server sync for optional centralized management (Phase 5)
Some checks failed
Validate / Hassfest (push) Has been cancelled
Some checks failed
Validate / Hassfest (push) Has been cancelled
Enable the HAOS integration to optionally connect to the standalone Immich Watcher server for config sync and event reporting. Server-side: - New /api/sync/* endpoints: GET trackers, POST template render, POST event report - API key auth via X-API-Key header (accepts JWT access tokens) Integration-side: - New sync.py: ServerSyncClient with graceful error handling (all methods return defaults on connection failure) - Options flow: optional server_url and server_api_key fields with connection validation - Coordinator: fire-and-forget event reporting to server when album changes are detected - Translations: en.json and ru.json updated with new fields The connection is fully additive -- the integration works identically without a server URL configured. Server failures never break HA. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
49
plans/phase-5-haos-server-sync.md
Normal file
49
plans/phase-5-haos-server-sync.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# Phase 5: HAOS-Server Sync (Optional)
|
||||
|
||||
**Status**: In progress
|
||||
**Parent**: [primary-plan.md](primary-plan.md)
|
||||
|
||||
---
|
||||
|
||||
## Goal
|
||||
|
||||
Allow the HAOS integration to optionally connect to the standalone server, enabling:
|
||||
- Syncing tracker configurations from server to HA
|
||||
- Using server-managed templates for notifications
|
||||
- Centralized management via the web UI while HA provides entities/automations
|
||||
|
||||
The connection is **additive** -- the integration works standalone without a server.
|
||||
|
||||
---
|
||||
|
||||
## Tasks
|
||||
|
||||
### 1. Add server URL to HA config flow `[ ]`
|
||||
- Add optional `server_url` field to hub options flow
|
||||
- Add optional `server_api_key` field (JWT token or API key)
|
||||
- Validate connection on save
|
||||
|
||||
### 2. Server sync service `[ ]`
|
||||
- New `sync.py` module in integration
|
||||
- `async_sync_from_server()`: Fetch tracker configs from server API
|
||||
- Map server trackers to HA album subentries
|
||||
- Store server connection state in hub data
|
||||
|
||||
### 3. Server API endpoint for HA sync `[ ]`
|
||||
- `GET /api/sync/trackers` -- Returns tracker configs formatted for HA consumption
|
||||
- `GET /api/sync/templates/{id}/render` -- Render template with provided context
|
||||
- Auth via API key header (simpler than JWT for machine-to-machine)
|
||||
|
||||
### 4. Bidirectional event reporting `[ ]`
|
||||
- HA integration reports detected events back to server
|
||||
- `POST /api/sync/events` -- HA pushes event data to server for logging
|
||||
- Server dashboard shows events from both standalone polling and HA
|
||||
|
||||
---
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] Integration works identically without server URL configured
|
||||
- [ ] With server URL, tracker configs can be synced
|
||||
- [ ] Events detected by HA are visible in server dashboard
|
||||
- [ ] Server connection failure doesn't break HA integration
|
||||
@@ -200,7 +200,7 @@ async def _execute_telegram_notification(self, ...):
|
||||
- Album picker connected to Immich API
|
||||
- **Subplan**: `plans/phase-4-frontend.md`
|
||||
|
||||
### Phase 5: HAOS-Server Sync (Optional) `[ ]`
|
||||
### Phase 5: HAOS-Server Sync (Optional) `[x]`
|
||||
- Add optional server URL to HA config flow
|
||||
- Implement tracker/template config sync
|
||||
- **Subplan**: `plans/phase-5-haos-server-sync.md`
|
||||
|
||||
Reference in New Issue
Block a user