Not sure why but it still tells me me that propane_used_percent sensor is unavailable?
Any help would be appreciated. Thanks.
sensors:
tank_gallons:
value_template: "{{(((states('sensor.tank_percentage')) | int)*4) }}"
unit_of_measurement: "gal"
todays_propane_percent:
value_template: "{{((states('sensor.tank_percentage')) | int) }} "
unit_of_measurement: "%"
######
temporary_propane_used_today:
value_template: >-
{% set y = states('sensor.yesterdays_propane_percent') | float %}
{% set t = states('sensor.todays_propane_percent') | float %}
{{ (y-t) }}
unit_of_measurement: "%"
# calculate propane BTUs - my tank each percentage change is 4 gals, thus 453577/% for 5 gallons = therefore 0.8 for 4 gal
# 1 BTU = 0.00029307107017 kWh = 106.344237436
todays_propane_kwh:
value_template: "{{ (((states('sensor.propane_used_percent') | int) * 106.344237436)) }}"
unit_of_measurement: kWh
# trigger template daily propane usage
# sensor.tank.percentage is the current tank percent full from website
template:
- trigger:
- platform: time
at: "23:59:50"
- platform: event
event_type: event_template_reloaded
- platform: homeassistant
event: start
sensor:
- name: "Propane Used"
unit_of_measurement: "%"
unique_id: "propane_used_percent"
state: >-
{% if (states('sensor.temporary_propane_used_today') | float) < 0 %}
{states('sensor.propane_used_percent') = 0 }
{% set propane_filled_percent = states('sensor.temporary_propane_used') | float %}
{% else %}
{{ states('sensor.temporary_propane_percent_used') | float }}
{% endif %}
# reset yesterdays propanne percent
- trigger:
- platform: time
at: "23:59:59"
- platform: event
event_type: event_template_reloaded
- platform: homeassistant
event: start
sensor:
- name: "Yesterdays Propane Percent"
unit_of_measurement: "%"
unique_id: "yesterdays_propane_percent"
state: >-
{{ (states('sensor.tank_percentage')) }}
Here is the log:
Logger: homeassistant.helpers.template
Source: helpers/template.py:1291
First occurred: 10:49:12 AM (17 occurrences)
Last logged: 10:51:52 AM
- Template warning: ‘int’ got invalid input ‘unknown’ when rendering template ‘{{ (((states(‘sensor.propane_used_percent’) | int) * 106.344237436)) }}’ but no default was specified. Currently ‘int’ will return ‘0’, however this template will fail to render in Home Assistant core 2022.1
- Template warning: ‘float’ got invalid input ‘unknown’ when rendering template ‘{% if (states(‘sensor.temporary_propane_used_today’) | float) < 0 %} {states(‘sensor.propane_used_percent’) = 0 } {% set propane_filled_percent = states(‘sensor.temporary_propane_used’) | float %} {% else %} {{ states(‘sensor.temporary_propane_percent_used’) | float }} {% endif %}’ but no default was specified. Currently ‘float’ will return ‘0’, however this template will fail to render in Home Assistant core 2022.1
- Template warning: ‘float’ got invalid input ‘unknown’ when rendering template ‘sensor: - name: “Propane Used” unit_of_measurement: “%” unique_id: “propane_used_percent” state: >- {% if (states(‘sensor.temporary_propane_used_today’) | float) < 0 %} {states(‘sensor.propane_used_percent’) = 0 } # {% set propane_filled_percent = states(‘sensor.temporary_propane_used’) | float %} {% else %} {{ states(‘sensor.temporary_propane_percent_used’) | float }} {% endif %}’ but no default was specified. Currently ‘float’ will return ‘0’, however this template will fail to render in Home Assistant core 2022.1
- Template warning: ‘float’ got invalid input ‘unknown’ when rendering template ‘state: >- {% if (states(‘sensor.temporary_propane_used_today’) | float) < 0 %} {states(‘sensor.propane_used_percent’) = 0 } {% set propane_filled_percent = states(‘sensor.temporary_propane_used’) | float %} {% else %} {{ states(‘sensor.temporary_propane_percent_used’) | float }} {% endif %}’ but no default was specified. Currently ‘float’ will return ‘0’, however this template will fail to render in Home Assistant core 2022.1
- Template warning: ‘float’ got invalid input ‘unknown’ when rendering template ‘template: - trigger: - platform: time at: “23:59:50” - platform: event event_type: event_template_reloaded - platform: homeassistant event: start sensor: - name: “Propane Used” unit_of_measurement: “%” unique_id: “propane_used_percent” state: >- {% if (states(‘sensor.temporary_propane_used_today’) | float) < 0 %} {states(‘sensor.propane_used_percent’) = 0 } {% set propane_filled_percent = states(‘sensor.temporary_propane_used’) | float %} {% else %} {{ states(‘sensor.temporary_propane_percent_used’) | float }} {% endif %}’ but no default was specified. Currently ‘float’ will return ‘0’, however this template will fail to render in Home Assistant core 2022.1