Jump to content

If Then Statements and variables


kswison

Recommended Posts

I have a basic programming question using my Thermostat with my ISY

 

I have a general program that basically sets the house temperature to 23* (using * for degrees symbol in this forum)

Set '1F.15.B9 - Main' 23* (Heat Set Point)

$House_Heat_SetPoint = 23

 

So then, I want a number of other programs to change the house temp at different times of day, like below.

 

IF

On Sun, Mon, Tues, Wed, Thurs

from 11:00pm

To 7:30am

 

THEN

Set '1F.15.B9 - Main' 18* (Heat Set Point)

$House_Heat_SetPoint = 18

 

This is to drop the temp at night or work hours, etc. It appears to drop the temp during those hours. And seems to set the temp back to 23* once out of that time period.

During those hours I want to have the variable $House_Heat_SetPoint set to 18 (or what ever the scheduled program sets it to), but then I want it to set the VARIABLE back to 23 at the end of the time period.

 

My question is, when this IF/THEN operates within a scheduled time period, does it only change the VARIABLE for the scheduled time frame for which it operates within, then changes back once the time period expires, or does it simply change the VARIABLE once and leave it at that.

 

If it does change the VARIABLE back once the time period expires, what does it change it back to ? Did it store the previous value somewhere ?

 

I guess that goes for the Thermostat as well. If the ISY changes the temp temporarily, does in know to turn back to the previous 23 degrees ? Or is that my other program that is setting it back to 23 ?

 

This is a very basic programming question, but I am new to this. Thanks for your help.

Link to comment
My question is, when this IF/THEN operates within a scheduled time period, does it only change the VARIABLE for the scheduled time frame for which it operates within, then changes back once the time period expires, or does it simply change the VARIABLE once and leave it at that.

 

I am actually surprised this program returns your temperature to the original temperature at the end of the period.

 

if

from time A

to time B

then

do something

else

do something else

 

Programs like this work such that at TIME A run the THEN clause, at TIME B run the ELSE clause. If you want it to change the temperature and the variable, you have to specify both, in each clause. Since your program had no ELSE clause, I don't believe it was this program which caused the return to the original temperature.

Link to comment

Thanks, I think you are correct, in that I think the original program "SET_TEMP" that set the generic temp of 23* took over and ran correcting the temp after the time period defined in the second program (NIGHT_OVERRIDE) ended.

 

I have found a way around this. Or to correct it.

 

I took the same program (NIGHT_OVERRIDE) and added the ELSE to run the original program 'SET_TEMP" that sets the temp and other variables back to 23*

 

That seems to work. I changed the end of the time B to a minute in the future to watch it flip over and it all seems to work. I watched in switch over the variables.

 

Thanks. I didn't think it stored previous values of the variable. That explains that.

 

Kev

Link to comment

If the value in the variable is of any importance look into setting the variable Init value at the same time the variable value is changed. Should the ISY reboot due to a power outage etc the variable Init value is what the variable value is set to during the restart.

Link to comment

Awesome !!! Thanks.

 

I have had this thing power failure out and loose all the setting and nothing works after until I had re-set it. Was driving me nuts.

 

So, I wrote another program to evaluate all the critical VARIABLES to see if they made sense or were set to '0', and if they were set to '0', which certain ones are not to be, then the program ran a THEN series of statement that reset all my variables. That seemed to be working, but this is way easier.

 

Thanks again. That makes sense and will help out a bunch.

I have already changed a few programs.

 

Going to have to go through my programming again. I can see I will be able to delete a bunch of these silly little programs that I created to preset these variables.

 

Thats the issue of being a newbie at this programming stuff. But its getting better! Thanks again.

Link to comment

Archived

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


×
×
  • Create New...