Add Backup Notifications

This commit is contained in:
Florian Brinker 2019-01-20 18:16:56 +01:00
parent e732c632cf
commit 55f36c8e57
2 changed files with 52 additions and 0 deletions

35
automations/backups.yaml Normal file
View File

@ -0,0 +1,35 @@
- alias: Backup Error
trigger:
- platform: state
entity_id: binary_sensor.backup_error_occured
to: 'on'
action:
- service: notify.telegram_group
data:
title: '*Backup-Problem:*'
message: 'Es gab Fehler beim *Erstellen* des Backups! Bitte prüfen!'
- service: notify.telegram_group
data:
message: 'Anbei die Log-Datei :)'
data:
document:
file: /backuplogs/run.err.log
caption: Backup Creation Log
- alias: Backup Sync Error
trigger:
- platform: state
entity_id: binary_sensor.backup_sync_error_occured
to: 'on'
action:
- service: notify.telegram_group
data:
title: '*Backup-Problem:*'
message: 'Es gab Fehler beim *Synchronisieren* des Backups! Bitte prüfen!'
- service: notify.telegram_group
data:
message: 'Anbei die Log-Datei :)'
data:
document:
file: /backuplogs/sync.err.log
caption: Backup Sync Log

View File

@ -6,6 +6,8 @@ homeassistant:
unit_system: metric
time_zone: Europe/Berlin
# customize: !include_dir_merge_named customizations/
whitelist_external_dirs:
- /backuplogs
http:
ip_ban_enabled: true
@ -93,6 +95,7 @@ mqtt:
telegram_bot:
- platform: broadcast
api_key: !secret telegram_bot
parse_mode: markdown
allowed_chat_ids:
- !secret telegram_chat_fb
- !secret telegram_chat_group
@ -140,6 +143,20 @@ binary_sensor:
name: YiHome1 Alarm
payload_on: 1
payload_off: 0
- platform: command_line
name: backup_error_occured
command: 'if [ `wc -l < /backuplogs/run.err.log` -eq 0 ]; then echo 0; else echo 1; fi'
payload_on: 1
payload_off: 0
scan_interval: 1800
device_class: 'problem'
- platform: command_line
name: backup_sync_error_occured
command: 'if [ `wc -l < /backuplogs/sync.err.log` -eq 0 ]; then echo 0; else echo 1; fi'
payload_on: 1
payload_off: 0
scan_interval: 1800
device_class: 'problem'
weather:
- platform: openweathermap