Jump to content

Super dumb if-then-else question


creeble

Recommended Posts

Posted

This has probably been asked a dozen times, but I don't seem to find the concise answer here.

 

If I want a light or scene to come on between two times, and otherwise be turned off, is it simple and correct enough to write a program:

 

If time is From xxxx to yyyyy

Then

Scene on

Else

Scene off

 

or is this incorrect? Also, does this work equally well for x10 on and off commands (even without the x10 plugin)?

 

If this works, how is this if/then/else actually evaluated? I.e., although the "then" clause is true between the two times (and false outside them), is each clause run only ONCE?

 

Eric.

Posted

Hello creeble,

 

No such thing as a dumb question!

 

In order for a program to run it either needs to be called by another program or it needs a trigger in the If section. In your example the trigger is the from time or the end time. Each time is a trigger and your program will run exactly twice a day. First when the time strikes xxxx the program will evaluate true and turn the scene on. The second time the program will run is when the time strikes yyyy when the program will evaluate false and turn the scene off.

 

Each time a program is triggered or evaluated it is said to run. It either runs true or it runs false.

 

This program will work for X10 as well, even without the X10 module.

 

Tim

Posted

One of the consequences is that if the "scene" is turned on by another mechanism (manually, other program) between time yyyy and xxxx, it will stay on. If this "scene" is turn off by another mechanism between time xxxx and yyyy, it will stay off. This program does not enforce the scene being on or off, other than at those two specific "from" and "to" times.

Posted
One of the consequences is that if the "scene" is turned on by another mechanism (manually, other program) between time yyyy and xxxx, it will stay on. If this "scene" is turn off by another mechanism between time xxxx and yyyy, it will stay off. This program does not enforce the scene being on or off, other than at those two specific "from" and "to" times.

 

Another way to say this would be that this:

 

If
       From     7:00:00AM
       For      1 hour 

Then
       Set 'light' On

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


 

Would be the same as these two programs:

 

If
       Time is  7:00:00AM

Then
       Set 'Light' On

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


If
       Time is  8:00:00AM

Then
       Set 'Light' Off

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




Posted

As TJF1960 indicates, this program executes true at 5 pm and false at 8 pm.

If
       From     5:00:00PM
       To       8:00:00PM (same day)
Then
       Set 'Outdoors / Out Entry 12.48.1E.1' On
       Send X-10 'A1/On (3)'
Else
       Set 'Outdoors / Out Entry 12.48.1E.1' Off
       Send X-10 'A1/Off (11)'

If light is turned off another way after 5 pm, it will stay off. If light was turned on after 8 pm, it would stay on until 8 pm next day (unless turned off another way).

 

To address the time between 8 pm and 5 pm (next day) the following would turn the light off if it was turned on after 8 pm.

If
       From     8:00:00PM
       To       5:00:00PM (next day)
   And Status  'Outdoors / Out Entry 12.48.1E.1' is On
Then
       Set 'Outdoors / Out Entry 12.48.1E.1' Off
       Send X-10 'A1/Off (11)'
Else
  - No Actions - (To add one, press 'Action')

You do not need the X-10 module to send an X-10 command.

Guest
This topic is now closed to further replies.

×
×
  • Create New...