Forked from bfranke1973/device_connectivity_notification.yaml
Created
November 28, 2021 15:14
-
-
Save revin34/c3fd019afa1a965b04be474e53eca722 to your computer and use it in GitHub Desktop.
Send notification if and when a network device loses connectivity
This file contains 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: 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