I am writing a SmartApp to change modes under a very specific set of circumstances. I want for it to start monitoring specific combinations of presence sensor states during a certain window of time. Each instance of the SmartApp will have a single window of time, meaning only one start time, and only one stop time.
During each window of time is no problem, I can just subscribe to presence changes and check whether it’s within the window. But for the beginning/end of the window, I’m still a little unclear about limits on the schedule() method. I also have a question on how best to handle SmartApp updates.
I see from the documentation that I can call schedule(), which is where I’d check my presence sensors and see if a mode should change. However, I also see that there are limits to the number of schedules. Are these limits per hub, per smartapp, or per instance of the smartapp?
I also see there’s an unschedule() method, which is recommended in the updated() method. There’s also the warning about it being computationally expensive. Is the best way to simply call unschedule() first, and then the two schedule() methods to start and end the window?