Jump to content

Programming Question - Variable for 'nighttime/daytime'?


FrayAdjacent

Recommended Posts

Posted

I had set up several groups of programs to be triggered by buttons on my RemoteLinc, and had several that would execute one program at night, and a different program at day. I did this by doing the control signal ANDed to a time statement that was "from 30 minutes before sunset until 30 minutes after sunrise the following day" for 'night time' and of course the opposite time period for 'daytime'.

 

Well, that ended up executing the program at 30 minutes before sunset for the 'night' programs and 30 minutes after sunrise for the 'day' programs, without any input from the RemoteLinc.

 

I guess the time statement basically ends up meaning "run this program from this time to this time"... so... bollucks. Have to re-think my method here.

 

I decided I'd try to set a variable and use that as a condition in the IF statement of my programs, then have a couple simple programs to set the variable at appropriate times. So I set up a State variable for 'night time' when the value is = 1, and daytime for value = 0.

 

 

Is this the best way to do what I want to achieve? I can't rename the variable... I can double click on the name and type something else, but it won't let me save it at that point.

Posted

Theoretically, I would have thought your first method to be fine. Given that it is not, I am unsure why your second would be any better.

 

There are several methods I could think of to accomplish this goal. One would be folders with conditions based on time. Another would be to use program status, based on time. I can't say that there is an absolute best way, in my mind.

 

Perhaps, if you post your existing program, someone might notice something.

Posted

FrayAdjacent

 

I suggest posting an example of the Time and Control based Program that ran when it should not have. The Variable is adding a complexity that should not be necessary.

 

Lee

Posted

I get what you're saying Oberkc... there's more than likely one way to skin this cat. My first method didn't seem to work. I could see the Program Summary showed the Next Scheduled Run for each of the programs as the next time point (sunset or sunrise).

 

Now that I created a variable, and two programs to set the variable either to 1 or 0 at 30 before sunset and 30 after sunrise, and then changed my programs to use the variable value, it appears to be doing what I want.

 

I'll just have to keep an eye on it, and maybe set some redundancy for the variable state change, so that if there is something like a power interruption, it doesn't flip the bit and end up throwing off my programs.

Posted

Lee, I already edited my programs to use the variable value I created... but here is an example program I created that shows what I was doing with the IF statement:

 

If
       Control 'Controllers / RemoteLinc1' is switched On
   And From    Sunset  - 30 minutes
       To      Sunrise + 30 minutes (next day)

Then
       Set 'Downstairs / Downstairs Lamp' On
       Set 'Downstairs / Downstairs Stat' 70° (Heat Setpoint)

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

Posted

If the Program is as posted it should not run the Then Clause unless the RemoteLinc button is pressed. If it does it is a defect. I’m thinking along the lines of an OR rather than an AND or a Save was missed. Could be a bug but that is a basic IF.

 

I coded this example and traced the results. The trace shows the Program did trigger at From 8:20 PM (20:20) driving the Else which issued an A1/Off. I pressed the RemoteLinc button 3 On a few minutes later which triggered the Program and ran the Then Clause issuing an A1/On. At the To time 8:30 (20:30) the Program was triggered again and ran the Else clause again issuing an A1/Off. The only time the Then Clause ran is when the RemoteLinc button was pressed. If the Program Then Clause runs at other times when the button is not pressed that is the wrong result.

 

 

If

Control 'RemoteLinc-2 - 3' is switched On

And From 8:20:00PM

To 8:30:00PM (same day)

 

Then

Send X10 'A1/On (3)'

 

Else

Send X10 'A1/Off (11)'

 

 

Sun 12/18/2011 08:19:33 PM : [ Time] 20:20:00 0(0)

 

Sun 12/18/2011 08:19:33 PM : [ X10] A1

 

Sun 12/18/2011 08:19:33 PM : [X10-RSP ] 02 63 66 00 06

 

Sun 12/18/2011 08:19:33 PM : [ X10] A1/Off (11)

 

Sun 12/18/2011 08:19:34 PM : [X10-RSP ] 02 63 63 80 06

 

Sun 12/18/2011 08:22:22 PM : [iNST-SRX ] 02 50 11.AD.CF 00.00.03 CB 11 00 LTONRR (00)

 

Sun 12/18/2011 08:22:22 PM : [standard-Group][11.AD.CF-->Group=3] Max Hops=3, Hops Left=2

 

Sun 12/18/2011 08:22:22 PM : [ 11 AD CF 3] DON 0

 

Sun 12/18/2011 08:22:22 PM : [ 11 AD CF 3] ST 255

 

Sun 12/18/2011 08:22:22 PM : [X10-RSP ] 02 63 66 00 06

 

Sun 12/18/2011 08:22:22 PM : [ X10] A1

 

Sun 12/18/2011 08:22:22 PM : [ X10] A1/On (3)

 

Sun 12/18/2011 08:22:23 PM : [iNST-SRX ] 02 50 11.AD.CF 19.70.15 46 11 03 LTONRR (03)

 

Sun 12/18/2011 08:22:23 PM : [standard-Cleanup][11.AD.CF-->ISY/PLM Group=3] Max Hops=2, Hops Left=1

 

Sun 12/18/2011 08:22:23 PM : [X10-RSP ] 02 63 62 80 06

 

Sun 12/18/2011 08:29:33 PM : [ Time] 20:30:01 0(0)

 

Sun 12/18/2011 08:29:33 PM : [ X10] A1

 

Sun 12/18/2011 08:29:33 PM : [X10-RSP ] 02 63 66 00 06

 

Sun 12/18/2011 08:29:33 PM : [ X10] A1/Off (11)

 

Sun 12/18/2011 08:29:34 PM : [X10-RSP ] 02 63 63 80 06

Posted

Lee, thanks for checking. I'm not sure why my unit ran the THEN statements for several of the programs that had a RemoteLinc control ANDed to the time period, but it did. All of the programs I had set up this way had nothing in the ELSE clause. I know at least one or two of the THEN clauses were executed because the thermostats had changed their setpoints.

 

For information, I updated my ISY to 3.1.14 on Friday, and the programs executed yesterday at sunset -30 and again this morning at sunrise +30.

 

 

Now with the variable set up, the Program Summary screen doesn't show anything under the Next Scheduled Run, so as long as my variable gets set correctly, my programs triggered by the RL buttons should function as desired.

 

I'm going to run with it like this for a few days and see how it goes. The only bugger now is that I can't rename the variable. I can doubleclick on the name and change it, but the Save button stays unavailable. I'd like to be able to name it, since I'm thinking about setting a variable for 'Vacation' to then use to disable some of my time based programs.

Posted
I can doubleclick on the name and change it, but the Save button stays unavailable.
Try clicking on another variable, then the one you want to change. It seems the Save button starts out disabled when I first enter a screne, but clicking on a few variables seems to set mine off so I can save changes.
Posted

Sanders, I'll give that a try. Right now, I only have one State variable, so I couldn't try clicking on another then back on this one. Since I want to set up a 'vacation' state variable, I could do that and try your suggestion.

 

I'm at work on a Linux box, and while I can get the admin console up, it doesn't run as well as it does on my Windoze box at home. I'll wait until then to try your suggestion. Thanks!

Posted

Got a little impatient and logged in from work... had to clear the Java cache stuff... seems to help with the admin console in Linux.

 

I added a second variable, and then was able to doubleclick on the first one, change the name, and save it. The second variable let me save the name the first time I doubleclicked on it.

 

 

Darn, I was going to play around with setting up programs for vacation days to disable some of my workday timer programs.... and the Java console disappeared. Guess it's still not too stable. I'll probably just avoid using it at work, or RDP into one of my windows machines at home.

Posted
I could see the Program Summary showed the Next Scheduled Run for each of the programs as the next time point (sunset or sunrise).

 

This is as expected. The program WILL run (else path) at those times.

Posted
Lee, I already edited my programs to use the variable value I created... but here is an example program I created that shows what I was doing with the IF statement:

 

If
       Control 'Controllers / RemoteLinc1' is switched On
   And From    Sunset  - 30 minutes
       To      Sunrise + 30 minutes (next day)

Then
       Set 'Downstairs / Downstairs Lamp' On
       Set 'Downstairs / Downstairs Stat' 70° (Heat Setpoint)

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

 

This program has 3 triggers. This means it will run either the "then" or "else" should any of the following things happen.

 

1) Pushing the "on" on your remotelinc

2) When the time is sunset -30

3) Whent the time is sunrise +30

 

1 - It will eval "true" if the time is between the two above times, "false" otherwise (if you hit the button).

2 - It will always run false at that time since you would need to simultaneously hit the remote linc "on" to run true. (not gonna happen). It will list as a "next scheduled run" in program summary page.

3 - It will run "false" at that time no matter what and also show up as a "next sheduled run."

 

I use a "dark outside" program for lots of things. The program is as follows:

 

If
       From    Sunset  - 15 minutes
       To      Sunrise + 15 minutes (next day)

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

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


 

I include the "true" or "false" status of that program as a condition of other programs. It works quite nicely and saves me a little extra coding (one line vs two) on all those programs that run at night only. Otherwise it works exactly the same as if you had put the times into each program. The program runs twice per day and the program status changes. The change in status is a trigger so any program that refrences it will run, checking the other conditions, and going either "true" or "false".

Posted

Apostolakisl,

 

I understand now... the "from this time to that time" is more like "starting the program (THEN) at the 'from' time, and ending (ELSE) at the 'to' time."

 

Makes sense to me now. ANDing that with a control signal should result in the THEN statement not running unless it is after the first time, before the second time, and the button is pressed.... and the ELSE statement would run at least at the TO time value.

 

Problem was, at least two of the programs I had set up like that were running the THEN statement at the FROM time value without a button press.

 

 

I think the variable I came up with will work just fine. Thanks for the input, it helps me understand the programming a bit more!

Guest
This topic is now closed to further replies.

×
×
  • Create New...