I once made a little contraption to keep my own dogs off my lawn. Perhaps this would work for other people’s dogs.
I basically hooked up a normally-open motion detector to my irrigation system.
The challenge is getting the motion detector to trigger when the dogs are on the lawn and not trigger when they are not on the lawn. It’s an imperfect science.
But, if you can get it right, it is very effective. No dog is going to squat while getting sprayed.