Jump to content
View in the app

A better way to browse. Learn more.

Universal Devices Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

My Logic Must Be Wrong - Help Needed

Featured Replies

Posted

Attached is a screenshot for what I would assume to be a very basic program that is not working for me.  Appreciate any help anyone can give on what I am doing wrong here.

If garage door sensor or motion sensor is activated, turn garage lights ON.  Wait X number of minutes, then turn garage lights OFF.

The door sensor and motion sensor are ELK, tied to the alarm, while the light switch is INSTEON.

The lights do turn on when triggered...but they do not turn off.

I must be missing something basic or not understanding how this work.  Appreciate any help!

Garage Lights Program.PNG

Edited by KHouse

Solved by apostolakisl

Go to solution
  • Solution

It is because the program is terminating when the motion sensor goes back to normal.  Those are status conditions, they trigger whenever the status changes regardless of what it changes to.  So when "violated" occurs, the program triggers, turns the lights on, and starts the timer.  But the sensor will return to "normal" prior to one minute, the program will then stop and start over.  But it will now be false, which runs the "else" clause, which is blank.  

To make this work, you either need to use "control" commands in the if clause since "control" commands only trigger on the precise action. 

Alternatively, you use two programs, the conditions are in the first program and the actions are in the second program. 

If
  elk thing 1 is violated
or elk thing 2 is violated
Then
 run then program 2

Pgm2
If 
 (blank)
Then
 turn light on
 wait 1 minute
 turn light off.

 

My preferred way of doing things like this, where the initial triggering condition will cease to be true, is to set a state variable, and then have a separate program look for the variable to become true, do the wait, turn off the light, and reset the variable.

 

- So your first program would be 

 

If garage door is violated

  Or other trigger...

Then Turn light on

   Then Variable garage_light = 1

 

- Second program

 

If Variable garage_light = 1

Then Wait 1 minute

Then Turn light off

Then Variable garage_light = 0 

 

 

  • Author

Thank you both so much.  I was racking my brain trying to think through the logic and figure out what I was missing.  Didn't realize it returns to "normal" before the time is up and that is the root cause of the problem.

Thank you again for the explanation and examples!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.