Set variable in automation to part of trigger.entity_id and then use variable throughout

Hello antlane,

You didn’t give me much YAML to work from, but I will guess this is your problem.

If you show more of this automation, I’ll be glad to help more.