Migrate to notifying all devices on active appliance
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
blueprint:
|
||||
name: Occupancy Socket Control with Power Alert (Multi-Device)
|
||||
description: Turns off sockets when everyone leaves home and turns them back on when someone returns. Sends an alert to multiple chosen mobile devices if an appliance was actively drawing power when the home became empty.
|
||||
name: Occupancy Socket Control with Global Power Alert
|
||||
description: Turns off sockets when everyone leaves home and turns them back on when someone returns. Automatically sends an alert to all mobile devices if an appliance was actively drawing power when the home became empty.
|
||||
domain: automation
|
||||
input:
|
||||
home_zone:
|
||||
@@ -34,13 +34,6 @@ blueprint:
|
||||
step: 0.1
|
||||
unit_of_measurement: W
|
||||
default: 1.0
|
||||
notify_devices:
|
||||
name: Notification Devices
|
||||
description: Select one or more mobile devices to receive the alert.
|
||||
selector:
|
||||
device:
|
||||
integration: mobile_app
|
||||
multiple: true
|
||||
|
||||
mode: restart
|
||||
|
||||
@@ -48,7 +41,6 @@ variables:
|
||||
switch_target: !input target_switches
|
||||
sensor_entity: !input power_sensor
|
||||
zone_entity: !input home_zone
|
||||
target_devices: !input notify_devices
|
||||
|
||||
trigger:
|
||||
- platform: zone
|
||||
@@ -74,27 +66,23 @@ action:
|
||||
entity_id: !input home_zone
|
||||
below: 1
|
||||
sequence:
|
||||
# Check power consumption before sending notifications
|
||||
- if:
|
||||
- condition: numeric_state
|
||||
entity_id: !input power_sensor
|
||||
above: !input power_threshold
|
||||
then:
|
||||
# Loop through each selected device and push the notification
|
||||
- repeat:
|
||||
for_each: "{{ target_devices }}"
|
||||
sequence:
|
||||
- domain: mobile_app
|
||||
type: notify
|
||||
device_id: "{{ repeat.item }}"
|
||||
title: "⚠️ Appliance Safely Turned Off"
|
||||
message: >-
|
||||
{% set switch_entity = switch_target.entity_id if switch_target.entity_id is string else (switch_target.entity_id | first | default('')) %}
|
||||
{% set name = state_attr(switch_entity, 'friendly_name') | default('An appliance') | lower %}
|
||||
{% set area = area_name(switch_entity) | default('') %}
|
||||
{% set zone_name = state_attr(zone_entity, 'friendly_name') | default('home') | lower %}
|
||||
|
||||
The {{ name }}{% if area %} in the {{ area | lower }}{% endif %} was actively drawing power when you left {{ zone_name }}. It has been shut down automatically. Please verify if this requires further attention.
|
||||
|
||||
- action: notify.notify
|
||||
data:
|
||||
title: "⚠️ Appliance Safely Turned Off"
|
||||
message: >-
|
||||
{% set switch_entity = switch_target.entity_id if switch_target.entity_id is string else (switch_target.entity_id | first | default('')) %}
|
||||
{% set name = state_attr(switch_entity, 'friendly_name') | default('An appliance') | lower %}
|
||||
{% set area = area_name(switch_entity) | default('') %}
|
||||
{% set zone_name = state_attr(zone_entity, 'friendly_name') | default('home') | lower %}
|
||||
|
||||
The {{ name }}{% if area %} in the {{ area | lower }}{% endif %} was actively drawing power when you left {{ zone_name }}. It has been shut down automatically. Please verify if this requires further attention.
|
||||
|
||||
# Turn off the target sockets
|
||||
- action: switch.turn_off
|
||||
target: !input target_switches
|
||||
|
||||
Reference in New Issue
Block a user