I am going round in circles here. I’ve read the (sparse) documentation, and my googling is sending me around the same few results each time.
I am playing around with automations. I have an end goal in mind, but en-route, I’ve quickly discovered that the automations UI doesn’t support what I’d like to do. It appears I need to use templating (somehow)
Somebody will absolutely miss the point of the {{ 22 }}, so please read the next bit carefully.
The aim is not to get the value 22 into my input_number. The final logic isn’t written yet, but I think should be acheivable with a template. {{ 22 }} is just a test to prove/disprove that I can use a template.
I can’t find any documentation which clearly shows me what is possible in an action.
I can find references to the deprecated data_template, I’ve seen value_template seemingly used randomly. Without docs I have no idea how to add some form of templated logic to my action’s value.
If you put a template in a field then you have to either wrap it in quotes or use the multiline syntax. You can’t leave it open like that or it will get parsed incorrectly since brackets have other meaning in yaml.
Have you read this yet?
If not I suggest doing so. Lot of info on templating and examples.
Where you can/cannot use a template is often indicated in the documentation for the option you want to template, either explicitly (stated in its description) or implicitly (presence/absence of an example containing a template).
Here’s an example from the documentation for Input Number showing how to template the value option (note use of quotation marks, as mentioned by CentralCommand). The example serves to implicitly indicate the value option accepts a template.
In addition to the information provided by @CentralCommand and @123, make sure tocheck out the docs page specifically about Service Calls… there are multiple examples using templates.
Thank you all.
Whilst I had read all the pages mentioned, I hadn’t digested them. I should have kept revisiting them. The more you learn, the more nuggets of useful you get out of stuff you’ve already read, The templates page is well written as far as it goes, and gives great info on what templates can do, but I struggled with “where can I use them”. I surprised myself on getting so close. I was half expecting “oh no, you can’t do it that way”.
Once again, thank you.