Jump to content

Run if ON, stop if OFF


to_lighter

Recommended Posts

Posted

Hi gang,

 

I have a program that I want to run when a dimmer is turned on, but I want the program to terminate if the dimmer is turned off. This particular dimmer can be turned off remotely as part of a scene.

 

I can add logic like this to the condition that determines if the program will run:

 

If Control dimmer1 is switched ON

and Control dimmer1 is not switched OFF

Then ...

 

However, if I am correct, then this program will continue to run if the dimmer is turned off remotely as part of a scene.

 

Would this be better?

 

If Control dimmer1 is switched ON

and Status dimmer1 is not OFF

Then ...

 

Cheers!

Posted

Whoops.

 

That doesn't work :(

 

If Control dimmer1 is switched ON

and Status dimmer1 is not OFF

Then ...

 

This will never evaluate to be true. If the light is OFF, then this statement will not be TRUE when dimmer1 is switched ON.

 

What I ended up doing is splitting my program into a couple of smaller ones. The first program runs when I turn dimmer1 ON. It turns on a scene and then runs the THEN path of a flag program to turn it TRUE.

 

The second program only runs when the flag program is TRUE. It consists of a WAIT 2 minutes statement, then it triggers a scene that adjusts the lights in the area.

 

A final program runs when dimmer1's status is OFF. It runs the ELSE path of the flag program.

 

By using this technique, turning off dimmer1 either directly or indirectly as part of a scene will interrupt the WAIT 2 minutes and terminate that program.

 

Cheers!

Guest
This topic is now closed to further replies.

×
×
  • Create New...