Hi, I’m trying to create an automation that runs when HA is shutting down. My automation is triggered by the “homeassistant” platform, see below. The trigger seems to work because the notification service runs, but the service to turn off an automation doesn’t.
I’ve confirmed the automation and script runs fine by manually executing the automation. I review the logbook and the execution time of the automation and notice that it’s not executed when I shutdown HA. However, the discord notification runs fine, which is odd. Is there a limitation on what service can run when HA is shutting down?
FWIW I’m running HA Core on Docker machine. And the reason I’m trying to turn off that one automation as part of the shutdown process is because for some reason HA turns my NVidia Shield Media Player state to “Idle” on every shutdown (I don’t know why), and so it essentially turns on my TV everytime I restart HA because I have an automation to turn on my Home Theatre when the Shield is On.
alias: Run on Home Assistant Shutdown description: Tasks to perform when Home Assistant shuts down initial_state: true trigger: - platform: homeassistant event: shutdown action: - service: script.home_assistant_shutdown
home_assistant_shutdown: alias: Home Assistant Shutdown description: Actions to take when Home Assistant shuts down sequence: - service: automation.turn_off entity_id: automation.shield_turn_on_shield_tv_harmony_activity_when_shield_apps_opened_directly - service: notify.discord data: message: Home Assistant has stopped target: !secret discord_channel_id_admin