I have an oil diffuser plugged into a GE lamp module, and I want it to come on for 30 minutes when there is motion in my living room. However, I only want this piston to run once every so often. In other words, if it has already been on at any point in the last 90 minutes, I don’t want it to turn on again regardless of motion.
What I came up with is a virtual switch called withinHour. This boolean is defined as false, and as you can see, it changes to true after the lamp module is turned off. Then, the piston waits for 90 minutes and changes the variable back to false. Would the piston even run again if the first one is still running (i.e. during the “wait” periods)
This doesn’t sit well with me, though. I can’t help but think there’s a more efficient way of handling it. Suggestions?