Skip to content

Commit d07f402

Browse files
committed
Docs: Update AI Summary with Deep Analysis (Architecture & Process)
1 parent e589099 commit d07f402

1 file changed

Lines changed: 21 additions & 11 deletions

File tree

docs/smart-home/packages/ai_summary.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@ version: Unknown
1616

1717
## Executive Summary
1818
<!-- START_SUMMARY -->
19-
This package acts as the **Frontend** and **Controller** for the external **[AI Log Reporter Integration](../integrations/ai_reporter.md)**.
20-
1. It provides the **Template Sensor** to display the summary.
21-
2. It handles the **Scheduling** (7:00 AM) and **SSH Connection** logic to trigger the remote analysis.
19+
The **AI Summary** package serves as the Home Assistant-side controller for the **[AI Log Reporter Integration](../integrations/ai_reporter.md)**. It manages the scheduling, triggering, and data ingestion of daily system reports generated by a remote AI agent. This package ensures that the heavy lifting of log analysis is offloaded to a dedicated Docker container while keeping the results fully integrated into the Home Assistant dashboard via native sensors and notifications.
2220
<!-- END_SUMMARY -->
2321

2422
## Process Description (Non-Technical)
2523
<!-- START_DETAILED -->
26-
*No detailed non-technical description generated yet.*
24+
This system runs automatically every morning at 7:00 AM.
25+
1. **Trigger:** The system wakes up and sends a "Start" command to a remote server.
26+
2. **Analysis:** The remote server (running a specialized AI Reporter) reads the logs from the past 24 hours. It looks for errors, warnings, and unusual patterns.
27+
3. **Reporting:** Once finished, the remote server sends a summary back to Home Assistant.
28+
4. **Notification:** You receive a notification on your phone (and a persistent message in the dashboard) summarizing the health of your smart home.
2729
<!-- END_DETAILED -->
2830

2931
## Dashboard Connections
@@ -33,22 +35,30 @@ This package acts as the **Frontend** and **Controller** for the external **[AI
3335

3436
## Architecture Diagram
3537
<!-- START_MERMAID_DESC -->
36-
The diagram below illustrates the hand-off between this Home Assistant package and the external Docker container. For full implementation details of the remote system, see the **[AI Reporter Integration](../integrations/ai_reporter.md)** documentation.
38+
The sequence diagram below details the interaction between the local Home Assistant instance and the remote **AI Log Reporter**. The process is initiated by a time-based trigger (7:00 AM) or a manual script invocation. Home Assistant opens a secure SSH tunnel to the remote host (`10.0.0.23`) and executes a Docker command (`docker exec`). The `ai-log-reporter` container processes the logs and, upon completion, fires an asynchronous event (`update_ai_summary`) back to the Home Assistant API. This event payload is captured by a Template Trigger, which updates the permanent `sensor.daily_system_summary`.
3739
<!-- END_MERMAID_DESC -->
3840

3941
<!-- START_MERMAID -->
4042
```mermaid
4143
sequenceDiagram
4244
participant Sched as ⏰ Schedule
43-
participant Script as 📜 Script
45+
participant Script as 📜 Script: run_ai_summary_now
4446
participant SSH as 🔐 SSH Tunnel
45-
participant Remote as 📦 Remote Integration
47+
participant Remote as 📦 Docker: ai-log-reporter
48+
participant API as 📡 HA API
49+
participant Sensor as 🧠 Sensor: daily_system_summary
4650
4751
Sched->>Script: Trigger 7:00 AM
48-
Script->>SSH: Connect root@10.0.0.23
49-
SSH->>Remote: Trigger Docker Analysis
50-
Note over Remote: Processing...
51-
Remote-->>Script: (Async Event Return)
52+
Script->>SSH: ssh root@10.0.0.23 (Exec Reporter)
53+
activate SSH
54+
SSH->>Remote: docker exec python /app/reporter.py
55+
activate Remote
56+
Note right of Remote: Analyze Logs...
57+
Remote->>API: POST /api/events/update_ai_summary
58+
API->>Sensor: Event: update_ai_summary
59+
deactivate Remote
60+
SSH-->>Script: Exit Code 0
61+
deactivate SSH
5262
```
5363
<!-- END_MERMAID -->
5464

0 commit comments

Comments
 (0)