Hello everyone,
I’m trying to set up an automation in Home Assistant that triggers a shutdown sequence for my devices when my UPS goes into battery mode (ONBATT). I want to ensure that the automation only executes if the power outage lasts for 10 seconds. I prefer to use the nut.ups_event
because it’s faster to update and provides real-time notifications about the UPS status.
However, it’s not working. Even if the UPS goes back ONLINE within 10 seconds, the automation continues to execute the rest of the actions after the 10-second wait is over. If I change continue_on_timeout
to false
, it will not continue even if the UPS is still on battery after 10 seconds.
What should I do?
Thank you!
Here’s the current configuration I have:
alias: UPS shutdown sequence
description: ""
trigger:
- platform: event
event_type: nut.ups_event
event_data:
notify_type: ONBATT
condition: []
action:
- wait_for_trigger:
- platform: event
event_type: nut.ups_event
event_data:
notify_type: ONLINE
timeout: "00:00:10"
continue_on_timeout: true
- action: automation.trigger
metadata: {}
data:
skip_condition: true
target:
entity_id:
- automation.switch_input_to_hdmi_1_if_different
- automation.change_sound_output_if_external_arc
- data:
message: >-
שים לב: בשל הפסקת חשמל, מקור הקלט הוחלף ל-HDMI 1 ומקור השמע הוחלף לרמקול
הטלוויזיה.
title: שינוי מקור ושמע לברירת מחדל
action: notify.lg_webos_smart_tv
- delay: "00:00:05"
- data:
message: "שים לב: בשל הפסקת חשמל, הטלוויזיה תכבה בעוד כ-5 שניות על מנת למנוע נזק."
title: כיבוי טלוויזיה בשל הפסקת חשמל
action: notify.lg_webos_smart_tv
- delay: "00:00:05"
- data:
entity_id: media_player.lg_webos_smart_tv
command: system/turnOff
action: webostv.command
- delay: "00:00:05"
- condition: and
conditions:
- condition: state
entity_id: media_player.lg_webos_smart_tv
state: "off"
- condition: state
entity_id: media_player.denon_avr_x2200w
state: "off"
- action: remote.turn_off
metadata: {}
data: {}
target:
entity_id: remote.shield
- type: shutdown_return
device_id: 570b9d86c07043bc4824381fc0d4f41d
domain: nut
enabled: false
- data:
message: הפסקת חשמל, הכל כובה
action: notify.mobile_app_sm_s918b
- action: hassio.host_shutdown
data: {}
enabled: false
mode: single