Hi All,
Looking for some advise on a script I'm thinking about. I'd like to create a variable or perhaps a virtual device that keeps track of if the house is "shutdown". Shutdown for me means that all the lights are off, the HVACs are off, the doors are locked, the curtains are down, the TV is off, the AV receiver is off, the garage door is closed, etc. I see a couple ways to approach this:
(1) Just write a script that iterates through all my devices and does all these checks. Then call it periodically or perhaps be a bit smarter and call it after certain events...like after my occupancy detection decides nobody is home, for example. This seems like the easy approach, but has the drawbacks of being non being event driven... not efficient and latent/out-of-sync until the next time it runs, etc.
(2) Build a proper event driven system. Programmatically create a trigger for state changes for every device and update the shutdown state after anything changes. Should be more efficient (unless creating all these triggers has a larger impact under the hood that I am estimating), and will always be up to date. The challenge here is managing the creation and destruction of all these trigger. Perhaps I would run a setup script when indigo launches to create all the triggers and maybe destroy old triggers I guess.
Thoughts of these options or some other approach?
Cheers,
Darren