Do those entities show up in Dev->States? You should use states('sensor.date_short') instead to better handle unavailable entities (see this), but it looks like you have specific problems with specific entities. Where are sensor.date_short, sensor.date_long, and sensor.temperature defined?
Maybe you lost this from your config at some point?
Somehow those entities don’t exist at the time when you’re referencing them. Can you share the script or automation where you’re using the templates in the first post? The sensor definitions work fine for me, but at least the date/time ones rely on now() with no other entities referenced, so they’ll only update every minute.
Please consider marking my post (above) with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. It will also place a check-mark below your first post that leads to the solution post. All of this helps users find answers to similar questions.
You’re right, I did misunderstand you. I thought “Thx, cleared it up” meant the problem had been “cleared up”.
It’s challenging to provide you with additional assistance because I cannot replicate the conditions that produce the warning messages you have.
Do you know where in your system you are using the following template? Is it in a Template Sensor?
{{ states.sensor.date_short.state }}
The warning message is:
'None' has no attribute 'state' when rendering '{{ states.sensor.date_short.state }}'
It means when it tried to get the state value of the Template Sensor entity sensor.date_short, that entity did not exist yet (‘None’) and so it has no state value.
If that template is used by a Template Sensor, do you know if it is defined (in the configuration) before or after sensor.date_short is defined?
My guess is your Template Sensors haven’t finished loading when the Lovelace UI is rendering cards. As a consequence, references to Template Sensors, at that point in time, cannot be resolved (because they don’t exist yet).
I haven’t experienced this problem on either of the two systems I have but then neither use the custom cards you are using (standard Lovelace cards don’t support Jinja2 templating).
I am also getting these errors which is flooding my error log file.
WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'None' has no attribute 'state' when rendering '{{states.sensor.avg_outside_temp.state}}°C'
The problem is that sensor.avg_outside_temp doesn’t actually exist in my environment. It is an old template sensor I had which I deleted some time ago. I cannot find any reference to it in developer tools nor in any of my yaml files.
Yes, I just ran into this problem as well (errors about no longer existing templating). I had error messages about a template that resulted in None and consequently taking an attribute failed. I changed the code (inside a lovelace card) to fix it. It seems to work correctly, also when tested in developer tools/templates.
Yet, when I restart the server these error messages, literally showing the “old” code keep appearing. Something must be cached somewhere, but I cannot find it.
Just discovered something interesting. I had a hunch, so I manually deleted the HomeAssistant log file and then restarted. This made the error referencing no longer existing template code go away.
The strange thing was that the error was always being reported with a time stamp for the latest restart. I suspect there is code to scan the logs for errors that has a bug and labels what it found with the wrong timestamp. After I removed the log, it could no longer find these messages and it went away.