Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Send notification if and when a network device loses connectivity
blueprint:
name: Device Connectivity Notification
description: Send a notification if a networked device loses connectivity
domain: automation
input:
server_group:
name: Server Group
description: This group of servers will be monitored for potential loss of connectivity
selector:
entity:
domain: group
notify_device:
name: Device to notify
description: Device needs to run the official Home Assistant app to receive notifications
selector:
device:
integration: mobile_app
message:
name: Message
description: Notification message to send to Home Assistant app
default: " Network connection lost for devices: {{ disconnected_servers }} "
trigger:
- platform: state
entity_id: !input server_group
from: "on"
to: "off"
variables:
disconnected_servers: "{{ expand('group.servers')
| selectattr('attributes.device_class', 'eq', 'connectivity')
| selectattr('state', 'eq', 'off')
| map(attribute='name')
| list }}"
action:
domain: mobile_app
type: notify
device_id: !input "notify_device"
message: !input "message"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment