To maintain a long-term record of daily/weekly/monthly/yearly minimum and maximum values, I suggest using the Utility Meter integration. It’s how I keep a record of the number of hours my home’s furnace operates (daily, weekly, etc).
For example, if you want to record the maximum daily/weekly/monthly/yearly temperatures:
utility_meter:
max_temp_daily:
source: sensor.today_max_temp
name: Max Temp Daily
cycle: daily
max_temp_weekly:
source: sensor.today_max_temp
name: Max Temp Weekly
cycle: weekly
max_temp_monthly:
source: sensor.today_max_temp
name: Max Temp Monthly
cycle: monthly
max_temp_yearly:
source: sensor.today_max_temp
name: Max Temp Yearly
cycle: yearly
The data for Utility Meter sensors is stored in a table within Home Assistant’s database that is retained indefinitely and is not purged every 10 days (or whatever duration you may have set in the Recorder integration).