Jump to content

Reboot sequence


TJF1960

Recommended Posts

Here's the startup sequence:

 

Step 1. Variables are loaded/initialized

Step 2. All programs are initialized to false

Step 3. All conditions are initialized based on the current status of the devices, programs, variables etc. (the programs do not actually run).

Step 4. 'Run at Startup' programs are run

Step 5. Programs run as usual

Link to comment
  • 2 months later...

I'm using the set of program to keep track of day of week written by apostolakisl http://forum.universal-devices.com/viewtopic.php?p=48564#p48564

 

You'll notice these programs are scheduled to run at 12.00.00 AM and the seconds just after midnight.

 

I am finding upon power up / reboot these programs run, even if the time is not midnight! Hence if I reboot the day changes to the next day!

 

Its as though the programs are running before the ISY gets its clock set from the NTP server pool.ntp.org; i.e. until the NTP server responds the ISY thinks it is midnight.

 

Several other programs are also running even though they are set not to run at start-up.

 

I am running v3.1.3

 

Any thoughts as to what's going on or why?

Link to comment
  • 1 month later...
Here's the startup sequence:

 

Step 1. Variables are loaded/initialized

Step 2. All programs are initialized to false

Step 3. All conditions are initialized based on the current status of the devices, programs, variables etc. (the programs do not actually run).

Step 4. 'Run at Startup' programs are run

Step 5. Programs run as usual

 

3 more questions for UDI about the reboot process.

 

Is query of devices ran before step 1?

At what point in the steps would DSCLink/WCLink data be accepted by the ISY?

Now that we are at v3.1.6 have any of the above steps changed?

 

Thanks,

Tim

Link to comment
I'm using the set of program to keep track of day of week written by apostolakisl http://forum.universal-devices.com/viewtopic.php?p=48564#p48564

 

You'll notice these programs are scheduled to run at 12.00.00 AM and the seconds just after midnight.

 

I am finding upon power up / reboot these programs run, even if the time is not midnight! Hence if I reboot the day changes to the next day!

 

Its as though the programs are running before the ISY gets its clock set from the NTP server pool.ntp.org; i.e. until the NTP server responds the ISY thinks it is midnight.

 

Several other programs are also running even though they are set not to run at start-up.

 

I am running v3.1.3

 

Any thoughts as to what's going on or why?

 

 

As pointed out and already corrected by you, the catch-up program at restart can't be checked for this program series to work well.

 

I might point out a couple things.

 

1) I re-wrote the programs so they all cascade off of a single program (not sure if it is in the wiki but it is for sure on the thread where originally posted). In my mind this is a cleaner way to do it, and it makes it easier to force a run of the whole sequence if you are in a position where it needs a catch up day. Or, if somehow you accidentally pushed it ahead a day, you can just disable the first program in the series and then the whole series will sit idle until that program is re-enabled.

 

2) The program series will fall a day behind if the ISY is off from midnight to 12:15am (assuming you have the grace period set to 15 minutes).

Link to comment

Hi Tim,

 

3 more questions for UDI about the reboot process.

 

Is query of devices ran before step 1?

Query is done after programs have been initialized

 

At what point in the steps would DSCLink/WCLink data be accepted by the ISY?

As soon as the network is up but it depends on what DSCLink/WCLink is trying to do.

 

Now that we are at v3.1.6 have any of the above steps changed?

The steps have not changed but some of the priorities have changed to improve SSL2048 bit performance. What behavior are you seeing?

 

 

With kind regards,

Link to comment
As pointed out and already corrected by you, the catch-up program at restart can't be checked for this program series to work well.

I wrote a similar set of programs. I managed to squeeze it down to 4; one master program to increment the day variables and 3 subs to check the validity of the information (i.e. change of month, wrap from sat to sun, etc).

 

Rather than have the master program trigger directly based on time, I have a program called "Midnight" that I use to control some lights. I have my master date program trigger off a "true" condition for the Midnight program. The same points you made about the "catch up" process hold true for these as well. (If someone can figure out a way to determine if a given program has already run that day, I'd love to know it! I've twisted my mind in to a pretzel trying to figure out how to do it with the current state and variable limitations.)

 

Like you, I created this to have both Integer and State variables although I have yet to use the states to trigger anything. I expect I might as the holiday season comes up.

 

If anyone wants these I can post the export files. Meanwhile here's the info and code.

 

date.Changed - Master program. Calls the subs below.

  • date.Check.Day.Of.Week
    date.Check.Month
    date.Check.Year

 

Variable naming convention: $di. = integer variable. $ds. = state variable. I added the "d" to my normal convention so that I could sort by name and have them appear together in the variable lists.

  • [*:gje3p121].Day.of.Month (1 or 2 digit)
    [*:gje3p121].Day.of.Week (1 digit. Sun=1)
    [*:gje3p121].Month (1 or 2 digit)
    [*:gje3p121].Year (4 digit)
    [*:gje3p121].Leap.Year (0 = leap year)
    [*:gje3p121].Day.of.Year (1-3 digit)
    [*:gje3p121].Day.of.Year.Odd (1=Odd 0=Even) Note that this variable is calculated from the day of the year which means that in a normal year the variable will be "1" for both Dec 31 (day 365) and the following day Jan 1 (day 1).

 

You'll need to populate the state variables with day, month, year,day of week and day of year info prior to running the programs. Aug 20 is day number 232.

 

Program: date.Changed

If
       Program 'Midnight' is True

Then
       $di.Day.of.Month  = $ds.Day.Of.Month
       $di.Day.of.Week  = $ds.Day.Of.Week
       $di.year  = $ds.Year
       $di.Month  = $ds.Month
       $di.Day.of.Year  = $ds.Day.Of.Year
       $di.Day.of.Week += 1
       $di.Day.of.Month += 1
       $di.Day.of.Year += 1
       $di.Leap.Year  = $ds.Year
       $di.Leap.Year %= 4
       $ds.Leap.Year  = $di.Leap.Year
       $ds.Leap.Year Init To $di.Leap.Year
       $ds.Day.Of.Year  = $di.Day.of.Year
       $ds.Day.Of.Year Init To $ds.Day.Of.Year
       $di.Day.of.Year.Odd  = $di.Day.of.Year
       $di.Day.of.Year.Odd %= 2
       $ds.Day.Of.Year.Odd  = $di.Day.of.Year.Odd
       $ds.Day.Of.Year.Odd Init To $ds.Day.Of.Year.Odd
       Run Program 'date.Check.Month' (If)
       Run Program 'date.Check.Year' (If)
       Run Program 'date.Check.Day.Of.Week' (If)
       $ds.Day.Of.Week  = $di.Day.of.Week
       $ds.Day.Of.Week Init To $ds.Day.Of.Week

Else
  - No Actions - (To add one, press 'Action')

 

Program: date.Check.Day.Of.Week

If
       $di.Day.of.Week > 7

Then
       $di.Day.of.Week  = 1
       $ds.Day.Of.Week  = $di.Day.of.Week
       $ds.Day.Of.Week Init To $ds.Day.Of.Week

Else
  - No Actions - (To add one, press 'Action')

 

Program: date.Check.Month

If
       (
            $di.Day.of.Month > 31
        And (
                 $di.Month is 1
              Or $di.Month is 3
              Or $di.Month is 5
              Or $di.Month is 7
              Or $di.Month is 8
              Or $di.Month is 10
              Or $di.Month is 12
            )
       )
    Or (
            $di.Day.of.Month > 30
        And (
                 $di.Month is 4
              Or $di.Month is 6
              Or $di.Month is 9
              Or $di.Month is 11
            )
       )
    Or (
            $di.Day.of.Month > 29
        And $di.Month is 2
        And $di.Leap.Year is 0
       )
    Or (
            $di.Day.of.Month > 28
        And $di.Month is 2
        And $di.Leap.Year is not 0
       )

Then
       $di.Month += 1
       $di.Day.of.Month  = 1
       $ds.Day.Of.Month  = $di.Day.of.Month
       $ds.Day.Of.Month Init To $ds.Day.Of.Month
       $ds.Month  = $di.Month
       $ds.Month Init To $ds.Month
       Run Program 'date.Check.Year' (If)

Else
       $ds.Day.Of.Month  = $di.Day.of.Month
       $ds.Day.Of.Month Init To $ds.Day.Of.Month

 

Program: date.Check.Year

If
       $di.Month > 12

Then
       $di.Month  = 1
       $ds.Month  = $di.Month
       $ds.Month Init To $ds.Month
       $di.year += 1
       $ds.Year  = $di.year
       $ds.Year Init To $ds.Year
       $di.Day.of.Year  = 1
       $ds.Day.Of.Year  = $di.Day.of.Year
       $ds.Day.Of.Year Init To $ds.Day.Of.Year
       $di.Day.of.Year.Odd  = 1
       $ds.Day.Of.Year.Odd  = $di.Day.of.Year.Odd
       $ds.Day.Of.Year.Odd Init To $ds.Day.Of.Year.Odd

Else
  - No Actions - (To add one, press 'Action')

Link to comment

Archived

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


×
×
  • Create New...