Jump to content

every thirty day program


PB11

Recommended Posts

Posted (edited)

Hi All, and good morning.

I have some batteries that need to be charged every thirty days. I have them plugged into an insteon switch and 2 programs that are meant to trigger them.

First program "Robot Charging" is just a "then" which turns on the outlets, charges 3 hours, then turns off.

Second program "Robot Timer" is an "If" that triggers "Robot Charging" program.

Its not working. Even in the summary windows, it shows last run and next run if I manually kick on the "Robot Charging" but then nothing happen on the next scheduled event.

If I reboot the isy, am I losing the "next scheduled event"? It seems all fields are empty after reboot.

Any thoughts would be appreciated.

 

Robot Charging - [ID 005A][Parent 0059][Run At Startup]

If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Set 'Garage / Robot Outlets / Robot Outlet.1 On-Off Top' On
        Set 'Garage / Robot Outlets / Robot Outlet.2 On-Off Bot' On
        Send Notification to 'Lake House' content 'Robot Charging on'
        Wait  3 hours 
        Set 'Garage / Robot Outlets / Robot Outlet.1 On-Off Top' Off
        Set 'Garage / Robot Outlets / Robot Outlet.2 On-Off Bot' Off
        Send Notification to 'Lake House' content 'Robot Charging Off'
 
Else
   - No Actions - (To add one, press 'Action')
 

 

Robot Timer - [ID 0058][Parent 0059][Run At Startup]

If
        Time is Last Run Time for 'Robot Charging' + 750 hours 
 
Then
        Run Program 'Robot Charging' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
image.thumb.png.9ae7a840c97f8b75744e2d99383c016e.png

Edited by PB11
Posted

Do you have any conditions on the folder these programs are in that would prevent them from running?

As you mention, when the ISY reboots, it will restart the charging and a new 30 day (750 hr?) timer.  There will be no memory of the last time charged.

If this is not intended, you can create a state variable [X] and use as a timer.

Everyday at a given hour increment X +=1 and then set X Init To X.  This will preserve the day count during a reboot.

Have another program trigger when X >= 30.  Start the charging program and reset X and Init To = 0.

If you really need 750 hours instead of 30 days, adjust to increment timer value ever hour instead of every day.

  • Thanks 1
Posted

No conditions on folders. I had started with the state variable but couldn't figure out the date +1. I'll revisit this.

750 hours was the only way i could figure out the 30 day equivalent.

Thanks @gzahar

Posted (edited)

I would hook into the ISY clock variables and not use relative timers at all. Any power glitch or other event that can happen, relative timers fail. Over the period of 30 days the likelihood of a relative time timer working is very low. DST and PEC hydro are not your friends.

This is an ISY Internet based clock I wrote to use for many programs. It is always as accurate as ISY is.

 

 

Edited by larryllix
  • Like 2
Posted

I was busy looking for @kclenden post linked below which is a slightly different version of what @larryllix dinged in with while i was looking:

 

 

PS: your first program "Robot Charging - [ID 005A][Parent 0059][Run At Startup]" without an IF body shouldn't have [Run at Startup] enabled, and I believe most people disable that type of program but I've done it without disabling.

  • Like 1
Posted

How critical is the 30-day interval?  How about 28 days?  31 days?

If not overly critical, why not simply charge it on the first day of each month, using the system variables for day?

  • Like 1
Posted
21 minutes ago, oberkc said:

How critical is the 30-day interval?  How about 28 days?  31 days?

Not Critical. I hadn't realized ISY could do first day of the month. Hadn't seen this as an option. Will research all the above. Thanks everyone.

Posted

Every 30 day program is fairly easy to do.  Just use a variable that counts days then divide by 30 using the remainder function.  Make sure you set the variable to "init" each time it rolls over to the next day so it isn't lost on a reboot.  Set the ISY to "catch up" on reboot just in case you have a reboot at midnight.  If the isy is off for more than the catch up time, however, it will fall back one day and you'll need to manually fix it.  Probably not gonna happen too often if ever.

New Program - [ID 016B][Parent 0093]

If
        Time is 12:00:00AM (could be a different time if you want)
 
Then
        $i.total_day += 1
        $i.total_day Init To $i.total_day
        $i.30_day  = $i.total_day
        $i.30_day %= 30
        $i.30_day Init To $i.30_day
 
Else
   - No Actions - (To add one, press 'Action')

Now i.30_day will be variable that counts from 0 to 29 over 30 days.  So your program would just be if i.30_day is 0 (or whatever 0-29 you want) and whatever else you want (like maybe a time of day), then charge your battery.

  • Thanks 1
Posted

To clarify also, system variables for day-of-month, month-of-year, and year, were newly introduced in the 5.x build, if I recall correctly.  However, if you are into the 5 software, an alternative would be to create a variable and use a daily program (I have included this in my 3:00am cleanup program) to set the variable to day-of-month.  Once you have done this, you could then create a program such as:

if

newly created variable (day of month) = 1

then

charge batteries.

  • Thanks 1
Posted

If you have a polyglot running you can install the "ISY time data" node which has "days since unix epoch".  Unix epoch is the number of days that have passed since Jan 1, 1970.   Since this number just keeps counting day by day you can use it to divide by 30/remainder.  In fact, you can use that value to divide/remainder for any interval you want.  It also has minutes and hours since start of year so you could do the same thing with minutes and hours (though it would probably be wrong for the first interval on Jan 1)

Posted

Using NS Time-Data, how can I create a program that turns on specific balcony lights from 3rd Thursday of November till 1rst Thursday of January, and from Sunrise minus 1 hour to Sunrise as well as from Sunset minus 1 hour to 11 pm ?

  • Like 1
Posted
1 hour ago, asbril said:

Using NS Time-Data, how can I create a program that turns on specific balcony lights from 3rd Thursday of November till 1rst Thursday of January, and from Sunrise minus 1 hour to Sunrise as well as from Sunset minus 1 hour to 11 pm ?

This doesn't directly answer your question, but I'd write multiple programs, one for each month using the Time-Data program, and one program using the ISY's built in scheduling for the time.  Way easier to write, understand and debug.

November Deck Lights - [ID 007B][Parent 00A7]

If
        'Devices / dirNodeServers / ISY Time Data / ISY Time Data' Month is November
    And 'Devices / dirNodeServers / ISY Time Data / ISY Time Data' Day of Week is Thursday
    And 'Devices / dirNodeServers / ISY Time Data / ISY Time Data' Day of Month > 7 days
 
Then
        Enable Program 'Deck Lights'
 
Else
        Disable Program 'Deck Lights'
 

This might work for turning on/off the lights using the ISY internal scheduler:

Deck Lights - [ID 007B][Parent 00A7]

If
        From    Sunrise -  1 hour 
        To      Sunrise (same day)
     Or From    Sunset  -  1 hour 
        To      11:00:00PM (same day)
 
Then
        Set 'Devices / dirExterior / sldDeckEast' On
 
Else
        Set 'Devices / dirExterior / sldDeckEast' Off
 

 

Posted (edited)
58 minutes ago, Bumbershoot said:

This doesn't directly answer your question, but I'd write multiple programs, one for each month using the Time-Data program, and one program using the ISY's built in scheduling for the time.  Way easier to write, understand and debug.



November Deck Lights - [ID 007B][Parent 00A7]

If
        'Devices / dirNodeServers / ISY Time Data / ISY Time Data' Month is November
    And 'Devices / dirNodeServers / ISY Time Data / ISY Time Data' Day of Week is Thursday
    And 'Devices / dirNodeServers / ISY Time Data / ISY Time Data' Day of Month > 7 days
 
Then
        Enable Program 'Deck Lights'
 
Else
        Disable Program 'Deck Lights'
 

This might work for turning on/off the lights using the ISY internal scheduler:



Deck Lights - [ID 007B][Parent 00A7]

If
        From    Sunrise -  1 hour 
        To      Sunrise (same day)
     Or From    Sunset  -  1 hour 
        To      11:00:00PM (same day)
 
Then
        Set 'Devices / dirExterior / sldDeckEast' On
 
Else
        Set 'Devices / dirExterior / sldDeckEast' Off
 

Thanks.  I did the IF  slightly different:



If
        'Devices / dirNodeServers / ISY Time Data / ISY Time Data' Month is November
    And 'Devices / dirNodeServers / ISY Time Data / ISY Time Data' Day of Week is Thursday
    And 'Devices / dirNodeServers / ISY Time Data / ISY Time Data' Week of the Year > is 48

This is not exactly on Thanksgiving, but close enough and a second program on 5th day of the year to disable the program. Thanks for the tip.

 

Edited by asbril
Posted
On 1/31/2021 at 11:18 AM, asbril said:

Using NS Time-Data, how can I create a program that turns on specific balcony lights from 3rd Thursday of November till 1rst Thursday of January, and from Sunrise minus 1 hour to Sunrise as well as from Sunset minus 1 hour to 11 pm ?

As per @Bumbershoot's suggestion, the following two programs would work along with his 3rd example.

Balcony Enable - [ID 014B][Parent 0005]

If
        'ISY Time Data' Month is November
    And 'ISY Time Data' Day of Week is Thursday
    And 'ISY Time Data' Day of Month > 14 days
 
Then
        Enable Program 'Balcony On'
 
Else
   - No Actions - (To add one, press 'Action')

 

Balcony Disable - [ID 014D][Parent 0005]

If
        'ISY Time Data' Month is January
    And 'ISY Time Data' Day of Week is Friday
    And 'ISY Time Data' Day of Month > 1 days
 
Then
        Disable Program 'Balcony On'
 
Else
   - No Actions - (To add one, press 'Action')
 

 

Posted (edited)
18 minutes ago, gzahar said:

As per @Bumbershoot's suggestion, the following two programs would work along with his 3rd example.

Balcony Enable - [ID 014B][Parent 0005]

If
        'ISY Time Data' Month is November
    And 'ISY Time Data' Day of Week is Thursday
    And 'ISY Time Data' Day of Month > 14 days
 
Then
        Enable Program 'Balcony On'
 
Else
   - No Actions - (To add one, press 'Action')

 

Balcony Disable - [ID 014D][Parent 0005]

If
        'ISY Time Data' Month is January
    And 'ISY Time Data' Day of Week is Friday
    And 'ISY Time Data' Day of Month > 1 days
 
Then
        Disable Program 'Balcony On'
 
Else
   - No Actions - (To add one, press 'Action')
 

 

What  I don't understand is the "    And 'ISY Time Data' Day of Month > 14 days      "  and the  "     And 'ISY Time Data' Day of Month > 1 days     ".  Would Thursday and 14 days not be a conflict (and anyway Thanksgiving would be closer to 21 days)?  Same for Friday and 1 day.  Thursday is not always on the 14th and Friday not always on the first.  That is why I am at a loss.

Edited by asbril
Posted
17 minutes ago, gzahar said:

As per @Bumbershoot's suggestion, the following two programs would work along with his 3rd example.

Balcony Enable - [ID 014B][Parent 0005]

If
        'ISY Time Data' Month is November
    And 'ISY Time Data' Day of Week is Thursday
    And 'ISY Time Data' Day of Month > 14 days
 
Then
        Enable Program 'Balcony On'
 
Else
   - No Actions - (To add one, press 'Action')

 

Balcony Disable - [ID 014D][Parent 0005]

If
        'ISY Time Data' Month is January
    And 'ISY Time Data' Day of Week is Friday
    And 'ISY Time Data' Day of Month > 1 days
 
Then
        Disable Program 'Balcony On'
 
Else
   - No Actions - (To add one, press 'Action')
 

 

What  I don't understand is the "    And 'ISY Time Data' Day of Month > 14 days      "  and the  "     And 'ISY Time Data' Day of Month > 1 days     ".  Would Thursday and 14 days not be a conflict (and anyway Thanksgiving would be closer to 21 days). Same for Friday and 1 day.  Thursday is not always on the 14th and Friday not always on the first.  That is why I am at a loss.

Posted

Any day of the month after (>) the 14th will start being the third 'day' of that month.  So once you hit the 15th day or greater and it is a Thursday, it will be at least the 'third' Thursday of that month.  It may also be the 4th Thursday (Thanksgiving), but it doesn't matter because you still want the lights enabled (starting from the third Thursday).

Keep in mind when using '>' any day after the 14th will be true for that line and it will also need to be November & Thursday for the program to run 'Then'.

 

  • Thanks 1
Posted (edited)
2 hours ago, asbril said:

What  I don't understand is the "    And 'ISY Time Data' Day of Month > 14 days      "  and the  "     And 'ISY Time Data' Day of Month > 1 days     ".  Would Thursday and 14 days not be a conflict (and anyway Thanksgiving would be closer to 21 days). Same for Friday and 1 day.  Thursday is not always on the 14th and Friday not always on the first.  That is why I am at a loss.

You need to connect things with and's and or's and use parenthesis to make the above stuff work.  However things get very complicated doing it that way.

I would suggest instead 2 "enabler" programs that enable a 3rd program on the 3rd Thursday of November and disables that 3rd program on the first Thursday of January.  That program will do the turning on/off of the lights per your sunrise/sunset schedule that you want, it won't contain any date info.

if
month is november
and
day of month is >14
and
day of week is thursday
Then
enable 3rd program

If
month is january
and
day of week is Thursady  (since it is the first Thursday you don't need > some number of days)
Then
disable 3rd program

3rd program
If
time is from/to whatever you want
or
time is the other from/to time you want
Then
turn lights on
Else
turn lighs off

NOTE: The first program will run true also on the 4 (and if there is a 5th) Thursday of November.  It won't matter.  
Similarly, the second program will run on every Thursday of January, but it won't matter.  
Enbaling a program that is already enbaled doesn't matter, and the same for disabling.

EDIT:  You might need a trigger in the first two programs.  I'm not sure if the ISY time data info is a trigger.  So you might need to put "and time is 1am" or something like that to get the program to check the other data.

Edited by apostolakisl
  • Thanks 1
Posted
1 hour ago, gzahar said:

Any day of the month after (>) the 14th will start being the third 'day' of that month.  So once you hit the 15th day or greater and it is a Thursday, it will be at least the 'third' Thursday of that month.  It may also be the 4th Thursday (Thanksgiving), but it doesn't matter because you still want the lights enabled (starting from the third Thursday).

Keep in mind when using '>' any day after the 14th will be true for that line and it will also need to be November & Thursday for the program to run 'Then'.

 

I missed the " > " , now it all makes sense. THANKS

Posted
3 minutes ago, apostolakisl said:

If month is january and day of week is Thursady (since it is the first Thursday you don't need > some number of days) Then disable 3rd program

I was going with the assumption he wanted the lights on for the first Thursday of the month, hence disabling the Friday after (you will need the > 1 for that).

Your example will disable on the first Thursday.  May not matter.

Other than that, I don't see how yours is any different than what I posted.

Posted
31 minutes ago, gzahar said:

I was going with the assumption he wanted the lights on for the first Thursday of the month, hence disabling the Friday after (you will need the > 1 for that).

Your example will disable on the first Thursday.  May not matter.

Other than that, I don't see how yours is any different than what I posted.

Didn't see your original post, was looking at the quote.  I didn't see you enabling another program, I thought you were trying to make it all one program, which while possible, would require a lot of confusing stuff.  You are correct about the second program.  If he wants the first Thursday to still turn lights on, then he needs to add a line that says "and time is 11:59:59 pm" into my program.  Then it will trigger at 11:59:59 and disable the 3rd program 1 second earlier than yours.  As I mentioned, he may need a time trigger in there anyway since I am not positive that ISY time data node server values are triggers. Need to test that.

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.4k
×
×
  • Create New...