Help with template sensors and statistics

I don’t know, where my mistake is, I’m getting an error:
Invalid config for 'statistics' from integration 'sensor' at packages/energiedashboard/energiedashboard_sensor.yaml, line 20: The configured characteristic 'max_value' is not supported for the configured source sensor '', got {'platform': 'statistics', 'name': 'max_total_pv_power_generated', 'entity_id': 'sensor.total_pv_power_generated', 'state_characteristic': 'max_value', 'max_age': {'hours': 24}
hier my yaml Code:

template:
  - sensor:
      - name: "total PV Power generated"
        unit_of_measurement: "kW"
        device_class: "power"
        state_class: measurement
      #### add power of all PV devices
      ### values must be in "W", or must be calculated to "w"
        state: >
          {% set sensor1 = 'sensor.deye_total_grid_power' %}
          {% set sensor2 = 'sensor.bkwshelly' %}
          {% set sensor3 = 'sensor._3' %}
          {{ (((states(sensor1) | float(0) *-1 )  + (states(sensor2) | float(0)) + (states(sensor3) | float(0))) /1000 )| round(1)}}
          


####   max_total_pv_power_generated
sensor:
  - platform: statistics
    name: "max_total_pv_power_generated"
    entity_id: sensor.total_pv_power_generated
    state_characteristic: max_value
    max_age:
      hours: 24

value_max not max_value

See: https://www.home-assistant.io/integrations/statistics/#characteristics (towards the bottom of the list).

Oh, embarrassing, thanks!