Using Array Attributes with same name, differentiated by pervious array attribute of time (Forecast Observations)

I have a sensor that returns a forecast from “now” for 24 hours for electricity prices. *Amber Energy Integration"

I want to make a sensor that uses the per Kwh value for each entry in a time period each day and finds the mean. could be from current/now till 9pm - or maybe a snap shot at 8am-9pm

Basically want to find the average price of energy today and use that as an automation criteria to use the best priced electricity today to run pool and other items

not sure how to build a string that will filter out the values I want

example of output

state_class: measurement
forecasts: 
- duration: 30
  date: '2022-02-11'
  nem_date: '2022-02-11T11:00:00+10:00'
  per_kwh: -0.05
  spot_per_kwh: -0.05
  start_time: '2022-02-11T00:30:01+00:00'
  end_time: '2022-02-11T01:00:00+00:00'
  renewables: 102
  spike_status: none
- duration: 30
  date: '2022-02-11'
  nem_date: '2022-02-11T11:30:00+10:00'
  per_kwh: -0.06
  spot_per_kwh: -0.06
  start_time: '2022-02-11T01:00:01+00:00'
  end_time: '2022-02-11T01:30:00+00:00'
  renewables: 102
  spike_status: none
  range_min: -0.2
  range_max: -0.03
- duration: 30
  date: '2022-02-11'
  nem_date: '2022-02-11T12:00:00+10:00'
  per_kwh: -0.11
  spot_per_kwh: -0.11
  start_time: '2022-02-11T01:30:01+00:00'
  end_time: '2022-02-11T02:00:00+00:00'
  renewables: 104
  spike_status: none
  range_min: -0.46
  range_max: -0.02
- duration: 30
  date: '2022-02-11'
  nem_date: '2022-02-11T12:30:00+10:00'
  per_kwh: -0.11
  spot_per_kwh: -0.11
  start_time: '2022-02-11T02:00:01+00:00'
  end_time: '2022-02-11T02:30:00+00:00'
  renewables: 104
  spike_status: none
  range_min: -0.47
  range_max: 0.01
- duration: 30
  date: '2022-02-11'
  nem_date: '2022-02-11T13:00:00+10:00'
  per_kwh: -0.11
  spot_per_kwh: -0.11
  start_time: '2022-02-11T02:30:01+00:00'
  end_time: '2022-02-11T03:00:00+00:00'
  renewables: 106
  spike_status: none
  range_min: -0.28
  range_max: 0.01
- duration: 30
  date: '2022-02-11'
  nem_date: '2022-02-11T13:30:00+10:00'
  per_kwh: -0.18
  spot_per_kwh: -0.18
  start_time: '2022-02-11T03:00:01+00:00'
  end_time: '2022-02-11T03:30:00+00:00'
  renewables: 105
  spike_status: none
  range_min: -0.2
  range_max: 0