Problem setting sensor value

I am trying to do simple calculation of propane used.

todays_propane_percentage is a multiscrape value that is confirmed is working

At 23:59:50, I set a trigger to calculate the difference between todays percent and yesterdays percent. If that number is a negative number then the tank was filled and I set percent used = 0. If not then I set the percent propane used

At 23:59:59, I then set yesterdays propane percent to use for the next day.

I always get yesterdays"propane_percent is unknown???

Appreciate the help…

# 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: >-
         {% set todays_propane_percent = (states('sensor.tank_percentage')) | float(0) %}
         {% if todays_propane_percent < 0 %} 
           {% set propane_used_percent = 0 %}
           {% set propane_filled_percent = (yesterdays_propane_percent - todays_propane_percent) %}
         {% else %} 
         {{ (yesterdays_propane_percent - todays_propane_percent) }}
         {% 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: >-
          {% set yesterdays_propane_percent = (states('sensor.tank_percentage')) | float(0) %}
      ```
state: >-
  {{  states('sensor.tank_percentage') | float(0) }}

Did this resolve your issue? Curious to know how you set this up.