System: notifikation ved uren NAS-nedlukning (clean-shutdown flag)

This commit is contained in:
2026-06-28 17:38:08 +02:00
parent f6b77e0db1
commit 2922f81c58
2 changed files with 51 additions and 0 deletions
@@ -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
+3
View File
@@ -0,0 +1,3 @@
ha_clean_shutdown:
name: HA blev lukket pænt ned
icon: mdi:power-plug