FYI: use homeassistant platform instead of homeassistant_start event

You may have seen this in the error logs when upgrading HA, but I’ll add a link here so that you can find the correct format for the condition. It can be kinda tough to find in the docs since the terms you’d search for are pretty common.

automation:
  trigger:
    platform: homeassistant
    # Event can also be 'shutdown'
    event: start
4 Likes

@ih8gates – Thanks, I’ve been seeing this deprecation warning in my logs regarding 0.45 release. However, when I changed the automation below Home Assistant doesn’t seem to like it. Here’s what I have right now:

- alias: Fluxer Switch On By Default
  trigger: 
    platform: event
    event_type: homeassistant_start
  action: 
    service: homeassistant.turn_on
    entity_id: switch.fluxer  

Based on my understanding this should change to the format below:

- alias: Fluxer Switch On By Default
  trigger: 
    platform: homeassistant
    event_type: start
  action: 
    service: homeassistant.turn_on
    entity_id: switch.fluxer  

Is this right? I have several automation using the deprecated homeassistant_start event_type, however, this is just one example.

Thanks!

1 Like

You want:

- alias: Fluxer Switch On By Default
  trigger: 
    platform: homeassistant
    event: start

platforms have event attributes, not event_startup.

1 Like

Thanks, I totally missed removing the _type piece. All working now. Cheers.

Sorry if I’m bumping an old post, but I’m trying to add a new automation trigger based on the new syntax, but the event is not being fired.
This is my configuration:

automation:
  alias: "Lights off on HA start"
  initial_state: 'on'
  trigger:
    platform: homeassistant
    event: start
  action:
    service: light.turn_off

I’m looking at the dev-state page and I see:
Entity: automation.lights_off_on_ha_start State: on Attributes: last_triggered: null, friendly_name: Lights off on HA start

What is the problem?

Did you get this fixed? I’m having the same issue with hiding groups on start. Code below does not work. Used to work before, with the homeassistant_start pre-0.45 change.

- alias: 'hide all default hidden (input and cast) when hass loaded'
  trigger:
    platform: homeassistant
    event: start
  action:
    service: group.set_visibility
    entity_id: group.input, group.cast_home_group, group.cast_kitchen, group.cast_kitchen_home, group.cast_master_bedroom_home, group.cast_living_room, group.cast_living_room_tv, group.cast_office, group.cast_office_tv
    data:
      visible: False

The homeassistant start event is working for me - I have a notification that triggers whenever HA boots up.

I’m wondering if you’ve got an issue here where you’re trying to manipulate groups before they’re created? If “start” fires off immediately, even before groups are parsed.

What if you put a delay of a few seconds at the start of that action?

There is known issue regarding this:
https://github.com/home-assistant/home-assistant/issues/7058
It’s still not solved in 0.45… So it seems a bit random/hard to track down.

Still not working for me, no.

@ih8gates I’ve tried using a delay, it still didn’t work as the event is not even being fired at all.

I am using automation for startup:

automation:
- alias: system_start
  trigger:
    platform: homeassistant
    event: start
  action:
    - service: shell_command.cmd1
    - delay: 00:00:03
    - service: shell_command.cmd2

I got the following error in the log:

ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: not a valid value for dictionary value @ data['trigger'][0]['event']. Got None. (See /home/mihai/.homeassistant/configuration.yaml, line 345). Please check the docs at https://home-assistant.io/components/automation/

However, the startup automation is working. What to do to remove the error?

I’d guess that you have a tab or non-space character in there somewhere.

I used the same configuration.yaml on three computers: one is working, two doesn’t.

Been using this awesome piece of software for a while but after my rebuild I am seeing an incomplete graph. The major difference is that most stuff is now in packages, could that be the cause?

What is this oO

~Cheers