Daily and monthly reset

Hello, i have configured a sensor to have all time max value of a sensor. But how can i display daily max or monthly max? Perfect will be also 24h max or yesterday max. This is all time max:

  • trigger:
    - platform: state
    entity_id: sensor.pv_total_output_power
    not_to:
    - unavailable
    - unknown
    sensor:
    - name: PV Eingangsleistung max ever
    unique_id: PV_eingangsleistung_max_ever
    state: >
    {{ max(trigger.to_state.state | float, this.state | float(-999)) }}
    icon: mdi:flash
    unit_of_measurement: Wh
    attributes:
    recorded: >
    {{ now().isoformat()
    if trigger.to_state.state | float > this.state | float(-999)
    else this.attributes.recorded | default(now().isoformat()) }}

And this is my try, but it doesnt work:

utility_meter:
inverter_eingangsleistung_max_daily:
source: sensor.PV_eingangsleistung_max_ever
cycle: daily
inverter_eingangsleistung_max_hourly:
source: sensor.PV_eingangsleistung_max_ever
cycle: hourly
inverter_eingangsleistung_max_weekly:
source: sensor.PV_eingangsleistung_max_ever
cycle: weekly
inverter_eingangsleistung_max_monthly:
source: sensor.PV_eingangsleistung_max_ever
cycle: monthly
inverter_eingangsleistung_max_quarterly:
source: sensor.PV_eingangsleistung_max_ever
cycle: quarterly
inverter_eingangsleistung_max_yearly:
source: sensor.PV_eingangsleistung_max_ever
cycle: yearly

Can anybody tell me how to do that? Thank you.

Plz format you code make easy for us to help you

press that 3 time

paste code

press 3 time again

utility_meter:
inverter_eingangsleistung_max_daily:
source: sensor.PV_eingangsleistung_max_ever
cycle: daily
inverter_eingangsleistung_max_hourly:
source: sensor.PV_eingangsleistung_max_ever
cycle: hourly
inverter_eingangsleistung_max_weekly:
source: sensor.PV_eingangsleistung_max_ever
cycle: weekly
inverter_eingangsleistung_max_monthly:
source: sensor.PV_eingangsleistung_max_ever
cycle: monthly
inverter_eingangsleistung_max_quarterly:
source: sensor.PV_eingangsleistung_max_ever
cycle: quarterly
inverter_eingangsleistung_max_yearly:
source: sensor.PV_eingangsleistung_max_ever
cycle: yearly

doing your code like this will make easyer for us to read.

It all depends on your use case.
If it’s just for displaying it, you might just use the statistics card. This can also be set to ‘Yesterday’.

type: statistic
entity: sensor.grid_power
period:
  calendar:
    period: day
stat_type: max
name: Slar peak today
grid_options:
  columns: 6
  rows: auto

If you want to store the value, you might want to look at a statistics helper. There you can set the max age, unfortunately not “Today” or “Yesterday”. But today is the yesterday of tomorrow, so you might just have the yesterday value set at the end of today.