This thread seems very quiet but in case anyone reads itā¦
Is there a reason why this:
- type: custom:multiple-entity-row
entity: sensor.smartweather_average_rain_yesterday
name: Smartweather
state_header: Average
entities:
- entity: sensor.smartweather_1_rain_today
name: {{ states('sensor.smartweather_1_rain_today') }}
gives me an error?
This is the relevant line but see below for whole error listing:
jinja2.exceptions.UndefinedError: 'states' is undefined
I know my example is fairly meaningless but it is reduced to the simplest I could think of.
FULL ERROR FOLLOWS HERE
Logger: homeassistant.components.websocket_api.http.connection
Source: lovelace/view_almanac.yaml:77
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 12:40:26 (1 occurrences)
Last logged: 12:40:26
[139913098594000] Error handling message: Unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 25, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/lovelace/websocket.py", line 30, in send_with_error_handling
result = await func(hass, connection, msg, config)
File "/usr/src/homeassistant/homeassistant/components/lovelace/websocket.py", line 72, in websocket_lovelace_config
return await config.async_load(msg["force"])
File "/usr/src/homeassistant/homeassistant/components/lovelace/dashboard.py", line 188, in async_load
is_updated, config = await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/lovelace/dashboard.py", line 207, in _load_config
config = load_yaml(self.path, Secrets(Path(self.hass.config.config_dir)))
File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 113, in load_yaml
return parse_yaml(conf_file, secrets)
File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 125, in parse_yaml
yaml.load(content, Loader=lambda stream: SafeLineLoader(stream, secrets))
File "/usr/local/lib/python3.8/site-packages/yaml/__init__.py", line 114, in load
return loader.get_single_data()
File "/usr/local/lib/python3.8/site-packages/yaml/constructor.py", line 51, in get_single_data
return self.construct_document(node)
File "/usr/local/lib/python3.8/site-packages/yaml/constructor.py", line 55, in construct_document
data = self.construct_object(node)
File "/usr/local/lib/python3.8/site-packages/yaml/constructor.py", line 100, in construct_object
data = constructor(self, node)
File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 255, in _ordered_dict
nodes = loader.construct_pairs(node)
File "/usr/local/lib/python3.8/site-packages/yaml/constructor.py", line 155, in construct_pairs
value = self.construct_object(value_node, deep=deep)
File "/usr/local/lib/python3.8/site-packages/yaml/constructor.py", line 100, in construct_object
data = constructor(self, node)
File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 286, in _construct_seq
(obj,) = loader.construct_yaml_seq(node)
File "/usr/local/lib/python3.8/site-packages/yaml/constructor.py", line 408, in construct_yaml_seq
data.extend(self.construct_sequence(node))
File "/usr/local/lib/python3.8/site-packages/yaml/constructor.py", line 129, in construct_sequence
return [self.construct_object(child, deep=deep)
File "/usr/local/lib/python3.8/site-packages/yaml/constructor.py", line 129, in <listcomp>
return [self.construct_object(child, deep=deep)
File "/usr/local/lib/python3.8/site-packages/yaml/constructor.py", line 100, in construct_object
data = constructor(self, node)
File "/config/custom_components/lovelace_gen/__init__.py", line 54, in _include_yaml
return loader._add_reference(load_yaml(fname, ldr.secrets, args=args), ldr, node)
File "/config/custom_components/lovelace_gen/__init__.py", line 32, in load_yaml
stream = io.StringIO(jinja.get_template(fname).render({**args, "_global": llgen_config}))
File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1304, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 925, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/config/lovelace/view_almanac.yaml", line 77, in top-level template code
name: {{ states('sensor.smartweather_1_rain_today') }}
File "/usr/local/lib/python3.8/site-packages/jinja2/utils.py", line 84, in from_obj
if hasattr(obj, "jinja_pass_arg"):
jinja2.exceptions.UndefinedError: 'states' is undefined