I couldn’t find where this was documented or an example given, even if the template documentation put me on the track, so I thought I’d share my finding.
If you ever need to read (and store) a single attribute from an entity like a climate one, you can do as follows, here with the preset_mode:
The other useful thing that helped me and that beginners like me don’t know is the developer tools / template that you will find in your HA instance. Nifty!
If you wish to store a value, you can also use a Trigger-based Template Sensor. The main advantage over an Input Text is that the value displayed by the Template Sensor cannot be modified in the UI.
An entity’s state property is limited to storing a string not exceeding 255 characters. If there’s a need to store more information and not necessarily just a string, here’s a more sophisticated Trigger-based Template Sensor, able to store multiple values, exceeding 255 characters, whose type can be string, integer, float, list, dictionary, or boolean.
Thanks for the info, hard to find stuff about accessing attributes at times.
I used the create a Helper method with a template sensor and it worked too.