92 lines
2.5 KiB
Markdown
92 lines
2.5 KiB
Markdown
# Integrazione app homelab — P5/P6/P7
|
|
|
|
Tool live e RAG su **Loogle Casa**, **Home Assistant**, **Irrigazione** e **Turni**.
|
|
|
|
---
|
|
|
|
## P5 — Casa + Home Assistant
|
|
|
|
| Tool | Scope | Sorgente |
|
|
|------|-------|----------|
|
|
| `get_home_dashboard` | home:read | Loogle Casa |
|
|
| `get_home_weather` | home:read | Loogle Casa |
|
|
| `get_network_overview` | home:read | Loogle Casa |
|
|
| `get_network_failover_status` | home:read | Loogle Casa |
|
|
| `get_ha_entity` | home:read | Home Assistant |
|
|
| `list_ha_entities` | home:read | Home Assistant |
|
|
| `search_ha_entities` | home:read | Home Assistant |
|
|
|
|
### Variabili `.env`
|
|
|
|
```bash
|
|
LOOGLE_CASA_URL=https://casa.loogle.it
|
|
LOOGLE_CASA_API_URL=http://192.168.128.81:5602 # opzionale, LAN
|
|
LOOGLE_CASA_PASSWORD_DANIELE=... # daniele MCP → admin Casa
|
|
|
|
HA_URL=https://ha.loogle.it
|
|
HA_API_URL=http://192.168.128.81:8123
|
|
HA_TOKEN=<long-lived token HA>
|
|
```
|
|
|
|
**Mapping utenti MCP → app:**
|
|
- `daniele` → Casa `admin`, Irrigazione `admin`, Turni `daniely`
|
|
|
|
---
|
|
|
|
## P6 — Irrigazione + Turni
|
|
|
|
| Tool | Scope | Sorgente |
|
|
|------|-------|----------|
|
|
| `get_irrigation_status` | irrigation:read | irri.loogle.it |
|
|
| `get_irrigation_zones` | irrigation:read | irri.loogle.it |
|
|
| `get_irrigation_history` | irrigation:read | irri.loogle.it |
|
|
| `get_turni_status` | — (pubblico) | turni.loogle.it |
|
|
| `get_my_shifts` | turni:read | turni.loogle.it |
|
|
| `list_turni_doctors` | turni:read | turni.loogle.it |
|
|
|
|
```bash
|
|
IRRIGAZIONE_URL=https://irri.loogle.it
|
|
IRRIGAZIONE_API_URL=http://192.168.128.81:5601
|
|
IRRIGAZIONE_PASSWORD_DANIELE=...
|
|
|
|
TURNI_URL=https://turni.loogle.it
|
|
TURNI_PASSWORD_DANIELE=... # utente Turni: daniely
|
|
# oppure TURNI_JWT_DANIELE=...
|
|
```
|
|
|
|
---
|
|
|
|
## P7 — RAG storico app
|
|
|
|
Il worker `loogle-mcp-indexer` indicizza periodicamente:
|
|
- snapshot stato/zone Irrigazione
|
|
- storico irrigazioni ed eventi
|
|
- lavori manutenzione giardino
|
|
- turni e anagrafica medici Turni
|
|
|
|
| Collection Qdrant | Contenuto |
|
|
|-------------------|-----------|
|
|
| `apps_shared_family` | Irrigazione + Turni (famiglia) |
|
|
|
|
| Tool | Scope | Funzione |
|
|
|------|-------|----------|
|
|
| `search_apps_knowledge` | knowledge:read | RAG solo app |
|
|
| `search_knowledge` | knowledge:read | Include anche app |
|
|
| `list_apps_indexed` | knowledge:read | Stato indicizzazione |
|
|
| `reindex_apps` | admin | Forza sync |
|
|
|
|
```bash
|
|
APPS_INDEX_ENABLED=yes
|
|
APPS_INDEX_USER=daniele
|
|
```
|
|
|
|
---
|
|
|
|
## Test
|
|
|
|
```bash
|
|
docker exec loogle-mcp python3 /srv/scripts/test_p5_home.py
|
|
docker exec loogle-mcp python3 /srv/scripts/test_p6_apps.py
|
|
docker exec loogle-mcp python3 /srv/scripts/test_p7_apps_rag.py
|
|
```
|