zwave_failures:
value_template: >
{% macro is_failed() %}
{%- set value = true -%}
{%- set domains = ['zwave'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] if ((item.attributes.is_failed is defined and item.attributes['is_failed'] == value))-%}
{% if (item.attributes.is_failed is defined and item.attributes['is_failed'] == value) -%}
{{ item.name }}{% endif -%}
{%- endfor -%}
{%- endfor -%}
{% endmacro %}
{{ is_failed() |trim != "" }}
card:
It seems to work but I haven’t had one fail yet.
Feedback is welcome and thanks to everyone who contributed to the linked post!
do you also have a way to tell whether Zwave works at all?
I had the Zwave stick slip out of the usb port a little bit so it was not available anymore.
This was completely undetected by HASS so everything looked Ok… except that all values eventually became stale. The zwave status for all devices was reported to be OK (including the controller itself)…
Exactly what I’m looking for…I dropped your code into my config file under sensor block…the config checks out, but when I reload the output isn’t true or false, it’s the variable definition { is_failed() |trim != “” } …any thoughts?
- platform: template
sensors:
zwave_failures:
value_template: >
{% macro is_failed() %}
{%- set value = true -%}
{%- set domains = ['zwave'] -%}
{%- for domain in domains -%}
{%- for item in states[domain] if ((item.attributes.is_failed is defined and item.attributes['is_failed'] == value))-%}
{% if (item.attributes.is_failed is defined and item.attributes['is_failed'] == value) -%}
{{ item.name }}{% endif -%}
{%- endfor -%}
{%- endfor -%}
{% endmacro %}
{ is_failed() |trim != "" }}
The last line of the code I missed a curly bracket/brace.
It should be this…
{{ is_failed() |trim != "" }}
That should do it and I fixed it in my original post.
You can paste all the code into the Jinja template editor to confirm.
Side note: If that Hall Closet door sensor is a contact sensor then you can make another sensor that will have it show open or closed instead of on or off.
This seems to have stopped working for me in 82.1. I noticed this in the event log.
“Template sensor zwave_failures has no entity ids configured to track nor were we able to extract the entities to track from the value template(s). This entity will only be able to be updated manually.”
Does anybody know how I should update the dead node template to get it working again?
@jwelter - Can you include the entire code… The fact that zwave_health_check: is all the way at the left margin is kinda confusing me… and are you triggering it from another automation somewhere?