From 7034889d5974210337dd8b825f8e9ef56b08c318 Mon Sep 17 00:00:00 2001 From: Joshua King Date: Tue, 14 Jul 2026 14:03:26 -0400 Subject: [PATCH] Implement notify_events_alerts script and update automation actions to utilize it for event notifications. This enhances consistency and maintainability in alert handling across the configuration files. --- automations/02_alerts_and_notifications.yaml | 3 +-- automations/07_climate_and_plugs.yaml | 3 +-- scripts.yaml | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/automations/02_alerts_and_notifications.yaml b/automations/02_alerts_and_notifications.yaml index 3206909..06e7cf3 100644 --- a/automations/02_alerts_and_notifications.yaml +++ b/automations/02_alerts_and_notifications.yaml @@ -8,12 +8,11 @@ to: 'on' conditions: [] actions: - - action: notify.notify_events_alerts + - action: script.notify_events_alerts metadata: {} data: message: Garage floodlight batteries low title: Garage floodlight batteries low - token: !secret notify_event_alerts_token mode: single - id: '1742841280696' diff --git a/automations/07_climate_and_plugs.yaml b/automations/07_climate_and_plugs.yaml index 72d72f3..e227ef3 100644 --- a/automations/07_climate_and_plugs.yaml +++ b/automations/07_climate_and_plugs.yaml @@ -56,8 +56,7 @@ - action: switch.turn_off target: entity_id: switch.parents_window_fan - - action: notify.notify_events_alerts + - action: script.notify_events_alerts data: title: Dehumidifier tank is full message: Dehumidifier tank is full — Parents Window Fan outlet has been turned off. - token: !secret notify_event_alerts_token diff --git a/scripts.yaml b/scripts.yaml index e0547d3..c226a92 100644 --- a/scripts.yaml +++ b/scripts.yaml @@ -24,3 +24,21 @@ check_day_camp: Message={{ state_attr('calendar.family_events', 'message') | default('') }} level: debug + +notify_events_alerts: + alias: Notify.Events Alerts + fields: + message: + required: true + selector: + text: + title: + selector: + text: + sequence: + - action: notify.notify_events_alerts + data: + message: "{{ message }}" + title: "{{ title | default('Home Assistant') }}" + data: + token: !secret notify_event_alerts_token