[ANSWERED]Turn off a light only if it already was off

Posted on
Wed Jun 24, 2015 9:48 pm
spiv offline
Posts: 190
Joined: Jul 15, 2014

[ANSWERED]Turn off a light only if it already was off

Not sure how to do this - tinkering with virtual devices, variables, and realizing might be better just to ask!

I have an outdoor light that is scheduled to be off after 11pm

I want to add a door sensor such that when the door is opened, the outdoor light is turned on and then after 10 minutes it is turned off.

This works ok except I want to add the smarts so that when he door is opened, the outdoor light is always turned on, but it is only turned off if the light was already off before the door opened. In other words, if the door is opened after 11pm, it will turn the light on, wait 10 minutes, then turn the light off.

If the door is opened before 11pm, it will turn the light on (just to be sure) and then do nothing.

I don't want this to be driven by the clock time, I want it to be triggered by whether the outdoor light was already on or off. That way, if I change the schedule of when the outdoor light is automatically turned on or off, the door sensor action will not be affected.

I was trying to use a variable "WasLightAlreadyOn" to keep track of the light status and then using action groups for turning the light on and off that does two things - turns the light on or off and also sets the variable true or false so if the light is operated manually the status variable will still get updated.

I'm getting stuck on how to setup the door sensor to wait 10 minutes then check the status variable and turn off the light is the status variable is true.

Wondering if I am on the right track or over-complicating this and there is an easier way?

Posted on
Thu Jun 25, 2015 6:35 am
Richard offline
Posts: 68
Joined: Feb 05, 2015

Re: Turn off a light only if it already was off

Maybe I am over reading into your post to much.

I don't want this to be driven by the clock time


Don't you want an event to occur always at a certain time like 11:00pm from your door sensor?
Two triggers,
1) before 11:00 do this
2) after 11:00 do that

by add your certain conditions "and & or" like howartp has posted viewtopic.php?f=84&t=14165&p=97505&hilit=and+%26+or+in+triggers#p97486 with his link to the wiki file http://wiki.indigodomo.com/doku.php?id= ... conditions
, also having a remove delay action was helpful which is located in the server action group gave me alot of different options when I setup my door sensors with my lights.

Posted on
Thu Jun 25, 2015 9:15 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Turn off a light only if it already was off

You have two different, and somewhat competing, desires here: first, you want the light to auto off IF the light was off when the door opened, and second you only want that to happen after 11pm (you don't put an end-time on when the non-auto off behavior should resume).

I think I'd have two different triggers, each one fires on the door opening. The first trigger would have a condition of "If current time is less than 11:00:00 PM" AND "If device DEVICENAME On/Off State is off". The action would simply turn on the light. The second trigger would have a condition of "If current time is greater than 10:59:50 PM" AND "If device DEVICENAME On/Off State is off". The action would turn on the light with an auto-off of 10 minutes.

In either trigger case, you don't need to turn the light on if it's already on. This also presupposes that you want the auto off behavior to work from 11pm-midnight.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jun 26, 2015 5:34 pm
spiv offline
Posts: 190
Joined: Jul 15, 2014

Re: [ANSWERED]Turn off a light only if it already was off

Thanks everyone for the suggestions - I realized I could simplify everything with one trigger "if after 11pm, turn on the lights with a 10 minute auto-off" and that is really all I need. I don't need to over-engineer with "if lights already on, or if before 11pm".

Thanks!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests