Jump to content

Implementing countdown for each light switch


cslee

Recommended Posts

Posted

Does anyone have a great programming idea to make every switch a countdown?

 

I.e.

(1) user turns on the light at the switch paddle

(2) ISY sees this switch-on command

(3) ISY stores the current_time and adds a certain amount of mins to a variable, say lightA_offtime

(4) If current_time > lightA_offtime, then turn off lightA.

(5) additionally if user press the light switch on paddle twice, it cancels the lightA_offtime.

(6) if user turns off switch at paddle before lightA_offtime expires, cancell the lightA_offtime.

 

I'll like to implement this for all light switches.

 

The current_time can be a variable that increments every 30 secs. needs to account from wrap-around.

I wish this can be a built-in function in ISY.

Posted

This is one approach within the function that exists today. Program TimerOffLightA establishes the duration of On with the Wait. If the Wait of 5 minutes completes SwitchLinc will turn Off. If the SwitchLinc is manually turned Off the Wait is cancelled and the Program ends. If the SwitchLinc paddle is double tapped sending a Fast On the Wait is cancelled and the Program ends.

 

Program “TimerOffLightAâ€

 

If
       Status  'SwitchLinc Dimmer' is On
   And Control 'SwitchLinc Dimmer' is not switched Fast On

Then
       Wait  5 minutes 
       Set 'SwitchLinc Dimmer' Off

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

Posted

Here is how I do it. This particular style accounts for all the different things someone could do to the light switch to make it not be off no matter what the starting condition is. It also beeps for the last minute warning you the light is about to go off. The program resets the timer if someone does anything to the switch no matter what the starting condition or the finishing condition (except off).

 

If
       Control 'Alexis Room / Alexis BR-Overhead L' is switched On
    Or Control 'Alexis Room / Alexis BR-Overhead L' is switched Fast On
    Or Control 'Alexis Room / Alexis BR-Overhead L' is switched Fade Up
    Or Status  'Alexis Room / Alexis BR-Overhead L' is not Off

Then
       Wait  29 minutes 
       Repeat 60 times
          Set 'Alexis Room / Alexis BR-Overhead L' 14 (Beep Duration)
       Repeat 1 times
          Set 'Alexis Room / Alexis BR-Overhead L' Off

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


 

If you wanted "fast on" to not run the program then you would need a second program to cover all bases. First off, delete the line about fast on from this program. Then write a second program that says

 

 
If
        Control 'Alexis Room / Alexis BR-Overhead L' is switched Fast On

Then
       wait 1 second
       stop the first program
Else
  - No Actions - (To add one, press 'Action')


 

The second program is necessary in the event that someone fades down the light but stops short of "off". If you dropped the "status not off" line which would be necessary to have the "fast on" not activate the program, then you would have to add "fade down". But if someone faded down all the way to off, the program would run and 29 minutes later it would beep at you unnecessarily.

Guest
This topic is now closed to further replies.

×
×
  • Create New...