Sensor statistics change after HA restart

Hi everyone,
I have numerous sensor statistics configured to show change during last 24 h, or during last 30 days. Like this two :

  - platform: statistics
    name: "Consomation Quotidienne"
    entity_id: sensor.consomation_totale
    state_characteristic: change
    sampling_size: 3000
    max_age:
      days: 1
    precision: 3

  - platform: statistics
    name: "Consomation Mensuelle"
    entity_id: sensor.consomation_totale
    state_characteristic: change
    sampling_size: 90000
    max_age:
      days: 30
    precision: 3

Unfortunately after restarting HA core, stats are reset to 0 for no reason.

Theese stats are based on templates.

  - name: "Consomation totale"
    unit_of_measurement: "kWh"
    device_class: energy
    state_class: total_increasing
    state: >-
      {% set JB = states('sensor.consomation_totale_jours_bleus') %}
      {% set JW = states('sensor.consomation_totale_jours_blancs') %}
      {% set JR = states('sensor.consomation_totale_jours_rouges') %}
      {% set HC = states('sensor.consomation_totale_hchc') %}
      {% set HP = states('sensor.consomation_totale_hchp') %}
      {% if is_number(JB) and is_number(JW) and is_number(JR) and is_number(HP) and is_number(HC) %}
        {{ (JB | float) + (JW | float) + (JR | float) + (HC | float) + (HP | float) }}
      {% else %}
        unavailable
      {% endif %}

Some other stats directly based on measurements seems to get through HA restart without too much problem.

Is this a bug ? Is there any simple solution to avoid this reset ?

Thanks

I found some explanation here