Best PV Day ever

Hey Guys,

i want to create a sensor for the best PV Day in “kWh” ever
i tried this, but it doesnt work…the sensor write “0”

- platform: statistics
    entity_id: sensor.energie_tag
    name: PV Best live
- platform: template 
  sensors:

 pv_best_day:
        friendly_name: "PV best Day forever"
        value_template: "{{ state_attr('sensor.pv_best_live_mean', 'max_value')  | int }}"
        unit_of_measurement: 'kWh'


any ideas?

Could you check in the Developer tools whether this attribute is available?

First try adding max_value to the configuration of your statistics sensor:

  - platform: statistics
    entity_id: sensor.energie_tag
    name: PV Best live
    state_characteristic: value_max

Then adapt the other sensor. Note that it’s entity_id will likely change.