As you can see, I do a log here as well. That one works and gives the correct output. But the log in the script where I need it remains empty. Am I doing something wrong? Or is it not possible to go this route?
Have you tracing it? I see that you are logging the one variable but you’d probably get a lot more insight into what is going wrong from the trace. Both scripts and automations are traceable and then let you see exactly what happened step by step including all the data that was set into variables along the way.
All scripts are traceable (defined in YAML or defined in the UI) so you should be able to see a traces for your scripts already. Automations are traceable as long as you provide a value for id. They don’t have to be defined in the UI, yaml ones are still traceable as long as you put a value in id like so:
- id: my_traceable_automation
alias: My traceable automation
...