Here’s how I do it - I live in Florida and we need to run the pump longer during the hot summer and less during the cool(er) winter, so I tied it to the sunrise-sunset cycle and the duration adjusts itself with the season:
The device I am using is also able to measure power draw, if yours does not then you may need to modify this. I also empirically determined that power draw by the pump goes down with a dirtier filter, so if the average power draw goes below a certain threshold, I also send reminders for filter cleaning. Your pump may have different numbers, mine draws 1500W with a clean filter and 1200W with a horribly dirty one. So I flip at - not sure - 1400W?
I have a second piston to safeguard against the pool water level being too low - also empirically determined that in such a condition, the pool pump draws a lot less power, typically in the 400-500W. If that is the case, the pool pump is automatically turned off to prevent its destruction. Saved my pool pump once already
but again, it relies on your pool pump reporting power. I use a heavy duty smart switch by Aeotec - it’s a one phase, two line switch.