System: notifikation ved uren NAS-nedlukning (clean-shutdown flag)
This commit is contained in:
@@ -0,0 +1,48 @@
|
|||||||
|
- alias: "System - markér ren nedlukning"
|
||||||
|
id: system_mark_clean_shutdown
|
||||||
|
description: >-
|
||||||
|
Sætter flag når HA lukkes/genstartes pænt (SIGTERM). Bruges til at skelne
|
||||||
|
en ren genstart fra en uren nedlukning (hård strøm-cut / NAS-genstart).
|
||||||
|
trigger:
|
||||||
|
- platform: homeassistant
|
||||||
|
event: shutdown
|
||||||
|
action:
|
||||||
|
- service: input_boolean.turn_on
|
||||||
|
target:
|
||||||
|
entity_id: input_boolean.ha_clean_shutdown
|
||||||
|
|
||||||
|
- alias: "System - detektér uren nedlukning"
|
||||||
|
id: system_detect_improper_shutdown
|
||||||
|
description: >-
|
||||||
|
Ved opstart: hvis flaget IKKE blev sat ved sidste nedlukning, var det en
|
||||||
|
uren nedlukning (NAS hard-cut). Send notifikation. Nulstil derefter flaget.
|
||||||
|
mode: single
|
||||||
|
trigger:
|
||||||
|
- platform: homeassistant
|
||||||
|
event: start
|
||||||
|
action:
|
||||||
|
- choose:
|
||||||
|
- conditions:
|
||||||
|
- condition: state
|
||||||
|
entity_id: input_boolean.ha_clean_shutdown
|
||||||
|
state: "off"
|
||||||
|
sequence:
|
||||||
|
- service: notify.mobile_app_claus_iphone_15pro
|
||||||
|
data:
|
||||||
|
title: "⚠️ NAS: uren nedlukning"
|
||||||
|
message: >-
|
||||||
|
Home Assistant er netop startet efter en UREN nedlukning
|
||||||
|
(hård strøm-cut / NAS-genstart) kl.
|
||||||
|
{{ now().strftime('%d-%m %H:%M') }}. Tjek strømadapter og
|
||||||
|
kabler til NAS'en.
|
||||||
|
- service: persistent_notification.create
|
||||||
|
data:
|
||||||
|
notification_id: nas_improper_shutdown
|
||||||
|
title: "NAS: uren nedlukning"
|
||||||
|
message: >-
|
||||||
|
HA startede efter en uren nedlukning kl.
|
||||||
|
{{ now().strftime('%d-%m-%Y %H:%M') }}. Mistænkt årsag:
|
||||||
|
DS920+ strømadapter/kabel.
|
||||||
|
- service: input_boolean.turn_off
|
||||||
|
target:
|
||||||
|
entity_id: input_boolean.ha_clean_shutdown
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
ha_clean_shutdown:
|
||||||
|
name: HA blev lukket pænt ned
|
||||||
|
icon: mdi:power-plug
|
||||||
Reference in New Issue
Block a user