Jump to content

Is there a way to check on months without year


Panda88

Recommended Posts

The ISY has system values for “day of month”, “month”, “year” and so on, but these system values cannot be used in program conditions directly: the values need to be stored in program variables first. Then these variables can be used for programs and folders in conditions for partial dates, e.g., “if day-month is 16-12 then …”, which is supposed to run the program’s then block yearly on December 16th.

A program runs daily at midnight which sets these integer variables to the numbers of today’s date:

·        Date_day_of_month

·        Date_month

·        Date_year

Before the integer variables are set, the program sets the state variable “$sDate_valid” to 0, which indicates invalid date variable values during the date change. Once the date variables are all set, the state variable is set to 1, which indicates that the date variables are valid.

Program and folder conditions can be constructed by combining the state variable “$sDate_valid” with the date variables.

Program: Set day month year [Run At Startup]

If

        Time is 12:00:00AM

Then

        $sDate_valid  = 0

        $Date_day_of_month  = [Current Day of Month]

        $Date_month  = [Current Month (Jan=1, Feb=2, etc.)]

        $Date_year  = [Current Year ]

        $Date_day_of_month Init To $Date_day_of_month

        $Date_month Init To $Date_month

        $Date_year Init To $Date_year

        Wait  1 second

        $sDate_valid  = 1

Else

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

 

At midnight every day, sets the variables for the date.

Indicates that a date change was completed and that the

date variable values are again valid. Also sets the

variable init values, so that the correct date values

are restored in case of a reboot.

Example: Folder Conditions for 'Christmas time'

If

        $sDate_valid is 1

    And (

             (

                  $Date_month is 11

              And $Date_day_of_month >= 21

             )

          Or $Date_month is 12 

          Or (

                  $Date_month is 1

              And $Date_day_of_month <= 15

             )

        )

Then

   Allow the programs in this folder to run.

 

Allows the programs in this folder to run from

November 21 through January 15 every year.

 Happy holidays!

Link to comment
1 hour ago, Panda88 said:

Thanks 

The logic may not be 100% correct but I get the idea and can work from this 

Are the system variable documents anywhere?

1) Create variables for whatever you want.  Like month, year, week, etc.

2) Create a program that runs at midnight

3) In the then section, specify that each of your variables gets set from the corresponding system value (you have to click the little black triangle to switch between different menus of items for your variables)

 

Untitled.png

Link to comment

Archived

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


×
×
  • Create New...