Jump to content

Use of If From/For argument


alrolarry

Recommended Posts

I am new to the ISY world. I am trying to turn a light on at a given time and then turn it off again 2 hours latter. Here is my coding:

 

If From Sunset + 45 minutes

For 2 hours

 

 

 

Then set 'Family room lights' 55%

set 'Kitchen lights' 55%

 

 

Else no actions

 

Then lights come on, but have to be manualy turned off. What am I doing wrong?

post-4811-140474157721_thumb.png

Link to comment

The Program has no statements to turn the devices Off. The Then clause is invoked at the From Time because the If evaluates to True. The Program is triggered again at the +2 hours invoking the Else clause because the If is now False. The current time is outside the time range, albeit seconds outside the range, which is why the If is False driving the Else. The Else contains the statements to turn the devices Off.

 

If From Sunset + 45 minutes

For 2 hours

 

Then set 'Family room lights' 55%

set 'Kitchen lights' 55%

 

Else set 'Family room lights' Off

set 'Kitchen lights' Off

Link to comment

If I may make another observation, you may also benefit from a scene. If you were to create a scene (giving the name of you choice) that includes the family room and kitchen lights, as responders, with 55% on levels each, then your program could be even more simplified. It might even be more responsive.

 

if

time if from sunset + 45min

for 2 hours

 

then

set scene on

 

else

set scene off

Link to comment

One other observation, is do you want the lights to ALWAYS turn off 2 hours later, e.g. someone is in the kitchen cutting with a knife and the lights go OFF.

 

Might be a good idea to check for a control of the kitchen light in another program and stop this program from turning them off.

Link to comment

Archived

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


  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.3k
×
×
  • Create New...