Last active
April 23, 2025 04:00
-
-
Save russdill/2081d1e16dcaa6c0738d37b97a3724cf to your computer and use it in GitHub Desktop.
Ping host down → persistent mobile notification (auto-clears)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Ping host down → persistent mobile notification (auto-clear) | |
description: | | |
Sends a sticky banner to the selected mobile-app device when any | |
Ping (ICMP) binary_sensor goes OFFLINE, and clears that banner when the | |
sensor comes back ONLINE. Optionally sends a “back online” push. | |
domain: automation | |
input: | |
ping_sensors: | |
name: Ping sensors to monitor | |
selector: | |
entity: | |
domain: binary_sensor | |
multiple: true | |
notify_device: | |
name: Mobile device | |
selector: | |
device: | |
integration: mobile_app | |
title: | |
name: Notification title | |
default: Host unreachable | |
msg_down: | |
name: Message when DOWN | |
default: Host {{ trigger.to_state.name }} is unreachable. | |
msg_up: | |
name: Message when UP (leave blank to suppress) | |
default: '' | |
mode: parallel | |
trigger: | |
- platform: state | |
entity_id: !input ping_sensors | |
to: ['off', 'on'] | |
action: | |
# Expose the "up" message so templates can read it | |
- variables: | |
up_msg: !input msg_up | |
- choose: | |
# ── HOST WENT DOWN ──────────────────────────────── | |
- conditions: | |
- condition: template | |
value_template: "{{ trigger.to_state.state == 'off' }}" | |
sequence: | |
- device_id: !input notify_device | |
domain: mobile_app | |
type: notify | |
title: !input title | |
message: !input msg_down | |
data: | |
tag: "{{ trigger.entity_id }}" | |
persistent: true | |
sticky: true | |
# ── HOST BACK UP ───────────────────────────────── | |
- conditions: | |
- condition: template | |
value_template: "{{ trigger.to_state.state == 'on' }}" | |
sequence: | |
# 1) Clear the sticky banner | |
- device_id: !input notify_device | |
domain: mobile_app | |
type: notify | |
message: clear_notification | |
data: | |
tag: "{{ trigger.entity_id }}" | |
# 2) Optional “back online” push | |
- choose: | |
- conditions: | |
- condition: template | |
value_template: "{{ up_msg | trim != '' }}" | |
sequence: | |
- device_id: !input notify_device | |
domain: mobile_app | |
type: notify | |
title: !input title | |
message: "{{ up_msg }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment