Here is the error:
Logger: homeassistant.components.template.template_entity
Source: components/template/template_entity.py:173
Integration: Template (documentation, issues)
First occurred: 8:00:24 PM (1 occurrences)
Last logged: 8:00:24 PM
TemplateError('ValueError: Template error: int got invalid input 'unavailable' when rendering template '{%- if states('sensor.lightning_near_home_lightning_counter') | int > 0 %} Unsafe {% else %} Safe {%- endif %}' but no default was specified') while processing template 'Template("{%- if states('sensor.lightning_near_home_lightning_counter') | int > 0 %} Unsafe {% else %} Safe {%- endif %}")' for attribute '_attr_native_value' in entity 'sensor.lightning_warning'
Here is the template sensor
lightning_warning:
friendly_name: "Lightning Warning"
value_template: >-
{%- if states('sensor.lightning_near_home_lightning_counter') | int > 0 %}
Unsafe
{% else %}
Safe
{%- endif %}
This is the only place “sensor.lightning_warning” shows up in my whole home assistant setup
- alias: Lightning Detected
trigger:
- platform: state
entity_id: sensor.lightning_warning
to: 'Unsafe'
condition:
- condition: state
entity_id: input_boolean.lightning_warning
state: 'off'
action:
- service: script.text_notify
data_template:
title: "Lightning Detected!"
message: "Lightning has been detected within 25 miles of Turner House. Nearest storm is {{ states('sensor.lightning_near_home_lightning_distance') }} miles away."
- service: input_boolean.turn_on
entity_id: input_boolean.lightning_warning
- service: script.lightning_warning_audible
and here:
- alias: Lightning Warning Off
trigger:
- platform: state
entity_id: sensor.lightning_warning
to: 'Safe'
for:
minutes: 20
condition:
- condition: state
entity_id: input_boolean.lightning_warning
state: 'on'
action:
- service: script.text_notify
data_template:
who: "weston"
title: "Lightning Threat Over."
message: "No more Lightning Strikes detected."
- service: input_boolean.turn_off
entity_id: input_boolean.lightning_warning
- service: script.lightning_clear_audible
Here are the results in developer tools:
What am I missing, I guess I just don’t understand what the error is trying to tell me because I don’t see anything wrong.