Jump to content

Do something if a trigger occurred within X time?


Recommended Posts

Posted

I want my garage lights to turn off when the garage doors close, but only if the alarm was set within 10 minutes. I have devices that change state on the garage closing and alarm arming.

 

So:

If Alarm armed within 10 minutes

AND

Garage door closed

 

Then 

Garage lights off.

 

All I can think of is a two programs:

 

Program 1:

If alarm armed

Then 

Variable = 1

wait 10 minutes

Variable = 0

 

Program 2:

If garage closed AND variable = 1

Then garage lights off

 

Any way to do this in one program?

 

Posted

Thanks guys. Particularly larryllx, I never considered using the first to enable/disable the second. Off I go!

One caveat. The technique is very obscure from the disabled program. Looking at the program itself, there is no clue what or how it could work.

 

Naming become important.

Posted

When I looked at the larryllix program, I was not confident that it would meet yor stated needs. What happens, for example, if the GDO is triggered, but the alarm is set after that? IOW, What triggers program2 if the alarm is set a few minutes after the garage door is closed?

 

Maybe I am missing something, but I preferred the concepts of your original proposal in post 1. I guess it depends on your needs.

Posted

When I looked at the larryllix program, I was not confident that it would meet yor stated needs. What happens, for example, if the GDO is triggered, but the alarm is set after that? IOW, What triggers program2 if the alarm is set a few minutes after the garage door is closed?

 

Maybe I am missing something, but I preferred the concepts of your original proposal in post 1. I guess it depends on your needs.

Good point but I think my concept fits the bill exactly to request (per my re-read) but I am not sure the OP request was worded exactly per wanted function. More detail and clarification of the wording and perhaps rethinking the exact algorithm function may be needed.

 

IOW: I may not  understand what the concept behind this is. 

Posted

Agreed that there is some uncertainty regarding need. I took it as: if garage door is closed and, within ten minutes, the alarm is subsequently set. Perhaps I had it backwards. Perhaps you are correct that it was: if garage door is closed withing ten minites of setting the alarm prior.

Posted

We will need the OP to chime in here.

 

First thoughts.

If I close the garage door and turn on the alarm system then I want the garage light to turn  off.

 

If I close the garage door and don't turn the alarm system on then I am working in the garage, so leave the lights on.

Posted

Thanks for the discussion.

 

I directly need this logic:

 

If the alarm is armed, and then, within 10 minutes. the garage door closes, turn off some lights

 

If the garage door closes and the the alarm is armed after that, I don't want any action.

 

So, as far as I can tell, the logic of having the alarm arming enabling the second program which checks for the garage door closing is exactly what I want. 

 

If you want to know deeper the use case here, my garage lights are on when I'm in the garage based on a bunch of sensors or just being turned on. I open and close the garage as I work on cars, etc, but I don't want the lights to cycle for this. I also don't want the lights to go off just because the alarm was armed, as I need the light in the garage to get to the car. So this logic is here to only turn the lights off when I've left the house and closed the garage door. Why for 10 minutes? Because when I come home and it's cold, I close the garage door before I'm in the house, and I don't want the lights going off because the garage door closed when I arrive home. There's probably some other logic that could work too, but this is what I used in Houselinc for 5 years and it worked great for me.

Posted

Looks like larryllix wins the prize.  Logic, in English:

 

If

alarm is armed

then

enable next program

wait ten minutes

disable next program

else

nothing

 

next program:

if

garage door is closed

then

turn off some lights

 

Alternative approach:

 

if

alarm is armed

then

wait ten minutes

run this program (else path)

else

nothing

 

next program

if

garage is closed

and

first program is true

then

turn off some lights

else

nothing

Posted

ISY always requres two programs when an event is conditional upon two triggers.  While an "if" cluase may contain multiple triggers, only one trigger can create an instance of the program with the other items being conditions, but not triggers of that particular instance.  In this example, we have two triggers, the alarm arming, and the door closing.  This is different than the door closing and the alarm being in a certain state or vice versa.  If a program is running an instance, and one of the other triggerable items triggers, the program aborts and starts over with no regard to the first trigger event.

 

Only exception to this rule is version 5 firmware where the second trigger  can be inside a "repeat while".  The caveat: repeat while only accepts variables as the object of the repeat while.

 

In other words, a variable change can be trigger number two within a single instance of a program.  Or, I suppose you could layer repeat while clauses and have cascading triggers.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...