When building an automation with many triggers I would like to simulate / test how it runs on specific trigger to see how the automation will flow through multiple “choose”.
Now I have to go to Developer tools, find the entity and change it’s value so the trigger in automation is evaluated and starts the automation. But that can trigger also other automations which I don’t want and also it’s recorded to history. And it’s time consuming because on phone in the app (which is where I love to create automations) I can’t open a new tab, but I have to navigate there and back.
It would be nice to test the trigger of automation: the value for the test would be calculated so trigger is “true” but this value would not be recorded so it doesn’r trigger other automation but I would be able to see the trace of an automation.
An option to execute the trigger, as exists for full automation and for each action, I think would fit well and solve this (I also go through this and every time I think how can this not exist).
This may be slightly trickier than it sounds, because trigger types can introduce variables, and the trigger setup does not always fully constrain the values. For example a state trigger that fires when one of several entities change, requires you to specify which entity. Triggering from home assistant internal events may require specify the event body, etc.
That does not make this infeasible, but does make it more effort to implement.
And of course, it is entirely possible the body of the automation not not behave as expected if entities don’t have the expected states. I have some automations where faking triggers like that would not work as expected.
This is likely a lot harder than it sounds and quite possibly might not work at all from some trigger types. If the primary intent is just for testing automations I would suggest something I’ve found useful. Add testing helpers (I’ve used input_boolean, input_number, & counter for this) and then added an additional trigger that uses your test helper. Then set the helper to a state that will trigger. After testing I set that trigger to disabled, so it’s available for future testing, and then it’s helper can be reused for testing other automations without triggering all the automations where it may have been used.
Would be great if you could fire an automation trigger manually to test. Similar to how one can run actions, or test conditions. This would allow the testing of complete automations
This would test the automation body, but that very body might have branches that check which trigger was fired (trigger.id == "my_trigger_id") and do something different based on the specific trigger. This means that you would test just part of the body for that specific trigger and not other code paths.
You can. Go to Developer Tools → States. Click on the entity your trigger depends upon. You can then (non permanently) adjust the state of the entity (using the input fields at the top of the page) to trigger your automation.
Yes! Firing triggers directly from the automation editor would be a huge help. Especially when creating or just tweaking advanced automations on mobile.
Shouldn’t it then be quite easy to create a pop-up directly from the place where the trigger is defined using its entity and providing you the option to temporarily alter it right there? So instead of moving out to the States page, finding the entity and altering it etc.?