Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save bfranke1973/4a0835efffc81759d02f44842265ea96 to your computer and use it in GitHub Desktop.
Save bfranke1973/4a0835efffc81759d02f44842265ea96 to your computer and use it in GitHub Desktop.
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