Jump to content

If "day of month" = x?


Go to solution Solved by hart2hart,

Recommended Posts

Posted

I have programs that report out daily data for a sensor. They calculate and give monthly highs and lows.

What I need to do is reset the monthly value variables at the end of the first day of the month. It's been a while since I've done this. I found a post that reminded me that I used io_guy's ISY data plugin at my last house.. but I now don't have/want a pi to run nodelink.

From what I can see, I'll have to create program that runs at the start of the day and assign day of the month to a variable from system data

If
     time = 12:00:01am
then
      day_of_month = system data / day of month from the drop down

 

I'll have a second program do what I want

If 
       time = 11:59:50pm
and day_of_month = 1
then
       (Reset the variables)

Is there a way to do it directly with an if in one program, I feel like I'm forgetting something?

Posted (edited)

@paulbates

Hopefully you can find some clues in here. I am not sure if the system variables were here when you were frequent. :)

clock.sync - [ID 0003][Parent 0002][Run At Startup]

If
        
        // Run at Startup enabled
 
        Time is 12:00:10AM
     Or Time is  6:00:10AM
     Or Time is 12:00:10PM
     Or Time is  6:00:10PM
 
Then
        
        // update $sSys.MM.DD
 
        $Clock.scratch  = [Current Day of Month]
        $Clock.scratch /= 100
        $Clock.scratch += [Current Month (Jan=1, Feb=2, etc.)]
        $sSys.MM.DD  = $Clock.scratch
        $sSys.MM.DD Init To $Clock.scratch
        
        // update $sSys.hh.mm
 
        Repeat Every  20 seconds
           $Clock.scratch  = [Current Minute]
           $Clock.scratch /= 100
           $Clock.scratch += [Current Hour]
           $sSys.hh.mm  = $Clock.scratch
           
        // update $sSys.hh.5mm
 
           $Clock.scratch.noFrac  = [Current Minute]
           $Clock.scratch.noFrac /= 5
           $Clock.scratch.noFrac *= 5
           $Clock.scratch  = $Clock.scratch.noFrac
           $Clock.scratch /= 100
           $Clock.scratch += [Current Hour]
           $sSys.hh.5mm  = $Clock.scratch
        Repeat 1 times
 
Else
        
        // Run at startup will evaluate False
 
        Run Program 'clock.sync' (Then Path)
 

 

Edited by larryllix
  • Like 1
Posted
46 minutes ago, hart2hart said:

If I understand, The timedata node server has day of month.

ISY itself also has day of month and month codes. Only trouble is the parameter is not available for triggering programs, and needs to be polled to dump them into program triggering State Variables.

I use them in so many programs for year-free, date based, occasion based programs, it is worth while and only dependent on ISY itself, not on any other cloud, node server, or hardware device connections to function.

Posted
42 minutes ago, hart2hart said:

Are there reasons not to use the timedata node server? I use day of month from it as trigger in a few programs.

That's a good suggestion. When I looked in the store, and went to get hub to see an image of what iox would present, it was sunrise and sunset data only.

Sounds like you're saying it also presents month / day info like io_guy's ISY_Data node server used to?

 

Posted
13 minutes ago, paulbates said:

That's a good suggestion. When I looked in the store, and went to get hub to see an image of what iox would present, it was sunrise and sunset data only.

Sounds like you're saying it also presents month / day info like io_guy's ISY_Data node server used to?

 

Here's a screenshot of the information presented in the TimeData node.

Screenshot (12).png

  • Thanks 1
Posted
That's a good suggestion. When I looked in the store, and went to get hub to see an image of what iox would present, it was sunrise and sunset data only.
Sounds like you're saying it also presents month / day info like io_guy's ISY_Data node server used to?
 

It does. I adopted use of it when I migrated to eISY with node servers and away from nodelink.
  • Like 1
Posted
31 minutes ago, dbuss said:

Here's a screenshot of the information presented in the TimeData node.

Screenshot (12).png

This gave me "flashbacks" to isy_data 🤪😂

Thanks!

  • 1 month later...
Posted (edited)

I set up a real simple program using The TimeData node server in PG3x. I do a schedule in IF sometime just after midnight, with an AND IF which asks if (from TimeData) day of the month equals 1st

If it runs,  it ensconces my previous monthly total into a separate variable register, and cleans everything else to zero to start over. 

Super clean and easy. I knew TimeData would come in handy.

 

Edited by glacier991
Typos
Posted (edited)

My program looks something like this:

 

IF

           Time is 12:20 AM (I have a bunch of things that happen around midnight so I decided to let things settle down)

  AND  'Time Data Ephemeris is /  Time Data' Day of Month is 1 Day (In other words, the 1st. This is right in the drop downs in the programming tab)

 

THEN:    Whatever it is you want to accomplish on the wee hours of the 1st of the month. The program will only run at 12:20 on the 1st of any given month.

Edited by glacier991
details.
Guest
This topic is now closed to further replies.

  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

  • Forum Statistics

    • Total Topics
      37k
    • Total Posts
      371.5k
×
×
  • Create New...