Skip to content

Commit ccbbcd4

Browse files
authored
Add Powerwall live outage activity support
Adds a reusable live activity notification helper and Powerwall outage live updates/clear logic. Also ignores generated Home Assistant cache artifacts under config/.cache/.
2 parents e3fad21 + b0cd52d commit ccbbcd4

5 files changed

Lines changed: 210 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ hacs
7070
alexa_media
7171
custom_components
7272
config/www/community
73-
config/.cache/brands/integrations/
73+
config/.cache/
7474
community
7575
image
7676
tts

config/packages/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Live collection of plug-and-play Home Assistant packages. Each YAML file in this
4646
| [logbook_activity_feed.yaml](logbook_activity_feed.yaml) | Dummy `sensor.activity_feed` + helper to write clean Activity entries (Issue #1550). | `sensor.activity_feed`, `script.send_to_logbook` |
4747
| [mariadb_monitoring.yaml](mariadb_monitoring.yaml) | MariaDB health sensors and Lovelace dashboard snippet for recorder stats. | `sensor.mariadb_status`, `sensor.database_size` |
4848
| [docker_infrastructure.yaml](docker_infrastructure.yaml) | Docker host patching telemetry + container/stack Repairs automation, 20-minute Joanna escalation for persistent container outages, and weekly scheduled prune actions across docker_10/14/17/69. | `sensor.docker_*_apt_status`, `binary_sensor.*_stack_status`, `sensor.docker_stacks_down_count`, `repairs.create`, `script.joanna_dispatch` |
49+
| [github_watched_repo_scout.yaml](github_watched_repo_scout.yaml) | Nightly Joanna dispatch that reviews unread notifications from watched GitHub repos, recommends HA-config ideas, refreshes strong-candidate issues, and marks processed watched-repo notifications read. | `automation.github_watched_repo_scout_nightly`, `script.joanna_dispatch`, `script.send_to_logbook` |
4950
| [proxmox.yaml](proxmox.yaml) | Proxmox runtime and disk pressure monitoring with Repairs for node degradations plus nightly Frigate reboot. | `binary_sensor.proxmox*_runtime_healthy`, `sensor.proxmox*_disk_used_percentage`, `repairs.create`, `button.qemu_docker2_101_reboot` |
5051
| [infrastructure_observability.yaml](infrastructure_observability.yaml) | Normalized WAN/DNS/backup/domain/cert health + website uptime/latency SLO signals for Infrastructure dashboards. | `binary_sensor.infra_website_uptime_slo_breach`, `binary_sensor.infra_website_latency_degraded`, `binary_sensor.infra_*` |
5152
| [onenote_indexer.yaml](onenote_indexer.yaml) | OneNote indexer health/status monitoring for Joanna, failure-repair automation, and a daily duplicate-delete maintenance request. | `sensor.onenote_indexer_last_job_status`, `binary_sensor.onenote_indexer_last_job_successful` |
@@ -58,7 +59,7 @@ Live collection of plug-and-play Home Assistant packages. Each YAML file in this
5859
| [water_delivery.yaml](water_delivery.yaml) | ReadyRefresh delivery date helper with night-before + garage door Alexa reminders, plus helper-change audit logging and Telegram confirmations. | `input_datetime.water_delivery_date`, `script.send_to_logbook`, `script.joanna_send_telegram`, `notify.alexa_media_garage` |
5960
| [vacation_mode.yaml](vacation_mode.yaml) | Auto-enable vacation mode after 24 hours away or no bed use, track sitter analytics/secure-house checks, and deliver Chromecast-first vacation briefings with a garage Alexa welcome. | `input_boolean.vacation_mode`, `input_boolean.house_sitter_present`, `sensor.vacation_house_sitter_*`, `group.garage_doors`, `lock.front_door`, `script.notify_engine`, `script.joanna_send_telegram` |
6061
| [maintenance_log.yaml](maintenance_log.yaml) | Joanna maintenance webhook ingest for water softener salt with idempotent event handling, Activity feed logging, and recorder-backed helper history for long-term graphing. | `automation.maintenance_log_joanna_webhook_ingest`, `input_number.water_softener_salt_total_added_lb`, `counter.water_softener_salt_event_count`, `sensor.water_softener_salt_days_since_last_add` |
61-
| [powerwall.yaml](powerwall.yaml) | Track Tesla Powerwall grid status and shed loads automatically when off-grid (alerts include Activity feed + Repairs). | `binary_sensor.powerwall_grid_status`, `sensor.powerwall_*`, `repairs.create` |
62+
| [powerwall.yaml](powerwall.yaml) | Track Tesla Powerwall grid status, push live outage tracking to mobile targets, and shed loads automatically when off-grid (alerts include Activity feed + Repairs). | `binary_sensor.powerwall_grid_status`, `sensor.powerwall_*`, `script.notify_live_activity`, `repairs.create` |
6263
| [tesla_model_y.yaml](tesla_model_y.yaml) | Remind the garage and parents to plug in the Model Y after low-battery arrivals and after 8 PM when it is home but not charging. | `sensor.spaceship_battery_level`, `switch.spaceship_charge`, `notify.alexa_media_garage`, `script.notify_engine` |
6364
| [vacuum.yaml](vacuum.yaml) | Dreame vacuum orchestration with room tracking, push alerts, Activity feed, Repairs issues on errors, and Alexa one-off room-clean switches. | `input_select.l10s_vacuum_phase`, `sensor.l10s_vacuum_error`, `repairs.create` |
6465
| [hass_agent_homepc.yaml](hass_agent_homepc.yaml) | Mirrors PC lock/unlock state from HASS.Agent to the office lamp for instant desk presence cues. | `sensor.carlo_homepc_carlo_homepc_sessionstate`, `switch.office_lamp_switch` |

config/packages/powerwall.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
# Tesla Powerwall - Monitoring and outage automations
77
# Related Issue: 1550
88
# Related Issue: 1571
9+
# Related Issue: 1598
910
# Powerwall status sensors, outage alerting, and load-shedding helpers.
1011
# -------------------------------------------------------------------
1112
# Notes: Read more https://www.vcloudinfo.com/2018/01/going-green-to-save-some-green-in-2018.html | Existing Issue #272
1213
# Tesla Powerwall added via UI Integration
14+
# Notes: Live outage tracking derives its chronometer anchor from binary_sensor.powerwall_grid_status.last_changed.
1315
######################################################################
1416
# Binary Sensors:
1517
# - binary_sensor.powerwall_charging ............. battery_charging (on=charging)
@@ -53,7 +55,102 @@ script:
5355
- switch.kitchen_accent_2
5456
- switch.master_bathroom_accent_2
5557

58+
powerwall_outage_live_activity_update:
59+
alias: "Powerwall - Outage Live Activity Update"
60+
description: Refresh the tagged outage live activity using native grid-status state metadata.
61+
mode: queued
62+
sequence:
63+
- variables:
64+
grid_entity: "{{ states.binary_sensor.powerwall_grid_status if states.binary_sensor.powerwall_grid_status is defined else none }}"
65+
outage_started_ts: >-
66+
{% if grid_entity is not none and grid_entity.state == 'off' %}
67+
{{ as_timestamp(grid_entity.last_changed, 0) | int(0) }}
68+
{% else %}
69+
0
70+
{% endif %}
71+
charge_pct: >-
72+
{% set charge = states('sensor.powerwall_charge') %}
73+
{% if charge not in ['unknown', 'unavailable', 'none', ''] %}
74+
{{ charge | float(0) | round(0) | int(0) }}
75+
{% else %}
76+
0
77+
{% endif %}
78+
outage_started_label: >-
79+
{% if outage_started_ts > 0 %}
80+
{{ as_datetime(outage_started_ts) | as_local | strftime('%I:%M %p') }}
81+
{% else %}
82+
unknown
83+
{% endif %}
84+
- condition: template
85+
value_template: "{{ outage_started_ts > 0 }}"
86+
- service: script.notify_live_activity
87+
data:
88+
who: parents
89+
tag: powerwall_grid_outage
90+
title: "Power outage"
91+
message: "Grid outage since {{ outage_started_label }}. Powerwall charge at {{ charge_pct }}%."
92+
icon: mdi:transmission-tower-off
93+
color: "#E65100"
94+
progress: "{{ charge_pct }}"
95+
progress_max: 100
96+
chronometer: true
97+
when: "{{ outage_started_ts }}"
98+
when_relative: false
99+
56100
automation:
101+
- alias: "Powerwall outage - Refresh live activity"
102+
id: 5b5fb370-c6cb-4c74-95d4-264737e4456f
103+
description: Start the tagged outage live activity when the grid drops and refresh it when charge changes.
104+
mode: restart
105+
trigger:
106+
- id: grid_off
107+
platform: state
108+
entity_id: binary_sensor.powerwall_grid_status
109+
to: 'off'
110+
- id: charge_change
111+
platform: state
112+
entity_id: sensor.powerwall_charge
113+
action:
114+
- choose:
115+
- conditions:
116+
- condition: trigger
117+
id: grid_off
118+
- condition: template
119+
value_template: >-
120+
{{ trigger.to_state is not none and trigger.from_state is not none and
121+
trigger.to_state.state not in ['unknown', 'unavailable', 'null'] and
122+
trigger.from_state.state not in ['unknown', 'unavailable', 'null'] }}
123+
sequence:
124+
- service: script.powerwall_outage_live_activity_update
125+
- conditions:
126+
- condition: trigger
127+
id: charge_change
128+
- condition: state
129+
entity_id: binary_sensor.powerwall_grid_status
130+
state: 'off'
131+
- condition: template
132+
value_template: "{{ trigger.to_state is not none and trigger.to_state.state not in ['unknown', 'unavailable', 'none', ''] }}"
133+
sequence:
134+
- service: script.powerwall_outage_live_activity_update
135+
136+
- alias: "Powerwall outage - Clear live activity"
137+
id: 1d998f72-50df-46eb-b335-7f0d9974f89a
138+
description: Clear the tagged outage live activity after the grid is stable again.
139+
mode: single
140+
trigger:
141+
- platform: state
142+
entity_id: binary_sensor.powerwall_grid_status
143+
from: 'off'
144+
to: 'on'
145+
for:
146+
minutes: 2
147+
action:
148+
- service: script.notify_live_activity
149+
data:
150+
who: parents
151+
tag: powerwall_grid_outage
152+
clear: true
153+
57154
- alias: Notify if Grid is down
58155
id: 56a32121-5725-4510-a1fa-10f69a5c82ef
59156
trigger:

config/script/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Reusable scripts that other automations call for notifications, lighting, and sa
2828
| File | Why it matters |
2929
| --- | --- |
3030
| [notify_engine.yaml](notify_engine.yaml) | Single entrypoint for rich push notifications. |
31+
| [notify_live_activity.yaml](notify_live_activity.yaml) | Shared helper for tagged live activity/live update pushes and clear commands. |
3132
| [send_to_logbook.yaml](send_to_logbook.yaml) | Generic `logbook.log` helper for Activity feed entries (Issue #1550). |
3233
| [joanna_dispatch.yaml](joanna_dispatch.yaml) | Shared BearClaw/Joanna dispatch schema for automation remediation requests. |
3334
| [speech_engine.yaml](speech_engine.yaml) | TTS/announcement orchestration with templated speech. |
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
######################################################################
2+
# @CCOSTAN - Follow Me on X
3+
# For more info visit https://www.vcloudinfo.com/click-here
4+
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
5+
# -------------------------------------------------------------------
6+
# Notify Live Activity - Shared helper for tagged live mobile updates
7+
# Related Issue: 1598
8+
# Sends or clears tagged live activity/live update notifications.
9+
# -------------------------------------------------------------------
10+
# Notes: Resolves notify target from `who` similar to notify_engine.
11+
# Notes: Uses `clear_notification` plus `tag` to end a live activity.
12+
# Notes: Defaults are tuned for Powerwall outage tracking on iOS parents.
13+
######################################################################
14+
15+
notify_live_activity:
16+
alias: Notify Live Activity
17+
description: Send or clear a tagged live-tracking notification for supported mobile targets.
18+
mode: queued
19+
fields:
20+
who:
21+
description: Notification audience key (carlo, stacey, family, parents).
22+
example: parents
23+
tag:
24+
description: Stable notification tag used to replace or clear the live activity.
25+
example: powerwall_grid_outage
26+
title:
27+
description: Notification title.
28+
example: Power outage
29+
message:
30+
description: Notification message body.
31+
example: Grid outage in progress. Powerwall charge at 82%.
32+
icon:
33+
description: Material Design icon for the live activity.
34+
example: mdi:transmission-tower-off
35+
color:
36+
description: Hex color for the live activity icon.
37+
example: "#E65100"
38+
progress:
39+
description: Progress value for the live activity.
40+
example: 82
41+
progress_max:
42+
description: Maximum progress value.
43+
example: 100
44+
chronometer:
45+
description: Enable the live chronometer.
46+
example: true
47+
when:
48+
description: Unix timestamp in seconds for the chronometer anchor.
49+
example: 1742846400
50+
when_relative:
51+
description: Treat the `when` value as relative seconds instead of an absolute timestamp.
52+
example: false
53+
clear:
54+
description: Set true to clear the existing live activity for the tag.
55+
example: false
56+
sequence:
57+
- variables:
58+
normalized_who: "{{ who | default('parents', true) | string | lower | trim }}"
59+
notify_service: >-
60+
{% if normalized_who == 'stacey' %}
61+
notify.mobile_app_stacey_iphone11
62+
{% elif normalized_who == 'carlo' %}
63+
notify.mobile_app_carlo_maxpro
64+
{% elif normalized_who == 'family' %}
65+
notify.ios_family
66+
{% else %}
67+
notify.ios_parents
68+
{% endif %}
69+
notification_tag: "{{ tag | default('live_activity', true) | string | trim }}"
70+
clear_flag: "{{ clear | default(false, true) | bool }}"
71+
live_title: "{{ title | default('Live update', true) | string | trim }}"
72+
live_message: "{{ message | default('Live update in progress.', true) | string | trim }}"
73+
live_icon: "{{ icon | default('mdi:progress-helper', true) | string | trim }}"
74+
live_color: "{{ color | default('#2196F3', true) | string | trim }}"
75+
live_progress: "{{ progress | default(-1, true) | int(-1) }}"
76+
live_progress_max: "{{ progress_max | default(100, true) | int(100) }}"
77+
live_chronometer: "{{ chronometer | default(false, true) | bool }}"
78+
live_when: "{{ when | default(0, true) | int(0) }}"
79+
live_when_relative: "{{ when_relative | default(false, true) | bool }}"
80+
- condition: template
81+
value_template: "{{ notification_tag != '' }}"
82+
- choose:
83+
- conditions:
84+
- condition: template
85+
value_template: "{{ clear_flag }}"
86+
sequence:
87+
- service: "{{ notify_service }}"
88+
data:
89+
message: clear_notification
90+
data:
91+
tag: "{{ notification_tag }}"
92+
default:
93+
- service: "{{ notify_service }}"
94+
data:
95+
title: "{{ live_title }}"
96+
message: "{{ live_message }}"
97+
data:
98+
tag: "{{ notification_tag }}"
99+
group: "{{ notification_tag }}"
100+
alert_once: true
101+
live_activity: true
102+
live_update: true
103+
notification_icon: "{{ live_icon }}"
104+
notification_icon_color: "{{ live_color }}"
105+
progress: "{{ live_progress }}"
106+
progress_max: "{{ live_progress_max }}"
107+
chronometer: "{{ live_chronometer }}"
108+
when: "{{ live_when }}"
109+
when_relative: "{{ live_when_relative }}"

0 commit comments

Comments
 (0)