Jump to content

basic programing


bmiller

Recommended Posts

Posted

I'm new to this programing thing and need direction. I'm just trying to set a basic timer for a light. I have a timer set up and the light turns on, but not off. I thought it might be the cfl bulb, so i took it out and set the timer again, but the same result with no bulb in the lamp. I'm sure this is an easy fix, and once i get the hang of it, i'm sure it will be easy. I've attached a screen capture. I can toggle it off from the console ok with or without the cfl bulb installed, so i am sure it is just a programing problem. Thanks for the help.

Brad

post-4005-140474156141_thumb.jpg

Posted

Thanks. I thought of that, but i was hoping the from and to schedule would do the trick. If i need a second program to turn it off then i'm not sure what that is for. I need some examples to give me a better idea.

Brad

Posted

The Else runs whenever the If is False. Because the device Status is being checked in the If and changed in the Then the Program is triggered again when the Status changes to ON except now the If is False so the light immediately turns Off.

 

Simple solution is to add a Set 'xxxx' Off in the Else and remove the device Status check. That way when the Program is triggered at the 5 minute mark the Else will run and turn the device Off.

Posted

You need to understand how

 

"from. . .to" and

"from . . . for"

 

statements work as well as triggers.

 

These statements act as triggers twice. Triggers cause the program to run and will always result in either the "then" or "else"clause executing.

 

1) The first trigger is the "from" time. Provided there are no other statements that are false, the program evaluates to true and the "then" clause runs.

2) The second trigger is the "to" time (or the from time plus x minutes/hours. . ). The program runs again and at this time will evaluate to false no matter what else is in the program. When a program runs and evaluates to false, the "else" clause runs.

 

Pearls:

1) The program does not assume that just because you turned it on in the "then" clause, that you want it to turn off in the "else" clause. You must state it. You must tell it what to do when the time expires (like turn the light off). This opens up more options for you since maybe you would want a different scene to execute when the time runs out.

2) Any other statements in the "if" clause may also cause the program to run. If other statements cause it to run in between the two times, provided everything else is true, it will run the "then" clause. If anything in the "if" clause is not true, the "else" clause runs.

Posted

I'm starting to get around the logic. It reminds me of the old binary logic that the telephone switchgear used when i worked for Bell many years ago. If the if is true then the then happens. If the if is false then the else triggers. One's and zero's. I understand why the initial staemnet didn't work. There was no trigger to turn it off. I assumed it would automatically turn off after 5 minutes, but as you say it needs to be told to do it. Once i get a few of these simple programs working, i'll move on to more complex programs. Thanks again.

Posted

I see no practical reason to check light status as a condition.

 

If
Time is from 1240
To 1245

Then
Turn light on

Else
Turn light off

Posted

bmiller,

 

I'm probably not the best to give advice, but because I have recently made the same mistakes that you are making, I thought I'd chime in.

 

Your program would stop at the first line, if the " Light Living Room" is already "On". This may or may not be what you want. Because you said that you just wanted a "basic timer", I'll assume that you do not care what the status is at 12:40pm. You want the program to run regardless of the status.

 

 

If
       From    12:40:00PM
       For      5 minutes 

Then
       Set 'Light Living Room' On

Else
       Set 'Light Living Room' Off

 

I am very new to ISY programming also, and although very frustrating, it is very rewarding when you finally figure it out!

 

hyounker

Posted

Lee, i set the timers as you suggested as a trial and it worked great. I've since set up 2 lights to come on at sunset, and turn off at a preset time. I'd like to have a random off time for the times we aren't home. i believe i use the wait time with random box checked. Does it go in the else section after the command to shut the light off?

post-4005-140474156142_thumb.jpg

Posted
I see no practical reason to check light status as a condition.

 

 

I do have situations where I want an automated lighting event to be cancelled if the light is already on. I assume that the light is on for a reason and thus I wouldn't want it to shut off.

 

To do this properly, however, requires 2 programs. If you do it as a single program, then the program will actually shut the light off at the "on" time since the light status would be "on" at the "from" time. . . the "if" would be false. . . and the "else" would execute.

 

As 2 programs it would be like this

 

If
 time is 12:40
 and status light is off
Then
 run program 2 then clause
Else
 blank

Program 2
If
  blank
Then
  set light on
  wait 5 minutes
  set light off
Else
 blank

 

EDIT:

Another pearl to the newbie:

You might think, why not use the "wait" command in the first program? The reason is as follows: Programs in the midst of a "wait" will be cancelled if something in the "if" section is triggered. So, in this case, the "status" statement would trigger if something changed the status of the light (manually or via a program), the "wait" would be terminated and the "else" clause would execute. But having the "wait" execute in a second program prevents the "wait" from terminating since that program has no triggers (the "if" is blank). The "wait" can only be terminated by another program doing a "run then" or "disable" or "stop" or "run else" of program 2 (or you could manually do the same). Whenever you use a "wait" command, you generally will need to break it into 2 programs. The exception to this is when the "if" section contains no statements that might trigger during the "wait". The same holds true when using the "repeat" function.

Posted

bmiller

 

Add the Wait with the Random option as the first line in the Else clause, before the command to turn the light(s) Off. There will be a Random Wait time before the Action statement to turn the lights Off.

 

Else
       Wait  10 minutes  (Random)
       Set 'LampLinc DB' Off

Posted
I do have situations where I want an automated lighting event to be cancelled if the light is already on. I assume that the light is on for a reason and thus I wouldn't want it to shut off.

I did not mean to suggest that there are never reasons to check status, but, rather, in this case. The stated goal is simply to turn them on at a certain time, then turn them off at another time.

 

I believe hyounker has the best approach given the stated desires.

Posted

In this case i want the lights to run at the scheduled times, and if the light is already on for some reason, i assume the program will run and keep it on. If it is shut off by the keypadlinc, or remotelinc before the scheduled off time, then i assume it will stay off. The wait and random time line i want to add reads to me like it will always be 10:30 -10:40 random shutoff times. Is there a way to set the random aspect + or - around the 10:30 mark, or do you just right it as say normal shutoff at 10:20, and then add the wait and random line for 20 minutes, so in the end the light shuts off randomly between 10:20 and 10:40. That seems easy enough, but i gather there is more than one way to do this.

Posted

bmiller

 

Your idea is correct to change the To time to 10:20 with a Random Wait of 20 minutes. There is no facility that defines a Time where the Random activity happens before the defined time.

Posted
, and if the light is already on for some reason, i assume the program will run and keep it on. If it is shut off by the keypadlinc, or remotelinc before the scheduled off time, then i assume it will stay off.

Yes

Posted
In this case i want the lights to run at the scheduled times, and if the light is already on for some reason, i assume the program will run and keep it on. If it is shut off by the keypadlinc, or remotelinc before the scheduled off time, then i assume it will stay off. The wait and random time line i want to add reads to me like it will always be 10:30 -10:40 random shutoff times. Is there a way to set the random aspect + or - around the 10:30 mark, or do you just right it as say normal shutoff at 10:20, and then add the wait and random line for 20 minutes, so in the end the light shuts off randomly between 10:20 and 10:40. That seems easy enough, but i gather there is more than one way to do this.

 

Realize that if the light is already on, the program will keep it on.. . until the off time. So if it were a table lamp that someone turned on to ready a book, it would shut off at the end time even if it was already on at the start time. This may or may not be what you want.

Guest
This topic is now closed to further replies.

×
×
  • Create New...