Skip to content

Commit 014e80b

Browse files
committed
Docs: Sync packages (AI Summary, Room Manager) and updates
1 parent 5d01851 commit 014e80b

9 files changed

Lines changed: 472 additions & 810 deletions

File tree

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
tags:
3+
- package
4+
- automated
5+
version: Unknown
6+
---
7+
8+
# Package: Ai Summary
9+
10+
**Version:** Unknown
11+
**Description:** No description provided.
12+
13+
<!-- START_IMAGE -->
14+
![Package Diagram](../../../assets/images/packages/ai_summary.png)
15+
<!-- END_IMAGE -->
16+
17+
## Executive Summary
18+
<!-- START_SUMMARY -->
19+
*No executive summary generated yet.*
20+
<!-- END_SUMMARY -->
21+
22+
## Process Description (Non-Technical)
23+
<!-- START_DETAILED -->
24+
*No detailed non-technical description generated yet.*
25+
<!-- END_DETAILED -->
26+
27+
## Dashboard Connections
28+
<!-- START_DASHBOARD -->
29+
*No linked dashboard views found (Automatic Scan).*
30+
<!-- END_DASHBOARD -->
31+
32+
## Architecture Diagram
33+
<!-- START_MERMAID_DESC -->
34+
*No architecture explanation generated yet.*
35+
<!-- END_MERMAID_DESC -->
36+
37+
<!-- START_MERMAID -->
38+
*No architecture diagram generated yet.*
39+
<!-- END_MERMAID -->
40+
41+
## Configuration (Source Code)
42+
```yaml
43+
# /config/packages/ai_summary.yaml (Updated)
44+
45+
template:
46+
- trigger:
47+
# This trigger listens for a custom event we will send from the script
48+
- platform: event
49+
event_type: "update_ai_summary"
50+
sensor:
51+
- name: "Daily System Summary"
52+
unique_id: ai_daily_summary_permanent
53+
# The state is just the timestamp of the last update
54+
state: "{{ now().strftime('%Y-%m-%d %H:%M') }}"
55+
icon: mdi:robot
56+
attributes:
57+
# This pulls the 'summary' text from the event data sent by your script
58+
summary: "{{ trigger.event.data.summary }}"
59+
60+
shell_command:
61+
generate_ai_log_summary: >
62+
ssh -i /config/.ssh/id_rsa_new
63+
-o StrictHostKeyChecking=no
64+
-o UserKnownHostsFile=/dev/null
65+
root@10.0.0.23
66+
'docker exec ai-log-reporter python /app/reporter.py'
67+
68+
script:
69+
run_ai_summary_now:
70+
alias: "Run AI Log Summary Now"
71+
icon: mdi:robot
72+
sequence:
73+
- action: shell_command.generate_ai_log_summary # Service changed to Action in 2024.12+
74+
- action: notify.persistent_notification # Optional: popup in HA UI
75+
data:
76+
title: "AI Reporter"
77+
message: "Gemini is analyzing logs and updating your dashboard."
78+
79+
automation:
80+
- alias: "Daily AI System Summary"
81+
id: daily_ai_summary_automation
82+
trigger:
83+
- platform: time
84+
at: "07:00:00"
85+
- platform: homeassistant
86+
event: start # Triggers script whenever HA reboots
87+
action:
88+
- delay: "00:01:00" # Wait 1 min for network to be ready
89+
- action: script.run_ai_summary_now
90+
91+
- alias: "Restore AI Notification on Startup"
92+
id: restore_ai_notification_on_startup
93+
trigger:
94+
- platform: homeassistant
95+
event: start
96+
action:
97+
- delay: "00:00:15" # Give the sensor a moment to restore its own state first
98+
- condition: template
99+
# Only restore if the sensor actually has a report saved
100+
value_template: "{{ state_attr('sensor.daily_system_summary', 'summary') not in [None, 'unknown', ''] }}"
101+
- action: persistent_notification.create
102+
data:
103+
title: "🤖 Daily Lab Report (Restored)"
104+
message: "{{ state_attr('sensor.daily_system_summary', 'summary') }}"
105+
notification_id: "daily_ai_summary"
106+
107+
```

docs/smart-home/packages/index.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Use this catalog to browse all installed configuration packages. Each package is
1313
This catalog is automatically maintained by the Documentation Agent.
1414

1515
## 📦 Installed Packages
16+
- **[Ai Summary](./ai_summary.md)**
17+
<br> :material-arrow-right-bottom: *No description provided.*
1618
- **[Airthings](./airthings.md)**
1719
<br> :material-arrow-right-bottom: *Normalizes Airthings Wave sensors (Temp, Humidity, CO2)*
1820
- **[Aqara W500](./aqara_w500.md)**
@@ -29,14 +31,12 @@ Use this catalog to browse all installed configuration packages. Each package is
2931
<br> :material-arrow-right-bottom: *Parametric Time-of-Day Logic*
3032
- **[Nordpool Prices](./nordpool_prices.md)**
3133
<br> :material-arrow-right-bottom: *Nordpool energy price calculations and logic*
32-
- **[Office. Pc](./office._pc.md)**
34+
- **[Office Pc](./office_pc.md)**
3335
<br> :material-arrow-right-bottom: *Office PC control (Audio, Displays, Power)*
34-
- **[Office PC](./office_pc.md)**
35-
<br> :material-arrow-right-bottom: **No description provided.**
3636
- **[Philips Air Purifier](./philips_air_purifier.md)**
3737
<br> :material-arrow-right-bottom: *Normalizes Philips Air Purifier attributes (PM2.5, Filters)*
38-
- **[Room Automation](./room_automation.md)**
39-
<br> :material-arrow-right-bottom: *Dynamic creation of room lighting settings via MQTT*
38+
- **[Room Manager](./room_manager.md)**
39+
<br> :material-arrow-right-bottom: *Dynamic creation of room settings via MQTT*
4040
- **[Scenes](./scenes.md)**
4141
<br> :material-arrow-right-bottom: *Definitions for various lighting scenes (Daylight, Night, Movie, etc.)*
4242
- **[Shelly 3Em](./shelly_3em.md)**
@@ -45,3 +45,5 @@ Use this catalog to browse all installed configuration packages. Each package is
4545
<br> :material-arrow-right-bottom: *Helpers and logic for the dynamic notification router*
4646
- **[Unifi Access](./unifi_access.md)**
4747
<br> :material-arrow-right-bottom: *Unified management for G4 Doorbell Pro Fingerprint & NFC.*
48+
- **[Washing Machine](./washing_machine.md)**
49+
<br> :material-arrow-right-bottom: *Logic for Washing Machine state tracking, run time calculation, and notifications.*

docs/smart-home/packages/nordpool_prices.md

Lines changed: 83 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ input_boolean:
7979
template:
8080
- triggers:
8181
- platform: time_pattern
82-
minutes: "/1"
82+
minutes: "0"
8383
- platform: homeassistant
8484
event: start
8585

@@ -181,49 +181,59 @@ template:
181181
- name: "Electricity Today 32nd Lowest Price"
182182
unique_id: electricity_today_32nd_lowest
183183
unit_of_measurement: "c/kWh"
184-
state: >
184+
availability: >
185185
{% set today = now().date().isoformat() %}
186186
{% set entries = state_attr('sensor.electricity_prices', 'data') %}
187187
{% if entries %}
188-
{% set today_prices = entries
188+
{{ entries
189+
| selectattr('start', 'defined')
190+
| selectattr('start', 'string')
191+
| selectattr('start', 'search', today)
192+
| list
193+
| count >= 32 }}
194+
{% else %}
195+
{{ false }}
196+
{% endif %}
197+
state: >
198+
{% set today = now().date().isoformat() %}
199+
{% set entries = state_attr('sensor.electricity_prices', 'data') %}
200+
{% set today_prices = entries
189201
| selectattr('start', 'defined')
190202
| selectattr('start', 'string')
191203
| selectattr('start', 'search', today)
192204
| map(attribute='price')
193205
| list %}
194-
{% if today_prices | count >= 32 %}
195-
{% set sorted = today_prices | sort %}
196-
{{ sorted[31] | round(2) }}
197-
{% else %}
198-
none
199-
{% endif %}
200-
{% else %}
201-
none
202-
{% endif %}
206+
{% set sorted = today_prices | sort %}
207+
{{ sorted[31] | round(2) }}
203208
204209
- sensor:
205210
- name: "Electricity Today 32nd Highest Price"
206211
unique_id: electricity_today_32nd_highest
207212
unit_of_measurement: "c/kWh"
208-
state: >
209-
{% set today = now().date() %}
213+
availability: >
214+
{% set today = now().date().isoformat() %}
210215
{% set entries = state_attr('sensor.electricity_prices', 'data') %}
211216
{% if entries %}
212-
{% set today_prices = entries
217+
{{ entries
218+
| selectattr('start', 'defined')
219+
| selectattr('start', 'string')
220+
| selectattr('start', 'search', today)
221+
| list
222+
| count >= 32 }}
223+
{% else %}
224+
{{ false }}
225+
{% endif %}
226+
state: >
227+
{% set today = now().date().isoformat() %}
228+
{% set entries = state_attr('sensor.electricity_prices', 'data') %}
229+
{% set today_prices = entries
213230
| selectattr('start', 'defined')
214231
| selectattr('start', 'string')
215-
| selectattr('start', 'search', today.isoformat())
232+
| selectattr('start', 'search', today)
216233
| map(attribute='price')
217234
| list %}
218-
{% if today_prices | count >= 32 %}
219-
{% set sorted = today_prices | sort(reverse=true) %}
220-
{{ sorted[31] | round(2) }}
221-
{% else %}
222-
none
223-
{% endif %}
224-
{% else %}
225-
none
226-
{% endif %}
235+
{% set sorted = today_prices | sort(reverse=true) %}
236+
{{ sorted[31] | round(2) }}
227237
228238
- sensor:
229239
- name: "Electricity Tomorrow Valid"
@@ -235,49 +245,59 @@ template:
235245
- name: "Electricity Tomorrow 32nd Lowest Price"
236246
unique_id: electricity_tomorrow_32nd_lowest
237247
unit_of_measurement: "c/kWh"
238-
state: >
248+
availability: >
239249
{% set tomorrow = (now() + timedelta(days=1)).date().isoformat() %}
240250
{% set entries = state_attr('sensor.electricity_prices', 'data') %}
241251
{% if entries %}
242-
{% set tomorrow_prices = entries
252+
{{ entries
253+
| selectattr('start', 'defined')
254+
| selectattr('start', 'string')
255+
| selectattr('start', 'search', tomorrow)
256+
| list
257+
| count >= 32 }}
258+
{% else %}
259+
{{ false }}
260+
{% endif %}
261+
state: >
262+
{% set tomorrow = (now() + timedelta(days=1)).date().isoformat() %}
263+
{% set entries = state_attr('sensor.electricity_prices', 'data') %}
264+
{% set tomorrow_prices = entries
243265
| selectattr('start', 'defined')
244266
| selectattr('start', 'string')
245267
| selectattr('start', 'search', tomorrow)
246268
| map(attribute='price')
247269
| list %}
248-
{% if tomorrow_prices | count >= 32 %}
249-
{% set sorted = tomorrow_prices | sort %}
250-
{{ sorted[31] | round(2) }}
251-
{% else %}
252-
none
253-
{% endif %}
254-
{% else %}
255-
none
256-
{% endif %}
270+
{% set sorted = tomorrow_prices | sort %}
271+
{{ sorted[31] | round(2) }}
257272
258273
- sensor:
259274
- name: "Electricity Tomorrow 32nd Highest Price"
260275
unique_id: electricity_tomorrow_32nd_highest
261276
unit_of_measurement: "c/kWh"
262-
state: >
277+
availability: >
263278
{% set tomorrow = (now() + timedelta(days=1)).date().isoformat() %}
264279
{% set entries = state_attr('sensor.electricity_prices', 'data') %}
265280
{% if entries %}
266-
{% set tomorrow_prices = entries
281+
{{ entries
282+
| selectattr('start', 'defined')
283+
| selectattr('start', 'string')
284+
| selectattr('start', 'search', tomorrow)
285+
| list
286+
| count >= 32 }}
287+
{% else %}
288+
{{ false }}
289+
{% endif %}
290+
state: >
291+
{% set tomorrow = (now() + timedelta(days=1)).date().isoformat() %}
292+
{% set entries = state_attr('sensor.electricity_prices', 'data') %}
293+
{% set tomorrow_prices = entries
267294
| selectattr('start', 'defined')
268295
| selectattr('start', 'string')
269296
| selectattr('start', 'search', tomorrow)
270297
| map(attribute='price')
271298
| list %}
272-
{% if tomorrow_prices | count >= 32 %}
273-
{% set sorted = tomorrow_prices | sort(reverse=true) %}
274-
{{ sorted[31] | round(2) }}
275-
{% else %}
276-
none
277-
{% endif %}
278-
{% else %}
279-
none
280-
{% endif %}
299+
{% set sorted = tomorrow_prices | sort(reverse=true) %}
300+
{{ sorted[31] | round(2) }}
281301
282302
- sensor:
283303
- name: "Energy Cost 15min"
@@ -333,7 +353,7 @@ template:
333353
- name: "Energy Cost Final 15min (c)"
334354
unique_id: energy_cost_final_15min_c
335355
unit_of_measurement: "c"
336-
device_class: monetary
356+
337357
state_class: measurement
338358
state: >
339359
{% set energy_kwh = trigger.from_state.state | float(0) %}
@@ -386,7 +406,7 @@ template:
386406
- name: "Current 15-Minute Electricity Price"
387407
unique_id: "current_15min_electricity_price"
388408
unit_of_measurement: "c/kWh"
389-
device_class: monetary
409+
390410
state_class: measurement
391411
state: >
392412
{# 1. Get the list of prices from the 'data' attribute #}
@@ -427,31 +447,30 @@ template:
427447
# Set the unit of measurement, copied from your existing sensor
428448
unit_of_measurement: "c/kWh"
429449
# Set the device class to 'monetary' so it's treated as a price
430-
device_class: monetary
450+
431451
# Set the state class for long-term statistics
432452
state_class: measurement
433453
# The 'icon' is optional, but this one fits
434454
icon: "mdi:chart-line"
435455
# This is where the magic happens
436-
state: >
456+
availability: >
437457
{% set tomorrow_str = (now().date() + timedelta(days=1)).isoformat() %}
438-
{% set price_data = state_attr('sensor.electricity_prices', 'truedata') %}
439-
458+
{% set price_data = state_attr('sensor.electricity_prices', 'data') %}
440459
{% if price_data is not none %}
441460
{% set tomorrow_prices = price_data
442-
| selectattr('start', 'starts_with', tomorrow_str)
443-
| map(attribute='price')
461+
| selectattr('start', 'search', tomorrow_str)
444462
| list %}
445-
446-
{% if tomorrow_prices | count > 0 %}
447-
{{ tomorrow_prices | average | round(3) }}
448-
{% else %}
449-
{# This will happen if tomorrow's data is not yet available #}
450-
unavailable
451-
{% endif %}
463+
{{ tomorrow_prices | count > 0 }}
452464
{% else %}
453-
{# This will happen if the 'truedata' attribute is missing #}
454-
unavailable
465+
{{ false }}
455466
{% endif %}
467+
state: >
468+
{% set tomorrow_str = (now().date() + timedelta(days=1)).isoformat() %}
469+
{% set price_data = state_attr('sensor.electricity_prices', 'data') %}
470+
{% set tomorrow_prices = price_data
471+
| selectattr('start', 'search', tomorrow_str)
472+
| map(attribute='price')
473+
| list %}
474+
{{ tomorrow_prices | average | round(3) }}
456475
457476
```

0 commit comments

Comments
 (0)