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.

Adding If statement to Geofence

Featured Replies

Posted

I am trying to set up a Geofence that will turn the outdoor lights on, between sunset and sunrise, upon Geofence entry. I have created a program with that If statement and the lights on in Then. Geofence does not seem to like that. Adding all the lights individually to Geofence has no problem. How would I get the nighttime to work?

Geofence program that would not work:

>>>>>>>>>>>>>>>>>>>>>>>

Geofence Lights DO NOT DELETE - [ID 0022][Parent 0001][Enabled]

If
        From    Sunset  - 15 minutes
        To      Sunrise + 15 minutes (next day)
 
Then
        Set 'Sc Front Floods' On
        Set 'Sc Kitchen Sink Light' On
        Set 'Sc LR Floor Lamp' On
        Set 'Sc Rear Flood Lights' On
 
Else
   - No Actions - (To add one, press 'Action')

>>>>>>>>>>>>>>>>>>>>>>>>>

Thanks!

Al Zulich

Solved by Javi

Go to solution

Please show the UD Mobile setup.

 

The program should be disabled to prevent the program from running automatically. And UD Mobile should execute"Run If" on the program.

  • Author

Thanks for replying Javi.

I'm sorry to say that I'm new to UD Mobile, just coming from ISY. Therefore, I'm not sure how to answer your first question, nor know how to have UD Mobile execute a "Run If". I assume that when I figure out a "Run If", I would delete the If statement from the program and the "Run If" would take care of it.

I ran Geofence via Mobilinc for years ..(Thanks Wes!!)

If you can send me to a wiki or describe further, I'd appreciate it.

Take a screenshot of the Geofence setup in UD Mobile which show the command.  The command should be RUN IF (not Enable, Run Then, Run Else) on the Program.

The program looks fine, but needs to be disabled or it will be triggered by the time change.... unless that is what you want.

  • Author

Thanks Javi.

I didn't see the RUN IF selection in Geofence (first geofence attempt). I also saw a "Run If" selection if I right click the program. Does this need to be done also?

Here is a pic. Thanks again!

az_geofence.jpg

  • Solution

That look correct, RUN IF (Set RUN IF) should be triggered on geofence enter. 

The program itself needs to be disabled or it will run at the time in the IF condition.

This can be tested when the time is valid by pressing Trigger Enter Command.  Note that geofences may take a couple of minutes to trigger so the radius may need to be larger.

Another option is to set your geofence to turn a variable to 1  for entrance and 0 for exit. 

This manner offers the future flexibility and ease to trigger ANY program by writing it in the AC vs utilizing the geofence in UDM to add programs etc. 

Additionally with two phones (mine and my wife's), I am able to distinguish which one is home to open the correct garage door and in the case that we both come home together, it opens the most likely garage door that houses the car we usually drive in together. 

A lot more flexibility this way. 

 

 

  • Author

Javi & dbwarner5

I just tried it and it worked. Thanks for all your input.

Al Zulich

Guest
This topic is now closed to further replies.

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.