You’re VERY lucky I saw your post. You replied to yourself instead of replying to me, so I wasn’t notified.
Let’s start with the basics. Go to your Automation > Hit the 3 dots in the top right corner > Edit as Yaml > Copy everything, then paste your automation here, correctly formatted please.
I can already tell by your screenshot that you’re using device triggers instead of entity triggers, which isn’t ideal. So, send me also the name of the entity of the switch taken from the Developer tools.
For the second issue, we can tackle it later. We probably won’t have to if you post your automation, so we’ll cross that bridge when we get to it.