Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to improve template weather sensor logic #104

Open
thejeffreystone opened this issue Nov 17, 2020 · 0 comments
Open

Need to improve template weather sensor logic #104

thejeffreystone opened this issue Nov 17, 2020 · 0 comments

Comments

@thejeffreystone
Copy link
Owner

thejeffreystone commented Nov 17, 2020

Need logic to handle the event when weather sensors have not returned any data from weather API. Should just be able to wrap this logic to test if states.weather.klzu_daynight.state == 'unavailable' that way the error below doesn't fill my log file.

2020-11-17 15:42:53 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template("{%- if states.weather.klzu_daynight.attributes.forecast[1].daytime == True %} {{ states.weather.klzu_daynight.attributes.forecast[1].detailed_description | truncate(250, False) }} {% elif states.weather.klzu_daynight.attributes.forecast[2].daytime == True %} {{ states.weather.klzu_daynight.attributes.forecast[2].detailed_description | truncate(250, False) }} {%- endif %}") Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 421, in async_render render_result = compiled.render(kwargs) File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1090, in render self.environment.handle_exception() File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/usr/local/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "<template>", line 1, in top-level template code File "/usr/local/lib/python3.8/site-packages/jinja2/sandbox.py", line 384, in getitem return obj[argument] jinja2.exceptions.UndefinedError: 'mappingproxy object' has no attribute 'forecast'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant