Turns out I’m not quite there, the list isn’t necessarily in order !!
{{ states.octopusagile.rates.attributes }}
gives:
OrderedDict([('2020-11-09T22:30:00Z', 8.337), ('2020-11-09T22:00:00Z', 10.6995), ('2020-11-09T21:30:00Z', 9.8805), ('2020-11-09T21:00:00Z', 11.445), ('2020-11-09T20:30:00Z', 9.2715), ('2020-11-09T20:00:00Z', 11.424), ('2020-11-09T19:30:00Z', 11.277), ('2020-11-09T19:00:00Z', 12.6525), ('2020-11-09T18:30:00Z', 25.5255), ('2020-11-09T18:00:00Z', 29.6835), ('2020-11-09T17:30:00Z', 32.991), ('2020-11-09T17:00:00Z', 32.0985), ('2020-11-09T16:30:00Z', 32.613), ('2020-11-09T16:00:00Z', 24.465), ('2020-11-09T15:30:00Z', 13.1355), ('2020-11-09T15:00:00Z', 12.075), ('2020-11-09T14:30:00Z', 11.424), ('2020-11-09T14:00:00Z', 11.424), ('2020-11-09T13:30:00Z', 11.592), ('2020-11-09T13:00:00Z', 12.9465), ('2020-11-09T12:30:00Z', 13.041), ('2020-11-09T12:00:00Z', 13.041), ('2020-11-09T11:30:00Z', 12.075), ('2020-11-09T11:00:00Z', 10.8675), ('2020-11-09T10:30:00Z', 10.5525), ('2020-11-09T10:00:00Z', 11.886), ('2020-11-09T09:30:00Z', 11.907), ('2020-11-09T09:00:00Z', 12.264), ('2020-11-09T08:30:00Z', 10.752), ('2020-11-09T08:00:00Z', 10.962), ('2020-11-09T07:30:00Z', 11.6655), ('2020-11-09T07:00:00Z', 9.2505), ('2020-11-09T06:30:00Z', 10.017), ('2020-11-09T06:00:00Z', 8.211), ('2020-11-09T05:30:00Z', 9.3975), ('2020-11-09T05:00:00Z', 7.854), ('2020-11-09T04:30:00Z', 6.762), ('2020-11-09T04:00:00Z', 6.762), ('2020-11-09T03:30:00Z', 7.917), ('2020-11-09T03:00:00Z', 8.694), ('2020-11-09T02:30:00Z', 9.66), ('2020-11-09T02:00:00Z', 10.017), ('2020-11-09T01:30:00Z', 11.109), ('2020-11-09T01:00:00Z', 12.096), ('2020-11-09T00:30:00Z', 11.13), ('2020-11-09T00:00:00Z', 10.626), ('2020-11-08T23:30:00Z', 12.075), ('2020-11-08T23:00:00Z', 12.558), ('2020-11-08T22:30:00Z', 8.4525)])
So I either need to sort it by key before I start, or I need to filter it to those that have timestamsp in the next 9 hours ?
Any thoughts?
Thanks,
Bruce.