Wykres zmagazynowanej energii gotowej do odbioru

Wrócę do domu to wrzucę błędy jakie mam po skorzystaniu z kodu @kulczas
Ok tak to wyglada wciaz dostaje bład template:

ValueError: Template error: float got invalid input 'unavailable' when rendering template 'template:
    trigger:
      - platform: time_pattern
        minutes: 1
    sensor:
      - name: "Energy Storage"
        unit_of_measurement: 'kWh'
        icon: mdi:solar-power
        state: >-
          {% set storage = states('sensor.energy_storage') | float %}
          {% set ac = state_attr('sensor.energia_pobrana_przez_godzine', 'last_period') | float %}
          {% set ar = state_attr('sensor.energia_oddana_przez_godzine', 'last_period') | float %}
          {% set consumed = ac %}
          {% set returned = ar %}
          {% set delta = consumed - returned %}
          
          {% if delta  >= 0 %}
              {{ (storage - delta) | round(2) }}
          {% else %}
            {{ (storage - 0.8*delta) | round(2) }}
          {% endif %}        
      - name: "Energy Import from PGE hourly"
        unit_of_measurement: 'kWh'
        icon: mdi:solar-power
        state: >-
          {% set import = states('sensor.energy_import_from_pge_hourly') | float %}
          {% set ac = state_attr('sensor.energia_pobrana_przez_godzine', 'last_period') | float %}
          {% set ar = state_attr('sensor.energia_oddana_przez_godzine', 'last_period') | float %}
          {% set consumed = ac %}
          {% set returned = ar %}
          {% set delta = consumed - returned %}
          
          {% if delta  >= 0 %}
              {{ (import + delta) | round(2) }}
          {% else %}
            {{ (import + 0) | round(2) }}
          {% endif %}   
      - name: "Energy Export to PGE hourly"
        unit_of_measurement: 'kWh'
        icon: mdi:solar-power
        state: >-
          {% set export = states('sensor.energy_export_to_pge_hourly') | float %}
          {% set ac = state_attr('sensor.energia_pobrana_przez_godzine', 'last_period') | float %}
          {% set ar = state_attr('sensor.energia_oddana_przez_godzine', 'last_period') | float %}
          {% set consumed = ac %}
          {% set returned = ar %}
          {% set delta = consumed - returned %}
          
          {% if delta  <= 0 %}
              {{ (export - delta) | round(2) }}
          {% else %}
            {{ (export + 0) | round(2) }}
          {% endif %}' but no default was specified
utility meter:
 y_energia_oddana_godzinowa:
    source: sensor.0_electricity_meter_total_reverse_active_energy
    name: Energia oddana przez godzinę
    cycle: hourly
    
 x_energia_pobrana_godzinowa:
    source: sensor.0_electricity_meter_total_forward_active_energy
    name: Energia pobrana przez godzinę
    cycle: hourly

 miesieczna_energia_oddana_do_pge:
    source: sensor.energy_export_to_pge_hourly
    name: Miesieczna energia oddana do PGE
    cycle: monthly

 miesieczna_energia_pobrana_z_pge:
    source: sensor.energy_import_from_pge_hourly
    name: Miesieczna energia pobrana z PGE
    cycle: monthly
    
 dzienne_zuzycie_energii_przez_dom:
    source: sensor.zuzycie_energii_przez_dom
    name: Dzienne zużycie energii przez dom
    cycle: daily 

template:
    trigger:
      - platform: time_pattern
        minutes: 1
  -  sensor:
      - name: "Energy Storage"
        unit_of_measurement: 'kWh'
        icon: mdi:solar-power
        state: >-
          {% set storage = states('sensor.energy_storage') | float %}
          {% set ac = state_attr('sensor.energia_pobrana_przez_godzine', 'last_period') | float %}
          {% set ar = state_attr('sensor.energia_oddana_przez_godzine', 'last_period') | float %}
          {% set consumed = ac %}
          {% set returned = ar %}
          {% set delta = consumed - returned %}
          
          {% if delta  >= 0 %}
              {{ (storage - delta) | round(2) }}
          {% else %}
            {{ (storage - 0.8*delta) | round(2) }}
          {% endif %}        
      - name: "Energy Import from PGE hourly"
        unit_of_measurement: 'kWh'
        icon: mdi:solar-power
        state: >-
          {% set import = states('sensor.energy_import_from_pge_hourly') | float %}
          {% set ac = state_attr('sensor.energia_pobrana_przez_godzine', 'last_period') | float %}
          {% set ar = state_attr('sensor.energia_oddana_przez_godzine', 'last_period') | float %}
          {% set consumed = ac %}
          {% set returned = ar %}
          {% set delta = consumed - returned %}
          
          {% if delta  >= 0 %}
              {{ (import + delta) | round(2) }}
          {% else %}
            {{ (import + 0) | round(2) }}
          {% endif %}   
      - name: "Energy Export to PGE hourly"
        unit_of_measurement: 'kWh'
        icon: mdi:solar-power
        state: >-
          {% set export = states('sensor.energy_export_to_pge_hourly') | float %}
          {% set ac = state_attr('sensor.energia_pobrana_przez_godzine', 'last_period') | float %}
          {% set ar = state_attr('sensor.energia_oddana_przez_godzine', 'last_period') | float %}
          {% set consumed = ac %}
          {% set returned = ar %}
          {% set delta = consumed - returned %}
          
          {% if delta  <= 0 %}
              {{ (export - delta) | round(2) }}
          {% else %}
            {{ (export + 0) | round(2) }}
          {% endif %}         
          

Edit:

dobra jakos ogarniete, jak bardzo starych wersji HA uzywacie ze wam to działa :rofl: wystarczylo zmienic linijki w ten sposob:
tak było

          {% set storage = states('sensor.energy_storage') | float %}
          {% set ac = state_attr('sensor.energia_pobrana_przez_godzine', 'last_period') | float %}
          {% set ar = state_attr('sensor.energia_oddana_przez_godzine', 'last_period') | float %}

Od wersji HA 2021.12.0 trzeba określac wartość domyślną sensora bo jeżeli sensor jest unknown to filtr float nie może przekonwertować wartości „nieznany” na liczbę i ma być tak:

          {% set storage = states('sensor.energy_storage') | float(0) %}
          {% set ac = state_attr('sensor.energia_pobrana_przez_godzine', 'last_period') | float(0) %}
          {% set ar = state_attr('sensor.energia_oddana_przez_godzine', 'last_period') | float(0) %}

teraz ostania zagwozdka co oznaczają cyfry 587.8 w poniższym kodzie:

      - name: "Zużycie energii przez dom"
        state_class: total_increasing
        unit_of_measurement: 'kWh'
        state: > 
          {% if ((states('sensor.total_yield') | float(0)) -
               states('sensor.energia_czynna_oddana') | float(0) + 
               states('sensor.energia_czynna_pobrana') | float(0) 
               - 587.8 ) | round(2) < 300 %}
              {{ states('sensor.zuzycie_energii_przez_dom') }}       
          {% else %}
          {{ ((states('sensor.total_yield') | float(0)) -
               states('sensor.energia_czynna_oddana') | float(0) + 
               states('sensor.energia_czynna_pobrana') | float(0) 
               - 587.8 ) | round(2) }}
          {% endif %}