Help with this automation please

Sorry Danny Schroemges,

This is pretty much nonsense.
I can’t even figure out what you want to do.
Chat-bots reply in words / language and parrot what it finds.
It has no context to the actual computer language HA uses. It does what it does best (which it’s trained to do for writing text), and it makes shit up.

My suggestion would be to write down in words what you actually want to do, your goal for these actions. Then with that in hand, look at what other people trying to do a similar thing are doing using search.
Tips on Searching for Answers & Duplicate Topics in the Forum.
Take a shot at writing what you can.
Then come back here with your goal and what you have tried and someone will be able to help you.

More hints here:
https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question.