Checking if the house is "shutdown"

Posted on
Fri Jan 13, 2017 12:00 am
dliccardo offline
Posts: 53
Joined: Jun 09, 2014

Checking if the house is "shutdown"

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

Posted on
Fri Jan 13, 2017 4:55 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Checking if the house is "shutdown"

Not that it's necessarily the best approach, but I use a hybrid of the two.

I generally use an event-based system with common events like:
Away
Holiday
Sunrise
Sunset
Bedtime
Midnight
Vacation

which run off timers or variables. The variables invoke triggers when I change them (switch Away to True) but I also have scripts whose functions depend on the variables' values as well. For example, I have a climate control script that double-checks setpoints depending on the state of the house.

Then I have preferred home states and check current conditions against those states periodically throughout the day and after key events. For example,
Code: Select all
{'living room light': 'off', 'front porch light': 'on'}

The one thing that I'd like to build is better 'control' over is the rare 'No Ack'. I'd like to alert myself: "I told the kitchen cabinet lights to turn off, but they didn't answer the call." Not terribly complicated, I just haven't gotten around to it.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Fri Jan 13, 2017 7:50 am
johnpolasek offline
Posts: 911
Joined: Aug 05, 2011
Location: Aggieland, Texas

Re: Checking if the house is "shutdown"

DaveL17 wrote:
The one thing that I'd like to build is better 'control' over is the rare 'No Ack'. I'd like to alert myself: "I told the kitchen cabinet lights to turn off, but they didn't answer the call." Not terribly complicated, I just haven't gotten around to it.


+1 on that. i still wonder why that's not a triggerable event... Most of the time it would be unused, but would be highly useful to get a warning if a specific action didn't happen in an auto script such as "turn on greenhouse heater in freezing weather" or "lock door on last beacon expired" failed to reply.

Posted on
Fri Jan 13, 2017 9:04 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Checking if the house is "shutdown"

My system is similar to Dave's, where I have a series of house states that dictate how other actions run. For instance if the house is in "awake" mode then motion sensors turn on lights or something similar, but if in "sleeping" mode they won't because I don't want the ambient light to wake the wife, things like that.

I actually have two scripts, "shutdown" and "wakeup" that set everything how I want them, they are part of my Siri "Good Night" and "Good Morning" scene's, although I detect how many times the bedroom motion sensor is activated after a certain time in the morning to automatically wake up the house each day.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Fri Jan 13, 2017 3:26 pm
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Checking if the house is "shutdown"

johnpolasek wrote:
+1 on that. i still wonder why that's not a triggerable event... Most of the time it would be unused, but would be highly useful to get a warning if a specific action didn't happen in an auto script such as "turn on greenhouse heater in freezing weather" or "lock door on last beacon expired" failed to reply.


It's on the request list. It brings along some other things however that I think we want to address at the same time (rather than creating a half-a$$ed solution) and collectively it's not a small task. We'll get to it for sure, just not sure when.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jan 13, 2017 3:30 pm
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Checking if the house is "shutdown"

I'd recommend looking at the various scene-type plugins (unfortunately they're currently lumped into the Miscellaneous plugin category so you'll have to filter yourself) and the Device Group virtual device and see how close those get you to the state you need. It might be that one of them will do everything, or maybe get you very close such that adding the rest of the solution is much smaller than building your own state machine.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Jan 15, 2017 6:05 pm
krissh offline
Posts: 105
Joined: Nov 18, 2012
Location: Norway

Re: Checking if the house is "shutdown"

DaveL17 wrote:
The one thing that I'd like to build is better 'control' over is the rare 'No Ack'. I'd like to alert myself: "I told the kitchen cabinet lights to turn off, but they didn't answer the call." Not terribly complicated, I just haven't gotten around to it.


Just released a new version of this plugin with basic support for this. I'm planning a method that can be used by scripts as well.

Posted on
Sun Jan 15, 2017 7:58 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Checking if the house is "shutdown"

krissh wrote:
Just released a new version of this plugin with basic support for this. I'm planning a method that can be used by scripts as well.

Thanks for the nice update!

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests

cron