Jump to content

Run at Startup


hart2hart

Recommended Posts

Posted

To get a program running every 30 minutes I create a program with no If clause and mark it to Run it at startup with a then command that "Runs Then" the program that will run every thirty minutes.  In effect, I am priming the pump to get program started running every 30 minutes. Example below:

 

 

Is this correct or is  there a more straight forward way to do this? 

 

 

 

Climate:Prime Outside Temperature -- Marked to run at startup

 

If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Run Program 'Climate:Set Outside Temperature' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')

 

 

 

'Climate:Set Outside Temperature'

If
        Time is Last Run Time for 'Climate:Set Outside Temperature' + 30 minutes
 
Then
        $Climate_Outside_Temperature  = $Thermostat_Great_Outdoor_Temp
        $Climate_Outside_Temperature Init To $Thermostat_Great_Outdoor_Temp
 
Else
   - No Actions - (To add one, press 'Action')
 

 

 

 

 

Posted

Nope.

 

Running at startup means it will trigger the "if".  So a blank if does nothing.

 

Just do a "repeat every 30 minutes"

 

and include an "if" clause that is for sure true and set it to run at startup.

 

If

variable x is >= 1

or 

variable x is < 1

 

Then

repeat every 30 minutes

your stuff.

Posted

If I run "If" manually, from the pulldown menu,  then runs on this test program (below) turning the light off and then restoring dim.

 

Do you think the "Run at Startup" would be different logic?

If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Set 'Gathering Room / PotLight over Desk' Fast Off
        Wait  1 second
        Run Program 'GathRm Mode.Resume' (If)
 
Else
   - No Actions - (To add one, press 'Action')
 


Posted (edited)

Thanks but now I'm officially confused because the program below is marked to run at startup and  I receive the notification every time the ISY reboots.  There would seem to be an implication that when the If condition is blank to run the then statements at least at  startup.

 

 

 

If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Send Notification to 'JPaulText' content 'ISY Reboot'
 
Else
   - No Actions - (To add one, press 'Action')

 

 

 

 

Another tidbit... the last run time etc is not recorded when programs are run at startup even though I know they ran.  Is this as expected or is there something inconsistent with this mechanism?

 

 

Edited by hart2hart
Posted (edited)

I'll look into this.  I maybe wrong.  Perhaps a blank "if" defaults to running "then" if you force a run.  I just assumed that a blank "if" does nothing since it is neither true nor false.  The logic of a blank "if" being true escapes me.

 

EDIT: Indeed a blank if is somehow "true"  Don't ask me how that logic works.

 

No less, there still doesn't need to be 2 programs.  The repeat every 30 minutes would take care of it

If
        blank
 
Then
     Repeat every 30 minutes
        $Climate_Outside_Temperature  = $Thermostat_Great_Outdoor_Temp
        $Climate_Outside_Temperature Init To $Thermostat_Great_Outdoor_Temp
 
Else
   - No Actions - (To add one, press 'Action')
 
Edited by apostolakisl
Posted (edited)

 

I'll look into this.  I maybe wrong.  Perhaps a blank "if" defaults to running "then" if you force a run.  I just assumed that a blank "if" does nothing since it is neither true nor false.  The logic of a blank "if" being true escapes me.

 

EDIT: Indeed a blank if is somehow "true"  Don't ask me how that logic works.

 

No less, there still doesn't need to be 2 programs.  The repeat every 30 minutes would take care of it

If
        blank
 
Then
     Repeat every 30 minutes
        $Climate_Outside_Temperature  = $Thermostat_Great_Outdoor_Temp
        $Climate_Outside_Temperature Init To $Thermostat_Great_Outdoor_Temp
 
Else
   - No Actions - (To add one, press 'Action')
 

This is probably is NOT a good programming practice anyway. If the firmware version changes and an unknown "feature" gets inadvertently removed it could stop working without any warning.

 

You probably tested this to not work on your ISY from 1983   :D

 

 

If

     0 is 0

Then

   ....

Edited by larryllix
Posted

This is probably is NOT a good programming practice anyway. If the firmware version changes and an unknown "feature" gets inadvertently removed it could stop working without any warning.

 

You probably tested this to not work on your ISY from 1983   :D

 

 

If

     0 is 0

Then

   ....

 

In the few and far between cases that I wanted an "If" clause to always be true, I have done something like that (see my first post).  It would appear that leaving it blank is functionally equivalent.  I doubt UD would change the fact that blank evals to true when triggered.  My speculation is that the "logic" is more of how ISY works rather than logic of the program as written.  In other words, my bet is that once a program is triggered, it must result in a true or false outcome because of how the code was designed.

  • 1 month later...
Posted

So what is the conclusion of this discussion?

What is the difference between

 

1) a program with a "blank" IF clause

2) a program that is marked as "run at startup" (with the Programs-summary-apply buttons)

 

Will they both run at ISY reboot time?

From my cursory investigation, it is inconclusive... I found some programs that match (1) above and have a "repeat every" clause that were running and some of them that were not running. I'm not sure what triggered some of them to run...

 

Bert

Posted

It has been my understanding the Run at Startup is required for a Program to be invoked by the ISY at reboot.  I've run many tests with these two Programs and the only Program to Run at Startup  is AAA3 which has that option.  

 

That does not mean another Program could not Run a Program without the Startup option, only that the ISY does not start a Program.

 

AAA3 - [iD 0043][Parent 0001][Run At Startup]
 
If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Repeat Every  1 minute 
           $IAway += 1
 
Else
        Repeat Every  1 minute 
           $IAway -= 1
 
 
AAA4 - [iD 0074][Parent 0001]
 
If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Repeat Every  1 minute 
           $IVar4 += 1
 
Else
        Repeat Every  1 minute 
           $IVar4 -= 1
 
 
Posted

So what is the conclusion of this discussion?

What is the difference between

 

1) a program with a "blank" IF clause

2) a program that is marked as "run at startup" (with the Programs-summary-apply buttons)

 

Will they both run at ISY reboot time?

From my cursory investigation, it is inconclusive... I found some programs that match (1) above and have a "repeat every" clause that were running and some of them that were not running. I'm not sure what triggered some of them to run...

 

Bert

 

 

1) "Run at Startup" is the same thing as saying  "evaluate the if clause at boot"

2) A blank 'if" clause evaluates to true.  This is true at startup or any time the "if" is asked to evaluate, regardless of what is asking it to evaluate (bootup, another program)

 

So if you want a "then" clause to execute at boot, then leave the "if" blank or put an always true statement (like if 0 is 0) and set it to run at startup.  Adding the always true "if 0 is 0" may or may not serve any purpose.  At the very least it reminds you that it is true.

Posted

I would guess that if you put 'if 1 = 0' and check 'Run at startup' then 'Else' would be run at startup instead of 'Then'.

 

Not sure the utility of this, and not sure if true. Maybe I'll test someday.

Posted

Testing a variable on start up gives a choice of Then or Else.

 

Keep it green in '15

Posted

I would guess that if you put 'if 1 = 0' and check 'Run at startup' then 'Else' would be run at startup instead of 'Then'.

 

Not sure the utility of this, and not sure if true. Maybe I'll test someday.

 

Putting an always false statement like if 0 is 1 would push your run at startup to the else clause every time.  It is 6 or half dozen, going with always true and filling out the "then" or always false and filling out the "else".  But I would stick with going the true route, it just keeps the mind from spinning in circles.

 

The basic jist is that "run at startup" is going to cause the "if" to evaluate.  Really the only non-intuitive thing is that a blank "if" is evaluated as true. 

Posted

The following is from the Wiki but I have not tested it myself:

"Next, ISY queries all devices and determines their status. During this process, the True/False state is determined for programs and folders which have conditions, and any programs which require running are set to run following initialization. Folders with no conditions are set to True so as not to prevent programs within them from running, since without conditions a folder's state will never be changed. Programs which have no conditions are initialized to False, just as a variable would be, since programs, which are often used as flags, may have their state changed by other programs or directly from the Program Summary tab, even though they have no conditions."

Posted

Pasting the larger context of hbsh01 quote for reference.

 

The point for this reference is that there is a difference between "running a program" and "setting the state of a program".

After reading this carefully, I wonder which programs the second paragraph refers to in "and any programs which require running are set to run following initialization".

The "caching up" programs are dealt with in paragraph one, and the "run at startup" programs are dealt with in paragraph three...

 

Boot/Startup Sequence and Program Execution Order

When the ISY boots, the True/False state of all schedule programs is determined, and any schedules which require catching up, are set to run following initialization. If Catch up schedules at Restart is enabled, schedules are set to run from the beginning of the day; otherwise schedules are set to run only for the specified Missed Schedule Grace Period. Note that prior to firmware 2.6.4, the Missed Schedule Grace Period applied only to Time is schedules, not From/To or From/For schedules; as of firmware 2.6.4 it applies to all schedules.

Next, ISY queries all devices and determines their status. During this process, the True/False state is determined for programs and folders which have conditions, and any programs which require running are set to run following initialization. Folders with no conditions are set to True so as not to prevent programs within them from running, since without conditions a folder's state will never be changed. Programs which have no conditions are initialized to False, just as a variable would be, since programs, which are often used as flags, may have their state changed by other programs or directly from the Program Summary tab, even though they have no conditions.

Finally, programs which are set to Run at Startup are set to run following initialization. Note that prior to firmware 2.6.6, a program which was set to Run at Startup would actually execute at startup only if its Enabled box was checked; as of firmware 2.6.6 it will run at startup when set to do so, regardless of the state of the Enabled box.

At this point initialization is complete, and event processing begins. All programs which were set during initialization to run, whether schedules, triggers, or Run at Startup, now begin running, and programs initiated by new events will also begin running. In all cases, the order in which the programs run is determined by ISY's internal algorithms, and is not user predictable; specifically, schedules do not necessarily run in chronological order.

Posted

Keep in mind the ISY is a "state machine". Regardless if a program is True, it must have a trigger to cause the If clause to be evaluated. A blank If might technically be True but there is no trigger for the ISY to evaluate it and execute the Then clause. Until evaluation is triggered by another program, ISY considers it False. Once evaluated, a blank If is logically True but will never be evaluated again without a trigger from a program.

 

I have a few programs with Repeat clauses that I want to always run and to begin at startup. The programs all have blank If clauses. I handle them with a variable. I have a variable named s.Startup and i.Startup.  I also have a program named Startup that is checked with "Run at Startup".

 

That program is as follows.

 

If

s.Startup =0

 

Then

Run Program1 (Then Path)

Run Program2 (Then Path)

Send Notification "ISY Boot"

Wait 30 seconds

Set s.Startup=1

Set i.Startup=1

 

 

Since the variables are never initialized, they are always zero on startup and set to one 30 seconds later. No other program modifies those variables. Any program I want to run at startup I add to the Then clause. The variable also has the use of telling me the when the ISY last booted, which is kind of handy if you've ever wondered "Did my ISY crash? If so when?"  I also know that no other program or event could cause the Then clause to execute since the variable will never be zero again until next boot.

 

By triggering all my 'startup' programs from one master program it makes it easy to keep track what they are.

 

For some programs, I also use watchdog programs to detect when they stop running. I'm not sure why, but sometimes programs that run "always' via a repeat clause just stop running. It's one of the things about the ISY that's currently frustrating me.

Guest
This topic is now closed to further replies.

×
×
  • Create New...