RejectAttrib - based on date in Attribute

I have data using Solcast via HACS. It loads data for the rest of the day into the attributes of an entity:

Using this command:

value_template: {{((state_attr('sensor.forecast_today', 'detailedForecast') | map(attribute='pv_estimate')|list))}}

I can obtain the list of pv_estimate for the day, which is the end goal.

BUT

The integration only updates every 3 hours, and I need to filter out the data in the attributes that has passed. For Example, integration runs at 12pm, and 3pm. At 2pm, when I get the list, it still has 12, 12.30, 1, 1.30pm data.

So, if I remove the Map Attribute, I get the full data set.

I have tried experimenting with rejectattr but get errors as I am not understanding where to place it, or execute it at the right level.

Any guidance on how to filter on the period_start >= now() would be awesome and very helpful.

Sometimes thinking out loud fixes things:

Solution

{{(((state_attr('sensor.forecast_today', 'detailedForecast') +(state_attr('sensor.forecast_tomorrow', 'detailedForecast'))) |selectattr('period_start', 'ge', now() - timedelta(minutes=29.99)) | map(attribute='pv_estimate')|list)[:48])}}