Sending notification on startup of HASS

One of the few things I don’t like about HASS is that is does not restore the states of ‘virtual devices’. For instance I have a house state of away or vacation. A restart (for instance caused by a power glitch) will reset them.This in turn will cause any automation based on these states go wrong.

Any ideas how I could send a notification only on startup? At least this gives me a notification that there was an event and I can change the state manually.

p.s. Andrew actually made an AppDeamon App (below) for this but I can’t get this to work correctly. For the ones that are interested: Announcement: AppDaemon 1.3.4

1 Like

You can do this with AppDaemon too - see the hardware check example.

Ok, did some scanning of some existing configuration files on GitHub and found the solution myself (at least for the notification on restart). Add below to your automations.yaml:

  - alias: "Startup Notification"
    trigger:
      platform: event
      event_type: homeassistant_start
    action:
      service: notify.mypushover
      data:
        title: "Warning"
        message: "Hass restarted"
        target: ""
1 Like

I have added the following to my automations.yaml

- id: "Startup Notification"
  alias: 'Startup Notification'
  trigger:
    - platform: event
      event_type: homeassistant_start
  action:
    service: notify.email
    data:
      title: "Warning"
      message: "Hass restarted"

I can reboot until the cows come home and never get notified. Email is working well and is use in other actions. No errors on boot, just does not work. Any ideas?

I see this listed in automations:
automation.startup_notification

But, it does not show up in my panel for all automations?

So… I got it working. The first method I tried was depreciated, or so it seems.

Working code:

- id: "Hass Startup Notification"
  alias: 'Hass Startup Notification'
  trigger:
    - platform: homeassistant
      event: start
  action:
    service: notify.email
    data:
      title: "Warning"
      message: "Hass restarted"

- id: "Hass Shutdown Notification"
  alias: 'Hass Shutdown Notification'
  trigger:
    - platform: homeassistant
      event: shutdown
  action:
    service: notify.email
    data:
      title: "Warning"
      message: "Hass shutdown"
1 Like

I Think the ID is reserved for Hass automation editor, try without the ID.

The above does work fine. I am running in Hassio. The ID does not seem to need to be there, but when I started I included them. Could and maybe should go back and remove them.

Thanks

This seems to come into play since I am using automations.yaml file.

https://home-assistant.io/docs/automation/editor/

correct. id: is only needed if you want them to appear in the frontend automation editor. I think it is also true for alias: which is only needed to give it a friendly name. Regardless of wether you use these fields or not, just make sure the first line of your automation starts with a - (hyphen followed by a space).

EDIT: and as you found, the homeassistant_start event under the event platform was deprecated in favor of the homeassistant platform with start event . When updating (or installing new) always make sure you check the breaking changes notes of the release.