Logger: homeassistant.helpers.template
Source: helpers/template.py:1850
First occurred: 2:37:10 PM (67 occurrences)
Last logged: 2:48:00 PM
Template variable warning: 'dict object' has no attribute 'Range' when rendering '{{value_json['ANALOG']['Range']}}'
Template variable warning: 'command' is undefined when rendering '{"command":"{{ command }}", "user":"homeassistant"}'
Any ideas of what is causing this and how I can stop this error? It happns thousands of times…
Search for this string value_json['ANALOG']['Range'] and see what file it is in. If it is a component or intergation, you can’t do a lot, but if it’s in one of your files, post the complete content of that file.
The JSON dictionary received by the following template sometimes doesn’t contain a Range key. Attempts to reference a non-existent key will produce an error message.
{{value_json['ANALOG']['Range']}}
If the template is part of a Template Sensor, you can use availability to confirm the presence of both the ANALOG and Range keys. If the received payload doesn’t contain both, the payload is simply ignored.
In the following template (which appears to be producing a JSON payload for some purpose), it references a variable you have created called command. I don’t know where you are using this or how you are configuring the variable but sometimes it’s undefined. Referencing an undefined variable in a template will produce an error message.
You can guard against having an undefined variable by using the default filter to provide a default value. For example, if command is undefined, this will supply a value of unknown (however you really should determine why the variable isn’t always defined).
The error message is complaining about a template you have defined somewhere in your configuration (not an integration).
If the templates shown in the error messages are completely unfamiliar to you then they may be part of a package you installed. If you didn’t install any packages then the templates may be part of something you created but forgot about.
I have never installed a package, but I used inumerous integrations, including the early versions of the unsupported tasmota / ewewlink integrations. My yaml files are a mess and I could not find the said string.
Can I leave it as it is? How bad is to have thousands of these errors on my logs?
That string is likely to be in that YAML mess, not in your integrations because they contain python code (not Jinja2 templates).
If you are absolutely certain you have searched every possible YAML file (using the correct search string) then it may be petro’s fourth suggestion: MQTT Discovery.
Can old / unused appdaemon files from HACS play a part in this error? Or they have nothing to do with the rendering of templates?
And again, should I be worried about my RPI4 be overwhelmed by these erros? I got around 200 errors per hour regarding this?
It’s been like this for more than 6 months…
As you said yourself, your files are a mess… Go, clean them up. It will get more and more complicated, to help you, if you can’t share your files, because “they’re a mess”.
I wouldn’t worry about the log entries, if you had it like that for six months, it should have done any harm it could do right now. The only thing is the life span of your SD-card (if you don’t use a SSD). That will get smaller with every entry, bt other than that, I see no harm in it. I have sometimes more than thousand entries for one error in minutes, and even these don’t bring down my HA (and yes, I’m working on it to delete these entries beforehand)
Just left it as it is… Tried uninstalling a bunch of stuff. Nothing worked. I’m planing to start an installation from start, so it’s go away eventually. BTW I just posted about this new server. You can have a look at the post here: