Is there a way to know when Home Assistant is about to restart ?
e.g. If someone goes to Development Tools/YAML/Restart, is there a way to know (programmatically) that this options was triggered?
What I tried:
Listening to “homeassistant_stop” in nodered does not work as nodered is stoped before the event is raised.
Adding an automation triggered by “homeassistant” (event shutdown) also does not work and this automation is never triggered.
I am using this trigger successfully in automations. In my case I am sending rest_commands to put my wall tablets into maintenance mode while Home Assistant is restarting.
I have just successfully reproduced this with a very simple automation that just logs a message:
alias: Test shutdown
trigger:
- platform: homeassistant
event: shutdown
action:
- service: system_log.write
data:
message: About to shut down
mode: single
Thank you for your feedback. That is super strange, I tried to write a value into an input_text just for testing purposes and it was never written. I will give another try.
Same to me…
I have an automation on shutdown where it should set a binary input and then send me a notification thru Signal. The notification works fine, but the input is never set.
It makes sense, however the notification service always works during the restart. I’he an automation to send me a notification (using Signal Messenger) during shutdown and during starting and it is rock solid on the notifications, but the service to set a helper, which I’d like to use to detect a start without a “controlled” restart, fails 100% of the time.