Jump to content

How From:To schedules are evaluated in programs


blueman2

Recommended Posts

I am doing some programming to adjust power usage during peak periods since I am on an electricity program that charges more from 4pm to 9pm.  I currently have this program to turn off and on my towel warmer in my master bedroom:

Mbath Towel Timer - [ID 004F][Parent 0039]
If
        From    11:30:00PM
        To       6:30:00AM (next day)
Then
        Set 'Scenes-Inside / MBath Towel' Off
Else
        Set 'Scenes-Inside / MBath Towel' On

Is it OK for me to leave the above program active, and add the below program that is active only during summer months (the 4-9pm peak rates only apply during the summer)?

Mbath Towel Timer Summer Peak - [ID 0003][Parent 0039]
If
        From     4:00:00PM
        To       9:00:00PM (same day)
Then
        Set 'Scenes-Inside / MBath Towel' Off
Else
        Set 'Scenes-Inside / MBath Towel' On

If both are running, will there be any issues?  I am assuming the IF statements are only evaluated at their start/end times, and that they are not evaluated in between. For example, at 4pm, the second program will turn off the warmer.  The first program will not turn it back on, because it will not be evaluated again until 6:30am the next day, right?  

Link to comment

Hey Blueman2,

 

This doesn't answer your question, but can give you some idea on how to tackle the problem.

 

In my municipality, we have T.O.U. (Time of Use).  Basically like you, I pay more for high and mid peak times.  I found the easiest was to create a Variable setting times for Winter and Summer T.O.U.  Then when I have a program I would only like to be enabled depending on T.O.U., I use this variable at the top of the program.  I also have a variable for Winter and Summer I use for my furnace/air conditioning and bathroom exhaust fan programs.

 

Time of Use Summer Select Times - [iD 00B1][Parent 00BE][Run At Startup]
 
If
        $Summer_Season is 1
    And On Mon, Tue, Wed, Thu
        From     7:05:00PM
        To       6:55:00AM (next day)
     Or On Mon, Tue, Wed, Thu, Fri
        From     9:05:00AM
        To      10:55:00AM (same day)
     Or On Mon, Tue, Wed, Thu, Fri
        From     5:05:00PM
        To       6:05:00PM (same day)
     Or On Fri
        From     7:05:00PM
        To       6:55:00AM (3 days later)
 
Then
        Wait  1 second
        $Time_of_Use_Summer  = 1
        $Time_of_Use_Summer Init To 1
 
Else
        Wait  1 second
        $Time_of_Use_Summer  = 0
        $Time_of_Use_Summer Init To 0
 
Summer May 1 - October 31 - TOU from Hydro:
On Peak 18 cents per kWh - When demand for electricity is highest (Weekdays: 11 AM - 5 PM)
Mid Peak 13.2 cents per kWh - When demand for electricity is moderate (Weekdays: 7 AM - 11 AM AND 5 PM - 7 PM)
Off-Peak 8.7 cents per kWh - When demand for electricity is lowest (Weekdays: 7 PM to 7 AM, Weekends and Holidays – 24 hours, All Day)
 
Time of Use Winter Times - [iD 00B2][Parent 00BE]
 
If
        $Winter_Season is 1
    And (
             On Mon, Tue, Wed, Thu
             From     7:05:00PM
             To       6:55:00AM (next day)
          Or On Mon, Tue, Wed, Thu, Fri
             From    11:05:00AM
             To       1:55:00PM (same day)
          Or On Mon, Tue, Wed, Thu, Fri
             From     3:05:00PM
             To       4:55:00PM (same day)
          Or On Fri
             From     7:05:00PM
             To       6:55:00AM (3 days later)
        )
 
Then
        Wait  1 second
        $Time_of_Use_Winter  = 1
        $Time_of_Use_Winter Init To 1
 
Else
        Wait  1 second
        $Time_of_Use_Winter  = 0
        $Time_of_Use_Winter Init To 0
 
Winter Nov 1 to April 30 - TOU from Hydro:
On Peak 17.5 cents per kWh - When demand for electricity is highest (Weekdays: 7-11 AM and 5-7 PM)
Mid Peak 12.8 cents per kWh - When demand for electricity is moderate (Weekdays: 11 AM – 5PM)
Off-Peak 8.3 cents per kWh - When demand for electricity is lowest (Weekdays: 7 PM to 7 AM, Weekends and Holidays – 24 hours, All Day)
Link to comment

Thanks for the recommendation, PhanTomiZ!  I will dig into this idea.  But I have to say, I envy your rates!!!  Here is California Bay Area, my peak rates are over 36 cents per kWhr!  Your peak rates are well below my off-peak rates!  

Link to comment

Thanks for the recommendation, PhanTomiZ!  I will dig into this idea.  But I have to say, I envy your rates!!!  Here is California Bay Area, my peak rates are over 36 cents per kWhr!  Your peak rates are well below my off-peak rates!  

 

No worries, I understand that they have shut off electricity in SF today.  That will keep the bill down.

 

EDIT: And you are correct, programs with from/to times and nothing else in the "if" will trigger at the from and to times only.  So they will not conflict with each other.  

Link to comment

I use seasonal time filters in Folder conditions. The group of programs can then only run during that season and only one time based filter is required.

 

OTOH: because folder conditions are odd / rare and not easily spotted when browsing programs I use very explanatory folder names eg: "Heating on schedule at home"

This saves me a lot of digging to find why it works a year from now.

Link to comment

Thanks for the recommendation, PhanTomiZ!  I will dig into this idea.  But I have to say, I envy your rates!!!  Here is California Bay Area, my peak rates are over 36 cents per kWhr!  Your peak rates are well below my off-peak rates!  

Crazy thing about rates, is our political leader in Ontario, in her infinite wisdom, decided it to be a good idea to decrease hydro (electricity) cost by 25% as another election boost for her party (personal re-election hopes???).  Heck, our electricity is already subsidized now by the government and unfortunately it will be my kids and theirs who will have to shoulder this burden in the future!!!!

 

Anyhow, I just heard the news about SF power outage.  That is one way to save on your electric bill.  

 

With electricity costs so high, the abundance of sun in your region and the decreasing cost of solar, doesn't this sound like a great alternative?  A PowerWall couldn't hurt either?

 

PhanTomiZ

Link to comment

You could even combine the two programs.

 

If

From 11:30:00PM

To 6:30:00AM (next day)

or

From 4:00:00PM

To 9:00:00PM (same day)

Then

Set 'Scenes-Inside / MBath Towel' Off

Else

Set 'Scenes-Inside / MBath Towel' On

 

The only reason I had 2 programs was that I would keep the 1st one always enabled, but only enable the second one (4-9pm) during summer peak rate season.  While peak rates are used all year long here, it is only during the summer that the difference between peak and non-peak is significant. But yes, I did start with 2 programs just as you say.  Thanks again for the advice!

Link to comment

I see you have v5 installed.

 

I use this variable creator to access dates without year restrictions (wild card).

I use time program kickers to ensure it gets updated after power failures and other glitches.

Set MM.DD - [ID 00B8][Parent 0006]

If
        Time is 12:00:01AM
     Or Time is  3:00:01AM
     Or Time is  6:00:01AM
 
Then
        $sISY.DayOfWeek  = [Current Day of Week]
        $sISY.DayOfMonth  = [Current Day of Month]
        $ISY_Date.scratchpad  = [Current Day of Month]
        $ISY_Date.scratchpad /= 100
        $ISY_Date.scratchpad += [Current Month (Jan=1, Feb=2, etc.)]
        $sISY.MM.DD  = $ISY_Date.scratchpad
 
Else
   - No Actions - (To add one, press 'Action')
 


Then programming around dates is quite easy and permanent. No yearly changes required.

Foyer Christmas Tree - [ID 00BA][Parent 00C0]

If
        (
             (
                  Time is Sunset  - 30 minutes
              And (
                       $sISY.MM.DD >= 11.15
                    Or $sISY.MM.DD <= 1.06
                  )
             )
          Or (
                  Time is  5:00:00AM
              And $sISY.MM.DD >= 12.24
              And $sISY.MM.DD <= 12.26
             )
          Or 'Master Bedroom / MBR KeyPad.C' is switched On
        )
    And 'Master Bedroom / MBR KeyPad.C' is not switched Off
 
Then
        Wait  1 second
        Set 'Foyer / Foyer Christmas Tree' On
        Wait  8 hours 
        Run Program 'Foyer Christmas Tree' (Else Path)
 
Else
        Wait  1 second
        Set 'Foyer / Foyer Christmas Tree' Off
 


Link to comment

 

I see you have v5 installed.

 

I use this variable creator to access dates without year restrictions (wild card).

I use time program kickers to ensure it gets updated after power failures and other glitches.

 GREAT idea!  I was just thinking about the need to keep updating each year and was not aware of this feature in 5.x.  Thanks again...

Link to comment

 GREAT idea!  I was just thinking about the need to keep updating each year and was not aware of this feature in 5.x.  Thanks again...

All the date/time functions are there but they can't be used in the logic. If they were, the ISY engine would have to evaluate every second or minute.

 

Something to be noted:

Dates spanning the end of the year must use OR logic.

Dates spanning inside the year must use AND logic.

 

I've been caught too many times on this so I thought I should mention it. (examples  already in my second program)

 

The decimal was just for looks.

Link to comment

 GREAT idea!  I was just thinking about the need to keep updating each year and was not aware of this feature in 5.x.  Thanks again...

 

Wow, you guys work hard at this!  I'm kinda lazy, so I let Nodelink running on my Rpi handle the heavy date/time lifting.  Thanks io_guy!

post-7363-0-86740100-1493119865_thumb.png

Link to comment

Archived

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


×
×
  • Create New...