Watering automation with Popp Rain sensor - basing on historical data

Hi,

I have automation for watering garden

- id: '1612521111270'
  alias: Switch on watering
  description: Switch on at 1:00
  trigger:
  - platform: time
    at: '1:00'
  condition: []
  action:
  - type: turn_on
    device_id: a0c2dd4ae0aca93ea0c2dd4ae0aca93e
    entity_id: switch.ufairy_g_r_tech_gr105n_auto_valve_switch
    domain: switch
  - delay: 00:22:00
  - type: turn_off
    device_id: a0c2dd4ae0aca93ea0c2dd4ae0aca93e
    entity_id: switch.ufairy_g_r_tech_gr105n_auto_valve_switch
    domain: switch
  mode: single

I would like basing on last 24 hours data from popp rain sensor take decision to run garden watering or not. Perfect solution would be that in case of no rain in the last 24h start full watering, in case of rain on the level of Xmm start for the half time, in the case of the rain above Ymm level not start watering process.
I have following data from the rain sensor:
sensor.popp_co_popp_z_rain_rain_sensor_general - it is a total amount of the rain in mm. Value is growing rain by rain. Below logic how it should work.
(actual_value)-(value_before_24h) = X
If X=0 start watering
else if X<10 start watering for a half time
else if X>=10 cancel today watering
there is also actual rain rate in mm/h but I think above parameter can be more usefull
sensor.popp_co_popp_z_rain_rain_sensor_rain_rate

Could you help me with automation modification - I could not find automation to adapt.

Any suggestions?