I’m reading a lot about the changes in functions such as ‘float’ that now require a default be specified for returning when that function cannot convert a value.
In previous versions of Home Assistant, float (for example) would default to 0 (zero) if it could not convert an input to floating point. Now the default must be specified as a parameter of float:
float(0) # default to 0 if cannot convert
My question is: Where is this documented?
The pages I find within Home Assistant like this one (templating), refer to the JinJa2 templating engine:
Note the current version of JinJa is 3.0. The HomeAssistant page above mentions JenJa2 but points to ‘JinJa’ documentation (not JinJa2).
Is there a difference between JinJa and JinJa2? If so:
Where is JinJa2 documented?
Why does home assistant point to JinJa?
Why does the JinJa documentation contradict Home Assistant forum threads that state functions like float now required a specified default?
Where is the correct documentation for the version of JinJa/JinJa2 that Home Assistant is using which requires defaults for these functions?
Thank you.
P.S. The documentation that Home Asstant Templating web page points to is for a Development version of Jina (not the 3.0 stable version), yet it still states that functions like float will default to 0 and do not require a default be specified, if the value cannot be converted: https://jinja.palletsprojects.com/en/latest/templates/#jinja-filters.float
Home Assistant is a collaborative open-source project and its documentation is maintained by users. If you believe it needs correction, you are free to make them.
At the bottom of every page in the documentation is a Edit link. For more information, here’s a helpful guide:
Home assistant uses jinja for templating but has modified it to better suit our needs. This is one of those instances. There are others, like some filters and functions that differ. The Home Assistant documentation should be followed in these cases.