How to troubleshoot automation top to bottom?

I have the following automations.yaml

- id: turn on light
  alias: turn on light by event
  initial_state: 'off'
    platform: event
    event_type: esphome.button_pressed
    - service: 'homeassistant.turn_on'
      entity_id: light.t2_l2
  1. I have checked that the automation config is correct and loading - it is
  2. last_triggered is null
  3. I have tested the action in the services tab - works just fine
  4. the event ‘esphome.button_pressed’ fires in my events tab

But the event does not appear to fire the trigger. Whether created by my device, or created on the events tab.

I have the log level set to info, but there is nothing there.

Does anyone have any suggestions for my next step?


You set initial_state to ‘off’ that means that the automation is disabled by default. Did you enable the automation after you created it? Also the homeassistant.turn_on doesn’t need to be in quotes, and because you only turn on a light you can just use light.turn_on instead.

1 Like

Thank you. For some reason (I don’t know why) I thought the initial state was that of the light, not the trigger.

Did it work? If so, please mark my pist as the solution, this way others will find the solution quickly and the topic will be marked as solved.

I am new to all of this.

Yes, thanks, it worked

No worries :slight_smile: have fun with Home Assistant :wink:

Further to what burning said (you have learnt that setting initial to false is bad)
But setting it to true is also bad as this initialises the automation on a core restart.
You may not fall foul of this for a while but eventually, when your automations get more complex, you will need to know when that automation was last triggered - and you won’t know if you set this to true as that gets reinitialised too.
Best just to remove that line completely

1 Like

Also, for the future this might help:

1 Like

Thanks Mutt.

1 Like