Apologies . My original code it formatted correctly . The error / problem is the reference to the automation . Googling example ‘suggest’ it’s correct - but clearly not …
The error clearly states what’s wrong: you’re not using a dictionary for your service_data. That’s why I changed your code. Have you tried the code I provided?
Please post the code you’re actually using, properly formatted as per the link I provided. Because what you provided is wrong. Not only not-formatted for the forum to read, but as well in your code. That’s what’s the error is telling you.
Or try the code exactly as I provided it (meaning with correct indentations and new lines)!
I did originally enter the text as you described. Once saved and reloaded it would revert back to being formatted incorrectly!!!
Couldn’t see what the issue was. Rebooted HA and tried again. Now the correctly formatted code stays formatted and of course works. Thank you!.