Turn off water pump once all zone sprinklers are turned off?

I have a sprinkler system that uses a pump from a lake. The sprinkler zones are controlled by a Rachio and the lake pump is controlled by a 240v ZWave switch. I’ve created virtual switches so I can control it easily via Alexa. For example, “Turn On Sprinkler Zone 1” opens the Rachio Zone 1 valve and turns on the lake pump. I also have the ability to turn off zones without turning off the lake pump so I can water multiple zones at a time.

What I want to do though is create some kind of safety automation that says:
If any zone is closed AND all of the other zones are closed, turn off the lake pump.

I’m not finding this to be easily accomplished though. Suggestions?

Look into webcore