Add Powerwall live outage activity support

feature/powerwall-live-activity-1598
Carlo Costanzo 3 days ago
parent 4457dc0bcd
commit adddef2a3d

@ -46,6 +46,7 @@ Live collection of plug-and-play Home Assistant packages. Each YAML file in this
| [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` |
| [mariadb_monitoring.yaml](mariadb_monitoring.yaml) | MariaDB health sensors and Lovelace dashboard snippet for recorder stats. | `sensor.mariadb_status`, `sensor.database_size` |
| [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` |
| [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` |
| [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` |
| [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_*` |
| [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
| [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` |
| [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` |
| [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` |
| [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` |
| [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` |
| [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` |
| [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` |
| [sleepiq.yaml](sleepiq.yaml) | Sleep Number presence/snore automations; Overview Health consumes direct SleepIQ integration entities for scores, vitals, pressure, and bed controls. | `sensor.sleepnumber_carlo_carlo_sleep_score`, `sensor.sleepnumber_carlo_stacey_sleep_score`, `number.sleepnumber_carlo_carlo_firmness`, `select.sleepnumber_carlo_foundation_preset_right` |

@ -6,10 +6,12 @@
# Tesla Powerwall - Monitoring and outage automations
# Related Issue: 1550
# Related Issue: 1571
# Related Issue: 1598
# Powerwall status sensors, outage alerting, and load-shedding helpers.
# -------------------------------------------------------------------
# Notes: Read more https://www.vcloudinfo.com/2018/01/going-green-to-save-some-green-in-2018.html | Existing Issue #272
# Tesla Powerwall added via UI Integration
# Notes: Live outage tracking derives its chronometer anchor from binary_sensor.powerwall_grid_status.last_changed.
######################################################################
# Binary Sensors:
# - binary_sensor.powerwall_charging ............. battery_charging (on=charging)
@ -53,7 +55,102 @@ script:
- switch.kitchen_accent_2
- switch.master_bathroom_accent_2
powerwall_outage_live_activity_update:
alias: "Powerwall - Outage Live Activity Update"
description: Refresh the tagged outage live activity using native grid-status state metadata.
mode: queued
sequence:
- variables:
grid_entity: "{{ states.binary_sensor.powerwall_grid_status if states.binary_sensor.powerwall_grid_status is defined else none }}"
outage_started_ts: >-
{% if grid_entity is not none and grid_entity.state == 'off' %}
{{ as_timestamp(grid_entity.last_changed, 0) | int(0) }}
{% else %}
0
{% endif %}
charge_pct: >-
{% set charge = states('sensor.powerwall_charge') %}
{% if charge not in ['unknown', 'unavailable', 'none', ''] %}
{{ charge | float(0) | round(0) | int(0) }}
{% else %}
0
{% endif %}
outage_started_label: >-
{% if outage_started_ts > 0 %}
{{ as_datetime(outage_started_ts) | as_local | strftime('%I:%M %p') }}
{% else %}
unknown
{% endif %}
- condition: template
value_template: "{{ outage_started_ts > 0 }}"
- service: script.notify_live_activity
data:
who: parents
tag: powerwall_grid_outage
title: "Power outage"
message: "Grid outage since {{ outage_started_label }}. Powerwall charge at {{ charge_pct }}%."
icon: mdi:transmission-tower-off
color: "#E65100"
progress: "{{ charge_pct }}"
progress_max: 100
chronometer: true
when: "{{ outage_started_ts }}"
when_relative: false
automation:
- alias: "Powerwall outage - Refresh live activity"
id: 5b5fb370-c6cb-4c74-95d4-264737e4456f
description: Start the tagged outage live activity when the grid drops and refresh it when charge changes.
mode: restart
trigger:
- id: grid_off
platform: state
entity_id: binary_sensor.powerwall_grid_status
to: 'off'
- id: charge_change
platform: state
entity_id: sensor.powerwall_charge
action:
- choose:
- conditions:
- condition: trigger
id: grid_off
- condition: template
value_template: >-
{{ trigger.to_state is not none and trigger.from_state is not none and
trigger.to_state.state not in ['unknown', 'unavailable', 'null'] and
trigger.from_state.state not in ['unknown', 'unavailable', 'null'] }}
sequence:
- service: script.powerwall_outage_live_activity_update
- conditions:
- condition: trigger
id: charge_change
- condition: state
entity_id: binary_sensor.powerwall_grid_status
state: 'off'
- condition: template
value_template: "{{ trigger.to_state is not none and trigger.to_state.state not in ['unknown', 'unavailable', 'none', ''] }}"
sequence:
- service: script.powerwall_outage_live_activity_update
- alias: "Powerwall outage - Clear live activity"
id: 1d998f72-50df-46eb-b335-7f0d9974f89a
description: Clear the tagged outage live activity after the grid is stable again.
mode: single
trigger:
- platform: state
entity_id: binary_sensor.powerwall_grid_status
from: 'off'
to: 'on'
for:
minutes: 2
action:
- service: script.notify_live_activity
data:
who: parents
tag: powerwall_grid_outage
clear: true
- alias: Notify if Grid is down
id: 56a32121-5725-4510-a1fa-10f69a5c82ef
trigger:

@ -28,6 +28,7 @@ Reusable scripts that other automations call for notifications, lighting, and sa
| File | Why it matters |
| --- | --- |
| [notify_engine.yaml](notify_engine.yaml) | Single entrypoint for rich push notifications. |
| [notify_live_activity.yaml](notify_live_activity.yaml) | Shared helper for tagged live activity/live update pushes and clear commands. |
| [send_to_logbook.yaml](send_to_logbook.yaml) | Generic `logbook.log` helper for Activity feed entries (Issue #1550). |
| [joanna_dispatch.yaml](joanna_dispatch.yaml) | Shared BearClaw/Joanna dispatch schema for automation remediation requests. |
| [speech_engine.yaml](speech_engine.yaml) | TTS/announcement orchestration with templated speech. |

@ -0,0 +1,109 @@
######################################################################
# @CCOSTAN - Follow Me on X
# For more info visit https://www.vcloudinfo.com/click-here
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# -------------------------------------------------------------------
# Notify Live Activity - Shared helper for tagged live mobile updates
# Related Issue: 1598
# Sends or clears tagged live activity/live update notifications.
# -------------------------------------------------------------------
# Notes: Resolves notify target from `who` similar to notify_engine.
# Notes: Uses `clear_notification` plus `tag` to end a live activity.
# Notes: Defaults are tuned for Powerwall outage tracking on iOS parents.
######################################################################
notify_live_activity:
alias: Notify Live Activity
description: Send or clear a tagged live-tracking notification for supported mobile targets.
mode: queued
fields:
who:
description: Notification audience key (carlo, stacey, family, parents).
example: parents
tag:
description: Stable notification tag used to replace or clear the live activity.
example: powerwall_grid_outage
title:
description: Notification title.
example: Power outage
message:
description: Notification message body.
example: Grid outage in progress. Powerwall charge at 82%.
icon:
description: Material Design icon for the live activity.
example: mdi:transmission-tower-off
color:
description: Hex color for the live activity icon.
example: "#E65100"
progress:
description: Progress value for the live activity.
example: 82
progress_max:
description: Maximum progress value.
example: 100
chronometer:
description: Enable the live chronometer.
example: true
when:
description: Unix timestamp in seconds for the chronometer anchor.
example: 1742846400
when_relative:
description: Treat the `when` value as relative seconds instead of an absolute timestamp.
example: false
clear:
description: Set true to clear the existing live activity for the tag.
example: false
sequence:
- variables:
normalized_who: "{{ who | default('parents', true) | string | lower | trim }}"
notify_service: >-
{% if normalized_who == 'stacey' %}
notify.mobile_app_stacey_iphone11
{% elif normalized_who == 'carlo' %}
notify.mobile_app_carlo_maxpro
{% elif normalized_who == 'family' %}
notify.ios_family
{% else %}
notify.ios_parents
{% endif %}
notification_tag: "{{ tag | default('live_activity', true) | string | trim }}"
clear_flag: "{{ clear | default(false, true) | bool }}"
live_title: "{{ title | default('Live update', true) | string | trim }}"
live_message: "{{ message | default('Live update in progress.', true) | string | trim }}"
live_icon: "{{ icon | default('mdi:progress-helper', true) | string | trim }}"
live_color: "{{ color | default('#2196F3', true) | string | trim }}"
live_progress: "{{ progress | default(-1, true) | int(-1) }}"
live_progress_max: "{{ progress_max | default(100, true) | int(100) }}"
live_chronometer: "{{ chronometer | default(false, true) | bool }}"
live_when: "{{ when | default(0, true) | int(0) }}"
live_when_relative: "{{ when_relative | default(false, true) | bool }}"
- condition: template
value_template: "{{ notification_tag != '' }}"
- choose:
- conditions:
- condition: template
value_template: "{{ clear_flag }}"
sequence:
- service: "{{ notify_service }}"
data:
message: clear_notification
data:
tag: "{{ notification_tag }}"
default:
- service: "{{ notify_service }}"
data:
title: "{{ live_title }}"
message: "{{ live_message }}"
data:
tag: "{{ notification_tag }}"
group: "{{ notification_tag }}"
alert_once: true
live_activity: true
live_update: true
notification_icon: "{{ live_icon }}"
notification_icon_color: "{{ live_color }}"
progress: "{{ live_progress }}"
progress_max: "{{ live_progress_max }}"
chronometer: "{{ live_chronometer }}"
when: "{{ live_when }}"
when_relative: "{{ live_when_relative }}"
Loading…
Cancel
Save

Powered by TurnKey Linux.