Amber Electric forecasts

Hi Everyone

I’m trying to create a sensor that uses forecast data from the Amber Electric integration. In a nutshell, I want to calculate the average forecasted grid import pricing between the hours of 1am and 5am for the following day (our off peak TOU tarrif). Ideally this would update automatically on a continual basis.
I’ve run this scenario through ChatGpt, but I’m not sure that it uses the attribute data correctly, and the code always results errors.
Im not a coding expert by any stretch. I’m sure there’s a solution, but I’ve got my training wheels on, so it’s a bit beyond me. Any pointers would be appreciated! Cheers