How to inject entity id into message?

I get a notification when someone opens a window, but I don’t know which sensor is triggered. Is there a way to insert entity id into notification? This is the flow I’m using:


I use this in my formula to achieve this:

newmsg = {}

newmsg.payload = { data: { "message":"Unregelmäßigkeit bei " + + " wurde erkannt"} }

return newmsg;
1 Like

I wrote this a long time ago, so I think they have standardized the message object, so there’s probably excess here, but this is what I use:

    msg.entity =;
} else if ( {
    msg.entity =;
return msg;

Then I have an object I can reference later in the flows (this one actually comes from a subflow) of msg.entity

1 Like

thank you both, will give it a try and see if I can make it work!

worked like a charm! Thanks