Automation Causing an Error

I keep getting the below error when checking config for a new automation but can’t figure out why. If some is able to help out please?

Invalid config for [automation]: [action] is an invalid option for [automation]. Check: automation->condition->0->action. (See /config/configuration.yaml, line 11)


  id: bedtime
  mode: single
    platform: automation.trigger
    entity_id: automation.end_of_day
    condition: and
    - condition: time
      after: '23:00:00'
      before: '06:00:00'
    - condition: template
      value_template: '{{ (is_state(''sensor.m_iphone_battery_state'', ''Not
        Charging'') or is_state (''sensor.r_iphone_battery_state'', ''Not Charging''))
        and is_state (''media_player.sky_q'',''off'') }}'
  - service: script.sunset_master_bedroom```

What kind of trigger is this?

    platform: automation.trigger

I don’t see it described in the list of triggers.

Are the final three backquotes shown in your example simply a typo or are they actually part of the original automation?

BTW, it’s common for automations to have an alias but this one doesn’t. Is there any particular reason why you left it out?

This is the first time I’ve attempted creating an automation to trigger when another automation runs so I’ve probably gone drastically wrong and not sure what you mean by ‘what kind of trigger?’.

The three backquotes are a typo and there is an alias in my automation but it didn’t copy/paste for some reason.

Essentially what I’m trying to do is when automation A runs, if a set of conditions (in the automation above) are met, then run this automation.

What I mean is you defined a trigger that doesn’t exist in the documentation.

There’s no need for a second automation. Restructure your first automation to conditionally perform the desired action.

I found automation.trigger in Services drop down in the yaml file editor after seeing it referred to in a other posts on here.

I’ll see if I can build it into the original automation instead but I need to to have an alternative action if the conditions are not met and I’m not sure how that can be included. Similar to IF, THEN, ELSE commands. I’m guessing maybe 3 different automations with conditions, but I wanted to try and keep it tidy by keeping all in one.

right. it’s a “service” used in an action not a trigger.

I don’t believe there is an (easily) accessible indicator that an automation is running.

you could create a script that contains the actions for automation A and run that script with automation A then in automation B you can check to see if the script is running (state = on).

Undoubtedly used as a service, not as a trigger.

That’s all available in Home Assistant’s scripting language. I highly recommend you review the documentation: Script Syntax. You’ll be able to easily implement what I had suggested.

If you want additional help, I will need to see the other automation.