Add notification on device going offline

This commit is contained in:
Burningstone91
2020-11-01 16:55:50 +01:00
parent e64adaee81
commit c56be7f273
3 changed files with 194 additions and 1 deletions

View File

@@ -2880,7 +2880,7 @@ I use a simple automation to notify me when the battery level for any of the Zig
I use an automation to notify me when there was a bad login attempt. I use the emergency channel (only works for Android phones) for this notification. I configured my phone to allow messages from the emergency channel when in Do not Disturb Mode.
```yaml
# Notify on Bad login attempt
automation:
- id: notify_on_bad_login_attempt
alias: "Benachrichtigung bei Falschem Loginversuch"
mode: parallel
@@ -2898,6 +2898,87 @@ I use an automation to notify me when there was a bad login attempt. I use the e
channel: Notfall
```
### Notification on Device Offline
I use an automation to notify me when a device went offline. For network clients I check the device tracker generated by the Unifi integration going to 'not_home' for 5 minutes and for the ZigBee/Z-Wave devices I check when the respective sensor goes 'unavailable' for 5 minutes.
```yaml
automation:
- id: notify_on_device_offline
alias: "Benachrichtigung bei Gerät offline"
mode: parallel
trigger:
- platform: state
entity_id:
- device_tracker.ap_livingroom
- device_tracker.bed_sensor_bedroom
- device_tracker.media_player_livingroom
- device_tracker.nas
- device_tracker.pi_bathroomsmall
- device_tracker.pi_dressroom
- device_tracker.pi_livingroom
- device_tracker.pi_office
- device_tracker.pi_zigbee_zwave
- device_tracker.pi_network
- device_tracker.plug_dishwasher
- device_tracker.receiver_bedroom
- device_tracker.receiver_livingroom
- device_tracker.receiver_office
- device_tracker.remote_livingroom
- device_tracker.server_nuc
- device_tracker.switch_livingroom
- device_tracker.switch_storageroom
- device_tracker.unifi_controller
- device_tracker.usg_router
- device_tracker.vacuum_livingroom
from: "home"
to: "not_home"
for:
minutes: 5
- platform: state
entity_id:
- sensor.battery_level_remote_light_livingroom
- sensor.battery_level_remote_light_dressroom
- sensor.battery_level_remote_light_bedroom
- sensor.battery_level_remote_light_office
- sensor.battery_level_remote_sabrina
- sensor.battery_level_remote_dimitri
- binary_sensor.motion_livingroom
- binary_sensor.motion_dressroom
- binary_sensor.motion_bedroom
- binary_sensor.motion_office
- sensor.temperature_bathroomsmall
- sensor.temperature_livingroom
- sensor.temperature_storageroom
- sensor.lux_outside
- sensor.lux_office
- binary_sensor.door_bathroomlarge
- binary_sensor.door_bathroomsmall
- binary_sensor.door_office
- binary_sensor.door_bedroom
- binary_sensor.door_dressroom
- binary_sensor.door_storageroom
- binary_sensor.door_kitchen
- binary_sensor.door_livingroom
- binary_sensor.door_main
- binary_sensor.window_bathroomlarge
- binary_sensor.window_office
- binary_sensor.window_dressroom
- binary_sensor.window_bedroom
- binary_sensor.window_kitchen
- binary_sensor.window_livingroom
to: "unavailable"
for:
minutes: 5
action:
- service: notify.mobile_app_phone_dimitri
data:
title: "Device offline!"
message: >
{{ state_attr(trigger.to_state.entity_id, 'friendly_name') }} is offline for 5 minutes!
data:
channel: emergency
```
</p>
</details>

View File

@@ -1,3 +1,22 @@
automation:
# Turn all lights and devices off when everyone left
- id: turn_everything_off_everyone_gone
alias: "Alles ausschalten wenn alle gegangen sind."
mode: single
trigger:
- platform: state
entity_id: input_select.presence_state_house
to: "Niemand zu Hause"
action:
- service: script.turn_all_off
script:
# Turn all lights and devices off
turn_all_off:
sequence:
- service: light.turn_off
entity_id: light.all_lights
# Entity Customization
homeassistant:
customize:

View File

@@ -796,6 +796,7 @@ automation:
data:
level: "{{ trigger.to_state.state }}"
mode: single
# Notify on update available
- id: notify_on_update_available
alias: "Benachrichtigung wenn ein Update verfügbar ist"
@@ -994,6 +995,98 @@ automation:
data:
channel: Notfall
# Notify on Bad login attempt
- id: notify_on_bad_login_attempt
alias: "Benachrichtigung bei Falschem Loginversuch"
mode: parallel
trigger:
- platform: state
entity_id: "persistent_notification.http_login"
to: "notifying"
action:
- service: notify.mobile_app_phone_dimitri
data:
title: "Falscher Loginversuch!"
message: >
{{ state_attr('persistent_notification.http_login', 'message') }}
data:
channel: Notfall
# Notify on Device Offline
- id: notify_on_device_offline
alias: "Benachrichtigung bei Gerät offline"
mode: parallel
trigger:
- platform: state
entity_id:
- device_tracker.ap_livingroom
- device_tracker.bed_sensor_bedroom
- device_tracker.media_player_livingroom
- device_tracker.nas
- device_tracker.pi_bathroomsmall
- device_tracker.pi_dressroom
- device_tracker.pi_livingroom
- device_tracker.pi_office
- device_tracker.pi_zigbee_zwave
- device_tracker.pi_network
- device_tracker.plug_dishwasher
#- device_tracker.receiver_bedroom
- device_tracker.receiver_livingroom
#- device_tracker.receiver_office
- device_tracker.remote_livingroom
- device_tracker.server_nuc
- device_tracker.switch_livingroom
- device_tracker.switch_storageroom
- device_tracker.unifi_controller
- device_tracker.usg_router
- device_tracker.vacuum_livingroom
from: "home"
to: "not_home"
for:
minutes: 5
- platform: state
entity_id:
- sensor.battery_level_remote_light_livingroom
- sensor.battery_level_remote_light_dressroom
- sensor.battery_level_remote_light_bedroom
- sensor.battery_level_remote_light_office
- sensor.battery_level_remote_sabrina
- sensor.battery_level_remote_dimitri
- binary_sensor.motion_livingroom
- binary_sensor.motion_dressroom
- binary_sensor.motion_bedroom
- binary_sensor.motion_office
- sensor.temperature_bathroomsmall
- sensor.temperature_livingroom
- sensor.temperature_storageroom
- sensor.lux_outside
- sensor.lux_office
- binary_sensor.door_bathroomlarge
- binary_sensor.door_bathroomsmall
- binary_sensor.door_office
- binary_sensor.door_bedroom
- binary_sensor.door_dressroom
- binary_sensor.door_storageroom
- binary_sensor.door_kitchen
- binary_sensor.door_livingroom
- binary_sensor.door_main
- binary_sensor.window_bathroomlarge
# - binary_sensor.window_office
- binary_sensor.window_dressroom
- binary_sensor.window_bedroom
- binary_sensor.window_kitchen
- binary_sensor.window_livingroom
to: "unavailable"
for:
minutes: 5
action:
- service: notify.mobile_app_phone_dimitri
data:
title: "Gerät offline!"
message: >
{{ state_attr(trigger.to_state.entity_id, 'friendly_name') }} ist seit 5 Minuten offline!
data:
channel: Notfall
# Entity Customization
homeassistant: