Templating changes in 2021.10.0

I’m fine with the changes and it is right that there are to make home assistant progress, but I don’t understand why adequate documentation is not created to support the news

I like many others when we started using HA copied others templates and tweaked them to get them to work. At the time I didn’t know enough on doing it correctly but if it worked and gave me the desired results I was happy. I also don’t understand how adding a default setting on each templates that could have been done automatically is useful.

This change has forced me to learn more about templates which is a good thing. What I am not understanding is with the developers tools, templates. I get warning in HA logs but the same template pasted in the developer tools have none. Hard to learn when the tools included in HA do not catch the errors that HA does.

I do.

If I paste this into the Template Editor:

{{ 'foo' | float }}

I get this in Configuration > Logs

Logger: homeassistant.helpers.template
Source: helpers/template.py:1210
First occurred: 17:13:45 (1 occurrences)
Last logged: 17:13:45

Template warning: ‘float’ got invalid input ‘foo’ when compiling template ‘{{ ‘foo’ | float }}’ but no default was specified. Currently ‘float’ will return ‘0’, however this template will fail to render in Home Assistant core 2021.12

A suggestion would be to have errors generated in the template editor displayed there.

errors do, warnings don’t :wink:

It is very interesting if you use a sample template that should serve as a guide, then the errors in the protocol are the same as described above. It won’t help beginners much.

Hopefully this changes before the warnings change to errors.

What I was saying is the template editor does not see the warning.

Unlikely without a feature request. I believe this is the first mention I’ve ever seen of this.

This just happened on this release so I would not expect you to see this if it wasn’t a problem prior. The warnings will be errors in December but there is no way for inexperienced template users to be be able to troubleshoot their code prior to the change? This makes no sense.

you will, but the warnings will not appear on your screen, they will be in the logs.

because i did this 4 years ago :man_facepalming:

logger:
  default: error
2 Likes

I guess you don’t see the issue. I was on discord this morning and was told to paste the code in the template editor to troubleshoot my template warnings. I did this and of course I had none. I had no idea that template editor was not giving me all the information. Why would I or anyone else for that matter think you need to go somewhere else to see an issue?

Lol you would have noticed a few in December.

Because it’s a warning. Sorry you had a bad experience. Now you know how to see your warnings.

For sure, about to open the can of worms.

Will the template editor be updated in December to catch the code that is currently showing as warnings?

the warnings will turn into errors, so in december when that happens they will appear in the editor.

Only 18 so far

1 Like

I can’t wait to upgrade and see mine :scream: :upside_down_face:

A job for the weekend…