How to add Trigger Data to Automation triggered via Developer Tools > Services

Hi folks,

I’m following the Automation Troubleshooting docs to test an automation that’s triggered by a calendar event ending.

You can also trigger an automation manually. This can test the conditions as if the automation was triggered by an event. Navigate to Developer tools > Services. In the service selection drop-down, select Automation: Trigger , then Choose entity to select the automation you are testing. Toggle whether to skip the conditions, then Call service . If needed, additional trigger or other data can be added in the YAML view for testing.

Because of sync delays, instead of creating events over and over again and waiting for them to trigger, I’d prefer to pass in the trigger information using Developer Tools > Services and run the Automation.Trigger service, as documented. The doc says I can pass in trigger data here, but I’m running into syntax errors. The doc doesn’t explain the syntax for passing in trigger information, but does say it’s possible.

Here’s what I’ve tried:

The default config, no trigger data added:

service: automation.trigger
  skip_condition: false
  entity_id: automation.set_eve_climate_after_yoga

The default config with trigger data added from a past trace (Traces > First Step > Step Details > Changed Variables):

service: automation.trigger
  skip_condition: false
    id: CalendarEventStart
    idx: '0'
    alias: null
    platform: calendar
    event: end
      __type: <class 'datetime.timedelta'>
      total_seconds: -420
      start: '2024-07-08T16:15:00-07:00'
      end: '2024-07-08T17:00:00-07:00'
      summary: Redacted
      description: "Redacted"
      location: Redacted
      uid: 903A2BB8-416E-44C9-8A97-AC75E930AD87
      all_day: false
  entity_id: automation.set_eve_climate_after_yoga

Which returns “Failed to call service automation.trigger. extra keys not allowed @ data[‘trigger’]. Got None”

Any ideas? I’ve tried moving the trigger object around without any luck. I feel like this is a simple syntax issue, or I’m providing the data in the wrong format. Thanks in advance for any help!

At this point it appears that it is not possible to provide a value for trigger this way. An issue has been raised seeking clarification whether it is a bug or an error in the documentation.

1 Like

Thanks for your response! Based on the issue you raised, it looks like my formatting was off anyways. I think I can get by for now by using a user defined variable to test my automation instead of trigger. Hope this gets fixed, thanks again!

This issue was discussed in another topic. Based on the information I found, I’m led to believe it’s a documentation error.

It’s common practice that when a feature is added to Core, there’s a corresponding change to the documentation (i.e. two PRs, one in each of the two repositories, Core and docs).

In this case, the part about adding extra trigger data was added to the docs but I didn’t see a corresponding PR in Core that implements the feature. It’s not irrefutable proof that the documentation is in error but it does put it in doubt.

FWIW, if you use automation.trigger with extra trigger data, the resulting trace doesn’t contain the extra data. There’s no error or warning; the extra trigger data is simply ignored. It’s behaving like there’s no code for evaluating/processing the extra data.