Closed Wolk9 closed 2 years ago
jinja2.exceptions.UndefinedError: 'None' has no attribute 'notReady'
Do you have sensor.rest980 showing in the Developer Tools / States? Does this have a cleanMissionStatus section?
Yes, there is a showing a sensor.rest980 and it has the following state attributes:
batPct: 100
bin:
present: true
full: true
cleanMissionStatus:
cycle: none
phase: charge
expireM: 0
rechrgM: 0
error: 0
notReady: 0
mssnM: 0
expireTm: 0
rechrgTm: 0
mssnStrtTm: 1625140454
initiator: rmtApp
nMssn: 271
dock:
known: true
pn: null
state: null
id: null
fwVer: null
pose:
theta: 0
point:
x: 0
'y': 0
signal:
rssi: -55
snr: 29
noise: -84
bbmssn:
aCycleM: 56
nMssnF: 22
nMssnC: 85
nMssnOk: 164
aMssnM: 59
nMssn: 271
bbrun:
nOvertemps: 0
nEvacs: 0
nCBump: 0
nWStll: 2
nMBStll: 141
nPanics: 264
nPicks: 259
nOpticalDD: 82
nPiezoDD: 81
nScrubs: 175
nStuck: 23
sqft: 265
min: 10
hr: 87
nCliffsF: 8679
nCliffsR: 0
name: Roomba
pmaps:
- QufJjQ3JS0O8iEkr0Mw0cA: 210701T122502
- 3GzOUb6kRdWWaVH_nUm1XA: 210127T154034
- NQAhRS4LTyCaDwKzO0yj3Q: 210619T153126
- 8fkS_BkyQoaygPZeOWJYbQ: 210127T165007
- JWY4wIN9RTu2rJV_U40N4w: 210507T095652
- 4UVhEzgZQS6uDMMriootGg: 210223T132437
friendly_name: rest980
so yes, there is a cleanMissionStatus.
Well, thats unusual, as you do indeed have the correct attributes that the template is looking for.
Can you try copying the text (might need formatting) and test it in the dev/tools templates section and see what happens?
{% if state_attr('sensor.rest980', 'cleanMissionStatus')['cycle'] == 'none' and state_attr('sensor.rest980', 'cleanMissionStatus')['notReady'] == 39 %} Pending {% elif state_attr('sensor.rest980', 'cleanMissionStatus')['notReady'] > 0 %} Not Ready {% else %} {% set mapper = { 'clean' : 'Clean', 'quick' : 'Clean', 'spot' : 'Spot', 'evac' : 'Empty', 'dock' : 'Dock', 'train' : 'Train', 'none' : 'Ready' } %} {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['cycle'] %} {{ mapper[state] if state in mapper else state }} {% endif %}
Result type: String
Ready
This template listens for the following state changed events:
Entity: sensor.rest980
Ok so, do you see this during bootup only? I believe its just due to the rest980 data not being ready and it clears itself up after its loaded.
bump
Got the same error. Compared to your sample few messages earlier ☝ the vacuum.yaml got 2 extra spaces. Not sure if those made any difference. Didn't test. At least dev tools template renderer won't mind those.
I removed those and now it works for me. Could be also something else I simply missed...
Hi,
I'm experiencing problems with the add-on.
`Logger: homeassistant.helpers.event Source: helpers/template.py:391 First occurred: 20:25:32 (1 occurrences) Last logged: 20:25:32
Error while processing template: Template("{% if state_attr('sensor.rest980', 'cleanMissionStatus')['cycle'] == 'none' and state_attr('sensor.rest980', 'cleanMissionStatus')['notReady'] == 39 %} Pending {% elif state_attr('sensor.rest980', 'cleanMissionStatus')['notReady'] > 0 %} Not Ready {% else %} {% set mapper = { 'clean' : 'Clean', 'quick' : 'Clean', 'spot' : 'Spot', 'evac' : 'Empty', 'dock' : 'Dock', 'train' : 'Train', 'none' : 'Ready' } %} {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['cycle'] %} {{ mapper[state] if state in mapper else state }} {% endif %}") Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 389, in async_render render_result = _render_with_context(self.template, compiled, kwargs) File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1358, in _render_with_context return template.render(kwargs) 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 "", line 3, in top-level template code jinja2.exceptions.UndefinedError: 'None' has no attribute 'notReady'
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 505, in async_render_to_info render_info._result = self.async_render(variables, strict=strict, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 391, in async_render raise TemplateError(err) from err homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'notReady' `
and
`Logger: homeassistant.helpers.template Source: helpers/template.py:1366 First occurred: 20:25:32 (10 occurrences) Last logged: 20:25:32
Template variable warning: 'None' has no attribute 'notReady' when rendering '{% set mapper = { 0 : 'n-a', 2 : 'Uneven Ground', 15 : 'Low Battery', 39 : 'Pending', 48 : 'Path Blocked' } %} {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['notReady'] %} {{ mapper[state] if state in mapper else state }}' Template variable warning: 'None' has no attribute 'phase' when rendering '{% if state_attr('sensor.rest980', 'cleanMissionStatus')['phase'] == 'charge' and state_attr('sensor.rest980', 'batPct') == 100 %} Idle {% elif state_attr('sensor.rest980', 'cleanMissionStatus')['cycle'] == 'none' and state_attr('sensor.rest980', 'cleanMissionStatus')['phase'] == 'stop' %} Stopped {% else %} {% set mapper = { 'charge' : 'Charge', 'run' : 'Run', 'evac' : 'Empty', 'stop' : 'Paused', 'stuck' : 'Stuck', 'hmUsrDock' : 'Sent Home', 'hmMidMsn' : 'Mid Dock', 'hmPostMsn' : 'Final Dock' } %} {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['phase'] %} {{ mapper[state] if state in mapper else state }} {% endif %}' Template variable warning: 'None' has no attribute 'full' when rendering '{% set mapper = { true : 'Full', false : 'Not Full' } %} {% set state = state_attr('sensor.rest980', 'bin')['full'] %} {{ mapper[state] if state in mapper else state }}' Template variable warning: 'None' has no attribute 'present' when rendering '{% set mapper = { true : 'Yes', false : 'No' } %} {% set state = state_attr('sensor.rest980', 'bin')['present'] %} {{ mapper[state] if state in mapper else state }}' Template variable warning: 'None' has no attribute 'initiator' when rendering '{% set mapper = { 'schedule' : 'Scheduler', 'rmtApp' : 'App', 'manual' : 'Robot', 'localApp' : 'HA' } %} {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['initiator'] %} {{ mapper[state] if state in mapper else state }}'`
and
`Logger: homeassistant.components.template.template_entity Source: components/template/template_entity.py:72 Integration: Template (documentation, issues) First occurred: 20:25:32 (1 occurrences) Last logged: 20:25:32
TemplateError('UndefinedError: 'None' has no attribute 'notReady'') while processing template 'Template("{% if state_attr('sensor.rest980', 'cleanMissionStatus')['cycle'] == 'none' and state_attr('sensor.rest980', 'cleanMissionStatus')['notReady'] == 39 %} Pending {% elif state_attr('sensor.rest980', 'cleanMissionStatus')['notReady'] > 0 %} Not Ready {% else %} {% set mapper = { 'clean' : 'Clean', 'quick' : 'Clean', 'spot' : 'Spot', 'evac' : 'Empty', 'dock' : 'Dock', 'train' : 'Train', 'none' : 'Ready' } %} {% set state = state_attr('sensor.rest980', 'cleanMissionStatus')['cycle'] %} {{ mapper[state] if state in mapper else state }} {% endif %}")' for attribute '_state' in entity 'sensor.vacuum'`
is in my logs.
What can be wrong?