is it possible to make functions, and call them from templates/automations? I need to do the same string manipulation in multiple places, and calling a function() would make things easier.
You can make jinja2 macros, this was introduced in this release:
1 Like
Thank you, I’ll look into that!
It took me a few attempts, but finally realized custom_templates/
folder is special. I didn’t have that folder on my system, and just created a generic macros/
folder. But that didn’t work (obvious now). And that those docs state config/custom_templates/
where as it’s actually homeassistant/custom_templates/
1 Like