feat(nut): report outage duration and battery % in ntfy

ONBATT records the epoch start time and appends current battery
charge; ONLINE appends battery charge and the total outage duration
(HH:mm:ss) computed from the recorded start, then clears the state.
State lives in /run so it self-clears on reboot.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Clément Désiles
2026-06-29 23:50:48 +02:00
parent 21f47196cf
commit 501f4e1f87
2 changed files with 35 additions and 0 deletions
+5
View File
@@ -61,3 +61,8 @@ nut_ntfy_server: https://ntfy.jokester.fr
# Path of the deployed NOTIFYCMD wrapper.
nut_notify_script_path: /usr/local/bin/ups-notify
# Where ups-notify records the epoch timestamp of the last ONBATT event, so the
# ONLINE notification can report total outage duration. Lives under /run so it
# is cleared on reboot (stale outage state is meaningless after a reboot).
nut_outage_state_file: /run/ups-notify-outage