Add custom caller id when calling a service and append it to event data

I want to add an id to my service calls displayed in the event data.

More context:
A Node-RED flow A calls the service light.turn_on. I want to add an id or something similar to this call.
Another flow B is listening to light state changes. I want to know if this event is caused by flow A so I can skip it by checking the appended id in the event data.

My first approach was to set a block var inside the flow but I ran into race condition issues, especially under heavy load.

Any thoughts on this?

Feature requests are for core Home Assistant features.

Node Red is a third party add-on. Open a feature request with the developer (Community Add-ons).

If you are looking for ideas about other ways to approach this problem post in the Node Red category: Node-RED - Home Assistant Community