Slave plug automatic power on only one timer per day

Hi,
I have two IKEA Tradfri zigbee Plugs and try to automate my pool pump and the Salt-chrine gernerator.

I have no Configured that the gernerator is powered on 1 Minute abfter the pump to bring some air out of the system.

But it want toch check:

  • was the generator powerd on on this day for atl least 3 hous → don’t power on th Generator
  • was the Generpowere on on this day for less than 3 hours → Power on the Generator on Minute after the Pump for 3 houres minus the previous runtime
  • wasn’t the gernerator powered on on this day ->Power on the Generator on Minute after the Pump for 3 Hours

how can i do this .
My Idea was so save the last poser on in a Var an if the runtime is over 3 Hourer on Bool Var “Runtime Complete”

has someone an idea?