Issue - creating statistic diagram cards

Hi there,

i’m trying to create a statistic diagram card, something like this:

For this i have the following statistic lines in configuration.yaml

  - platform: statistics
    entity_id: sensor.gaszaehler_status
    name: statistic_data_gaszaheler

I can see the sensor values, incl. attributes:

But if i try to create a “statistic diagram card” home assistant tell’s me, that there is no statistic data.

i have also tried with other sensors (temperature, etc.). Unfortunately without success (same error). Does anyone have a hint for me what I’m doing wrong?

Many thanks.

Update…

also no content is within database (table: statistics).

my yaml looks like:

....
recorder: 
 
sensor:
  - platform: template
    sensors:
      gaszaehler_status:
        value_template: "{{ states.homematic.ccu2.attributes.Gaszaehler }}"
        entity_id: homematic.ccu2
        friendly_name: 'Gaszaehler Status'


  - platform: statistics
    entity_id: sensor.gaszaehler_status
    name: statistic_data_gaszaheler
...

what i’m doing wrong?

Update:

i’ve added an other (synology) sensor to statistics and this one stores date in DB as expected.

recorder: 
 
sensor:
  - platform: template
    sensors:
      gaszaehler_status:
        value_template: "{{ states.homematic.ccu2.attributes.Gaszaehler }}"
        entity_id: homematic.ccu2
        friendly_name: 'Gaszaehler Status'


  - platform: statistics
    entity_id: sensor.gaszaehler_status
    name: statistic_data_gaszaheler

  - platform: statistics
    entity_id: sensor.infra_median_drive_1_temperature
    name: statistic_data_temperature_synology

i can’t figure out why the sensor “gaszaehler_status” does’t work.
(state_class: measurement)