This script I call with Run from the three dots script menu.
I also tried a simular script called from an automation. In the visual editor the field shows as a setting. I entered a value, but when the automtion triggers, that value is not in the script.
The code in this post is a result of narrowing to the field issue.
IMHO this is a bug in HA core.
If I might add, i have the same “bug” that I would call a UI bug.
When there is a field, the modal windows should always open when using the command run. And also, I’ve put a “default” value that does not seem to be read 50% of the time.