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.