Jump to content

Repeating a certain program every 30 minutes


Go to solution Solved by paulbates,

Recommended Posts

Posted

I am used to writing SQL queries....this UD program is stumping me. I have an if then else program that I want to run every 30 minutes. How is that done in UD Programs?Screenshot2025-03-30144301.png.a0844265d3b7bcb71ed8560ba6ff7a17.png

Posted (edited)

Add a Repeat statement as the first statement under then. One of the options is "Repeat Every" set that to 30 minutes. The statements under Repeat will indent

Note that when the conditions of the If are no longer true, it will stop. In this program, it should bounce back and forth between then and else... which I think is your intent

image.thumb.png.b234da8195fac160b3049af82612c0b5.png

Edited by paulbates
  • Like 1
Posted
19 minutes ago, paulbates said:

Add a Repeat statement as the first statement under then. One of the options is "Repeat Every" set that to 30 minutes. The statements under Repeat will indent

Note that when the conditions of the If are no longer true, it will stop. In this program, it should bounce back and forth between then and else... which I think is your intent

image.thumb.png.b234da8195fac160b3049af82612c0b5.png

I did this before (every 10 minutes as a test) by adding to the THEN and ELSE statements....but when I looked in the SUMMARY TAB of the PROGRAMS TAB, and hit "refresh" I did not see the "Last finish time" or the "next Scheduled Run" had updated at all. Is this normal? Or should it have updated?

Posted

Also to be noted in ISY programming...

Looping, of any kind, cannot be nested. Multiple programs must be used for nested looping.

Sent from my SM-S711W using Tapatalk

  • Solution
Posted (edited)
2 hours ago, ddeanwms said:

What I really want is for the entire program to run once an hour.

Ok, you'll need 2 programs

<Program 1> Computer Cabinet once an hour

If
   <no statement>

Then
   Repeat every 1 hour
        Run If Program Computer cabinet

<Program 2> Computer Cabinet
    <your current program>

Notes:

  • Set the first program to run on start up
  • Disable program 2 so it does not run automatically
  • What this will do is the the ISY will run program 1 when its started
  • Program 1 will run once an hour
  • Program one will call program 2
  • Program 2 is disabled so it will only run when program 1 calls it
     
Edited by paulbates
  • Like 3
Posted (edited)

I would only add that the first time you need to manually run the first program.  "run then".  Since it is set to run at startup, any reboots will automatically get it going.

 

As an alternative, you can install the time data node.  Using that, you can have it run at a specific schedule rather than on a loop starting whenever the program first ran.  In this case, no need to run at startup.  Below is an example to run at the top and bottom of the hour, every hour.

 

 

If
        'TimeData' Minute is 0 minute
     Or 'TimeData' Minute is 30 minute
 
Then
        Run Program '2' (If)
 
Else
   - No Actions - (To add one, press 'Action')
 

Edited by apostolakisl
  • Like 1
Posted
20 hours ago, apostolakisl said:

I would only add that the first time you need to manually run the first program.  "run then".  Since it is set to run at startup, any reboots will automatically get it going.

 

As an alternative, you can install the time data node.  Using that, you can have it run at a specific schedule rather than on a loop starting whenever the program first ran.  In this case, no need to run at startup.  Below is an example to run at the top and bottom of the hour, every hour.

 

 

If
        'TimeData' Minute is 0 minute
     Or 'TimeData' Minute is 30 minute
 
Then
        Run Program '2' (If)
 
Else
   - No Actions - (To add one, press 'Action')
 

I prefer to do both... have program one run at startup and then I also set multiple times in the if to ensure that program 2 is running. 

 

If Time is:

8am or

12pm or

5pm  or

12 am 

etc... 

Then Run program 2 then.

Posted
8 minutes ago, dbwarner5 said:

I prefer to do both... have program one run at startup and then I also set multiple times in the if to ensure that program 2 is running. 

 

If Time is:

8am or

12pm or

5pm  or

12 am 

etc... 

Then Run program 2 then.

I also do that however it was never established what the logic is for [Run at Startup] is.

 

I know it will fail with a time trigger because it appears to act like an AND function with the other IF logic making it nonfunctional.

 

A few programs I have included a line

Run ThisProgram[then] 

into the Else section to ensure it actually functions.

Posted
12 hours ago, larryllix said:

I also do that however it was never established what the logic is for [Run at Startup] is.

 

I know it will fail with a time trigger because it appears to act like an AND function with the other IF logic making it nonfunctional.

 

A few programs I have included a line

Run ThisProgram[then] 

into the Else section to ensure it actually functions.

Blank if will run true at startup if set to run at startup. 

Posted
12 hours ago, dbwarner5 said:

I prefer to do both... have program one run at startup and then I also set multiple times in the if to ensure that program 2 is running. 

 

If Time is:

8am or

12pm or

5pm  or

12 am 

etc... 

Then Run program 2 then.

This program will be false at startup (if set to run at startup). setting it to run at startup wont accomplish anything unless you intend to run the else clause. 

Posted
12 hours ago, apostolakisl said:

This program will be false at startup (if set to run at startup). setting it to run at startup wont accomplish anything unless you intend to run the else clause. 

Oops.. typo.. meant to say that program 2 is set to run at startup. And program 1 runs at multiple times of the day to ensure prog 2 is actually running. 

  • Like 1
Posted (edited)
On 4/4/2025 at 11:29 PM, apostolakisl said:

Blank if will run true at startup if set to run at startup. 

I prefer not to add another dummy program just to run another a startup and try to use the function without another program. I have a few with Else sections that just jump back to the Then sections.

Run at Startup would be much better as another program line that users could be aware that it exists without extra documentation, inside the program.

A coding line for Run at Startup would also disclose the logic Run at Startup uses, and be controllable by the user usage of AND or OR logic. No extra confusing program or hidden checkbox would be necessary. Programs should be self-contained, not logic spread all over the webpages and jumps into the middle of other programs in  spaghetti bowl style programming.

Edited by larryllix
  • Like 1

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...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...