Condition based on rolling total of sensor numeric state

condition: numeric_state
entity_id: sensor.home_precipitation
below: '0.2'

The accuweather integration reports precipitation in inches per hour, I would like my sprinker automation to only run if the total precip from the last X hours is less than some threshold. I’ve read the documentation on templates but I haven’t figured it out yet. help appreciated