Home Assistant STOP Automation not working

I have been using an automation to tell me when Home Assistant has started or stopped.
Last week the STOPPED automation would not work anymore. But the START still works fine.
Can someone see if something in the code has changed. BTW this was created in the automation editor.

- id: '1600955298691'
  alias: Home Assistant is Stopping
  description: Home Assistant is Stopping
  trigger:
  - platform: homeassistant
    event: shutdown
  condition: []
  action:
    data:
      data:
        photo:
          caption: Home Assistant Has Stopped as of {{ now().strftime('%A, %B %d,
            %Y %I:%M:%S %p') }}
          url: https://REDACTED/local/images/ha/red.png
      message: Home Assistant Has Stoppedas of {{ now().strftime('%A, %B %d, %Y %I:%M:%S
        %p') }}
      title: Home Assistant Stopped
    service: notify.telegram_carlton
  mode: single

I’ve never been able to get the homeassistant shutdown event to do anything. I’ve watched the logs and see that the event is fired, but it’s already shut down all of the other services so the automation fires but there is no notify service to call.

I know that doesn’t really help you, especially if it was working for you before, but I think there’s a race condition between things stopping and the event being fired that’s never been resolved.

Weird. It works for me:

Apologies for the screenshots (on mobile):

1 Like

That is what I am finding also. The action fires but it probably shuts down before the message is sent out.
I do not know why it changed in the last few weeks. But it had been working flawlessly for over a year.

1 Like

I tried your setup, both in the automation configurator and as a straight automation.
Neither worked.
I can see the event get fired but nothing is sent. When it boots back up I get my notice.
Will keep working on it.
Wish I could create a delay of 5 seconds once the restart command is fired.
Thank you for the help.

How are you restarting home assistant?

What hardware?

What install method?

Using the following

arch x86_64
chassis desktop
dev false
docker true
docker_version 19.03.13
hassio true
host_os Ubuntu 20.04.1 LTS
installation_type Home Assistant Supervised
os_name Linux
os_version 5.4.0-48-generic
python_version 3.8.5
supervisor 245

When I go to restart I always do a check config and then hit the restart button.
Once a week I do an update of the NUC and then I do a full device reboot.

Maybe it’s a Home assistant supervised thing?

arch x86_64
chassis embedded
dev false
docker true
docker_version 19.03.11
hassio true
host_os HassOS 4.13
installation_type Home Assistant OS
os_name Linux
os_version 5.4.63
python_version 3.8.5
supervisor 245
timezone Australia/Hobart
version 0.115.6
virtualenv false

Could be my way of installing and such has changed that does not affect others.
It is not a big deal, I still get notified when it restarts which is good enough for now.
Thanks for the help.