Simulated Automation Triggering

Often when creating an automation, I would like to be able to simulate different scenarios that the automation will need to deal with.

I can set the state of entities to simulate whether conditions will be met or not but…

I’d like an option in the overflow menu of each trigger called say: Simulate Trigger.

This would set as many trigger variables as possible so that actions in the action section can process the information available.

For example, I’ve just been tweaking my automation that notifies me of updates to the system, add-ons and HACS integrations. Each trigger passes information about the type of updated and version. I’d like to be able to simulate triggering this automation to check that the information will be displayed by the notify service action in the way I wish.

Although I can go so far with Developer tools, I’m really left waiting for an actual update in order to test my automation.

I would be interested in this too. For example, how to test an automation when it’s sunrise/sunset without waiting for that trigger to occur. :frowning:

After making my request, it did occur to me that it is possible to simulate triggers. You can use developer tools → states to change the state of an entity. However, it would be more convenient to do this within the automation editor.

See the second paragraph here:

1 Like

Thanks, @Troon

Every day’s a school day!

However, this doesn’t seem to enable me to specify which trigger I’m triggering - if the automation listens for multiple triggers. Am I missing something?

If I understand things correct, for testing an automation trigger through actions, you yourself need to supply the information in the trigger variable. So tat would include the trigger id, entity previous and current state for state conditions, or whatever else the trigger might do.

Which goes to show that the request, while it would be great, is is near possible to do right. How to fake a trigger if the conditions arent right for it to be true? What if it is a calendar trigger but there is no calendar event? What data does a device trigger set that would be needed in the condition or action part? I would seriously not know how any one could get that anywhere near acceptable for use.

Setting an entity state in developer tools and faking trigger variables by supplying them yourself is as good as it gets I’m afraid.

I’m busy automating car charge based on solar production prediction. Imagine testing that. There’s pretty much no other way than driving, waiting for sun, see what happens while the battery fills again. I’m busy for weeks now, we do not drive that much. How I’d love to fake the right circumstances for that…

Exactly that: it’s not easy, and would require knowledge of the trigger structure you’d see in a real event. The facility is there, though.

Unfortunately, that’s also the case for the feature request: to be able to provide a general purpose fake trigger, you’d need the UI to be able to try to get all sorts of data from you.

Hi @Edwin_D and @Troon

Thanks for making the issue clearer.

Hi @Troon and @Edwin_D Thanks for the additional context. I did not realize how complex it can get even for a “simple automation”.

@Troon I did try setting the state but that didn’t activate the automation. I also tried the second method of triggering the automation; that started the automation but it skipped all the steps. I think I’m doing something wrong.

In my automation, I want to turn the light on when it’s sunset and off when sunrise. I’m using triggerIDs that way I only have one automation.

This is what I tried:

Test 1: Set state

  1. Developer Tools > State > searched for “sun.sun” and I tried setting:
  2. “above_horizon” and “below_horizon” > pressed “Set State”
  3. Then I went to the Automation > looked at Traces > noticed it was not triggered.

Test 2: Set Action

  1. Developer Tools > Actions > selected “Automation: Trigger” > chose entity and searched for the name of my automation.
  2. Then I went to the Automation > looked at Traces > the automation was triggered but all steps were skipped. I tested this with “skip conditions” set to on and off.

In the traces it shows a “third” line (orange color); I’m not sure why it skipped all the other steps.

That line is there because none of the conditions were satisfied, so none of the cases were executed. Most likely because there was no trigger id.

1 Like

Thanks for clarifying, that makes sense.

  1. I wonder why the automation isn’t triggered if I set the sun.sun state to below/above horizon.
  2. In my automation the condition is to check for the triggerID that way it either chooses to turn the light on/off. Is there a way to input that triggerID or set it.