In all versions of Home Assistant, including the current one (0.116.X), the output of a template is always a string.
That why the error message indicates you are supply ‘Invalid data’ for rgb_color. It is expecting to receive a list but the value produced by the template is a string (even though what you entered may look like a list).
This will change in 0.117 when templates can produce other types than only string (list, dict, float, integer, boolean).
Thank you, that might explain it! But I think when e.g. supplying a float instead of an int, it does say exactly that in the error message. With this error message, I thought “How can it be, that None is returned?” and would have never guessed, that a wrong data type might be the problem…
Ok, I tried converting it to a list now, but I still get the same error message. Output in Dev Tools really shows a list now. This is the script now (I know, there might be a shorter way, but I think it should still work):
It seems, as stated in the link i posted above, that as soon as I use > it is not taken as list anymore, no matter what I am doing… So I cannot use multi line code.
The reason why this works is because a template is not being used in an attempt to create a list. The list is defined in YAML format and then each item in the list is a separate template.
FWIW, it’s the most common way of templating for options that require a list containing a fixed number of items (like rgb_color which requires three items). Where this technique fails is if the list can contain a variable number of items.
In my original post, in addition to explaining why it doesn’t work, I probably should’ve directed you to this old post. It would’ve spared you the experimentation you went through trying to make a template produce a list.