I have a set of sensors set up to monitor user connection status, up/down. Since the mid 0.100’s, around 0.108 the stats becomes unavailable for a short amount of time. Connections are never affected, but it fills up my logs with error messages. I am sure something changed with templates that I missed, but I cannot find the issue.
Thanks Matt
Currently running 0.118.4.
Normal state:
Errored state:
Log messages
2020-11-30 17:39:03 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'None' has no attribute 'latest_handshake'') while processing template 'Template("{% if state_attr('sensor.wireguard', 'work').latest_handshake > ( as_timestamp(now()) ) -180 %}
Up
{% else %}
Down
{% endif %}")' for attribute '_state' in entity 'sensor.wireguard_work'
2020-11-30 17:39:03 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'None' has no attribute 'latest_handshake'') while processing template 'Template("{% if state_attr('sensor.wireguard', 'matt').latest_handshake > ( as_timestamp(now()) ) -180 %}
Up
{% else %}
Down
{% endif %}")' for attribute '_state' in entity 'sensor.wireguard_matt'
2020-11-30 17:39:03 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'None' has no attribute 'latest_handshake'') while processing template 'Template("{% if state_attr('sensor.wireguard', 'chris').latest_handshake > ( as_timestamp(now()) ) -180 %}
Up
{% else %}
Down
{% endif %}")' for attribute '_state' in entity 'sensor.wireguard_chris'
2020-11-30 17:39:03 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'None' has no attribute 'latest_handshake'') while processing template 'Template("{% if state_attr('sensor.wireguard', 'alex').latest_handshake > ( as_timestamp(now()) ) -180 %}
Up
{% else %}
Down
{% endif %}")' for attribute '_state' in entity 'sensor.wireguard_alex'
2020-11-30 17:39:03 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'None' has no attribute 'latest_handshake'') while processing template 'Template("{% if state_attr('sensor.wireguard', 'sam').latest_handshake > ( as_timestamp(now()) ) -180 %}
Up
{% else %}
Down
{% endif %}")' for attribute '_state' in entity 'sensor.wireguard_sam'
Up
{% else %}
Down
{% endif %}")' for attribute '_state' in entity 'sensor.wireguard_sam'
Up
{% else %}
Down
{% endif %}")' for attribute '_state' in entity 'sensor.wireguard_alex'
Up
{% else %}
Down
{% endif %}")' for attribute '_state' in entity 'sensor.wireguard_matt'
Up
{% else %}
Down
{% endif %}")' for attribute '_state' in entity 'sensor.wireguard_chris'
Up
{% else %}
Down
{% endif %}")' for attribute '_state' in entity 'sensor.wireguard_work'
Sensor configs:
- platform: template
sensors:
wireguard_work:
friendly_name: "Work"
value_template: >-
{% if state_attr('sensor.wireguard', 'work').latest_handshake > ( as_timestamp(now()) ) -180 %}
Up
{% else %}
Down
{% endif %}
wireguard_matt:
friendly_name: "Matt"
value_template: >-
{% if state_attr('sensor.wireguard', 'matt').latest_handshake > ( as_timestamp(now()) ) -180 %}
Up
{% else %}
Down
{% endif %}
wireguard_chris:
friendly_name: "Chris"
value_template: >-
{% if state_attr('sensor.wireguard', 'chris').latest_handshake > ( as_timestamp(now()) ) -180 %}
Up
{% else %}
Down
{% endif %}
wireguard_alex:
friendly_name: "Alex"
value_template: >-
{% if state_attr('sensor.wireguard', 'alex').latest_handshake > ( as_timestamp(now()) ) -180 %}
Up
{% else %}
Down
{% endif %}
wireguard_sam:
friendly_name: "Sam"
value_template: >-
{% if state_attr('sensor.wireguard', 'sam').latest_handshake > ( as_timestamp(now()) ) -180 %}
Up
{% else %}
Down
{% endif %}