OK. That makes a lot more sense :-). I’m not familiar with the time math you are using so I can’t comment. I am familiar with using runIn() to schedule a handler some seconds in the future but I suspect what you are doing has the same end result.
I think you also need to handle the case where the fan in ON and heating or cooling starts. You unschedule() which means, I think that, once cooling or heating call is done (idle), the fan will stay on. I think you can resolve this by sending fanAuto() in your schedule_start_circulate() method.
I’m still curious about this code:
def eventHandler(evt){
DEBUG("eventHandler: ${evt.value}: ${evt}, ${settings}")
if(evt.value == "idle")
schedule_start_circulate()
if(evt.value == "heating"|| evt.value == "cooling")
unschedule()
I think you might need some closures, like this:
def eventHandler(evt){
DEBUG("eventHandler: ${evt.value}: ${evt}, ${settings}")
if(evt.value == "idle") {
schedule_start_circulate()
}
if(evt.value == "heating"|| evt.value == "cooling") {
unschedule()
}
. . . to make sure the compiler knows not to put the second IF nested under the first. I am learning that the groovy compiler just handles a lot of coding variations and figures things out. However, in this case, I don’t see how it would know. But, if it’s working, it must have been correctly sorted . . . .