Both of the options mentioned should work, but if you're still looking for a specific application to do this let me know. I don't have it on github, but I wrote an application that limits the frequency that my sump pump runs. (I know it's a bad idea to use HA for a Sump Pump, but I have several other fail-safes in place)
The application allows you to specify how often it should run and how long it should run for, If the outlet has the Energy Meter capability it can also notify you if no energy has been used in a specified amount of time.
If you use Rule Machine or any other custom SmartApp, including mine, be aware that if you lose your internet, the switch will stop turning on. If this is something critical, I recommend using Smart Lighting because it runs locally. To do this in Smart Lighting, I think you're going to have to setup 24 Lighting Automations.