I would like the ability to create/use functions in the true sense of programming. It would be really nice to create something like a script where you could pass in values/parameters and have it return a result back to where it was called from.
This would help eliminate needing multiple exact copies of the same code to do the same thing in automations or scripts. My thought is that they could be used like a template to do the complicated logic and return the value.
{{ function('function.time_difference', input_datetime.time1, input_datetime.time2) }}
The example above would call the function “time_difference” that performs a calculation between the two passed input_datetime objects - and the result of that calculation function would be returned as the template value. Please note this is just a single example - this could be used for many other things.