What (actions) cannot run in parallel

I’m telling you what you’re comparing from a code perspective.

Events in ha (The event action) use hass.bus.fire which directly calls call_soon_threadsafe

where service call actions are called using asyncio.run_coroutine_threadsafe

here’s an explanation

If this is over your head, then all you need to know is:

Services will always behave like your test with system_log.write


Nothing in HA is parallel btw, it’s an event loop so something is always fired first from the main loop. Child threads are created & destroyed when the main loop needs (or doesn’t need) help.

What you’re seeing in your test is the functions getting added to the event loop in an order they will fire in.

EDIT: They both call from the event loop, sorry. I should be more explicit with my response.


The rule in HA is: First in first out of the event loop. It’s entirely based on how long it takes to get the coroutine or function into the event loop. It will likely be completely random and based on how fast your system is.

2 Likes