Perhaps there is another way to do this, but I haven’t found it…
I would like to be able to write custom functions to transform one value to another.
For example, I’d like to change the color of an RGB lamp based on the temperature outside. So, I could write an automation that triggers on the temperature (from Weather Underground or one of the other weather sensor components) and use it to set the RGB color on a lamp by passing it through a custom function that mapped temperature to color.
Another example, you could set the color temperature of a lamp based on the time of day.
This seems to me like a natural extension of templates.