Jump to content

Flash Lights using Repeat function


Skripo

Recommended Posts

Hello,

 

I am trying to set up a non-togle KPL 6 B button to trigger to flash a specific light 20 times using on and off commands when triggered. I put it in non toggle so I can set it to off condition after the repeat, which I cannot seem to find by the way.

 

My question is how do I break out of the repeat loop so it can execute the next command once?

 

Can that even be done or do I need to create another program to execute the repeat from within a master program?

 

Lastly, the KPL buttons do not seem to be controllable from within ISY except for backlighting. How do I set the button to off after the repeat? Do I have to create a scene for the button and use that to turn it off?

 

Lastly, I would love it if the lights return to their original state after the flashing stops. Should I do that in the if statement and the original state of the light will be set at the end of the then or else execution?

Link to comment

"how do I break out of the repeat loop"

 

The Repeat loop will repeat 20 times to flash the light assuming that is the repeat count. The next statement will execute after the repeat finishes. Do you want to cancel the repeat look so it does not flash 20 times? If that is the requirement what activity indicates the loop should be canceled, a different button press, etc.

 

Each time a Repeat is encountered the If condition is reevaluated. Assuming the Repeat is in the Then clause should the If turn False the Repeat is stopped and the Else would then run.

 

" How do I set the button to off "

 

Secondary KeypadLinc buttons cannot be turned On/Off directly. The KeypadLinc button must be assigned as a responder to an ISY Scene and control the Scene Off or On.

 

"I would love it if the lights return to their original state"

 

Insteon has no function to return a device to a previous state.

Link to comment

No desire to break out of the repeat loop.

 

When you say it will execute the next statement, you mean in the else statement right? If I could execute the next command in the then statement that would be much better, something like this:

 

 

If

Status 'Dining - B' is On

 

Then

Repeat 5 times

Set 'Kitchen Table Master' On

Set 'Kitchen Table Master' Off

Next statement

Etc.

Etc.

 

Else

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

 

Is this possible? I see no way to break out of the repeat for following commands.

Link to comment

Skripo,

 

As far as your last question is concerned, not sure if this will help you or not but I have my front porch lights flash twice when the home alarm is armed. I use a variable to track whether the lights were on or off. Based on the state of the variable one of 2 programs runs.

 

I didn’t use the repeat but you can modify as you see fit. The$iFront_PorchLites_On variable is an integer so it will not trigger the program when it changes state so the only trigger is the “Alarm is Armed."

 

This program will run if the lights are currently off when the alarm is armed.

 

If
       $iFront_PorchLites_On is 0
   And 'Alarm is armed’ 

Then
       Wait  1 second
       Set Scene 'Scenes / Front Yard / Frnt Porch Lites' On
       Wait  0 seconds
       Set Scene 'Scenes / Front Yard / Frnt Porch Lites' Off
       Wait  0 seconds
       Set Scene 'Scenes / Front Yard / Frnt Porch Lites' On
       Wait  1 second
       Set Scene 'Scenes / Front Yard / Frnt Porch Lites' Off

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

 

 

This next program is similar to the first but will only trigger when the lights are currently On when the alarm is armed.

 

If
       $iFront_PorchLites_On is 1
   And control ‘Alarm is Armed’

Then
       Wait  1 second
       Set Scene 'Scenes / Front Yard / Frnt Porch Lites' Off
       Wait  0 seconds
       Set Scene 'Scenes / Front Yard / Frnt Porch Lites' On
       Wait  0 seconds
       Set Scene 'Scenes / Front Yard / Frnt Porch Lites' Off
       Wait  1 second
       Set Scene 'Scenes / Front Yard / Frnt Porch Lites' On

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

Tim

Link to comment

The end of a Repeat loop is indicated by another Repeat with a loop count of 1. The statements after Repeat 1 time will be executed once. The UDI Wiki has some good examples for each type of Program statement.

If
  - No Conditions - (To add one, press 'Schedule' or 'Condition')

Then
       Repeat 2 times
          Set 'ICON Dimmer 1' On
          Wait  2 seconds
          Set 'ICON Dimmer 1' Off
          Wait  2 seconds
       Repeat 1 times
          Set 'KPL Floor Dimmer 6 button' On
          Set 'KPL Floor Dimmer 6 button' Off

Else

Link to comment
The end of a Repeat loop is indicated by another Repeat with a loop count of 1. The statements after Repeat 1 time will be executed once. The UDI Wiki has some good examples for each type of Program statement.

If
  - No Conditions - (To add one, press 'Schedule' or 'Condition')

Then
       Repeat 2 times
          Set 'ICON Dimmer 1' On
          Wait  2 seconds
          Set 'ICON Dimmer 1' Off
          Wait  2 seconds
       Repeat 1 times
          Set 'KPL Floor Dimmer 6 button' On
          Set 'KPL Floor Dimmer 6 button' Off

Else

 

AHHHH, I never knew that. I always used two programs. I kept trying to figure out how to "un-indent".

 

Personally, I think this is kind of poorly done. I think a repeat should only apply to the next line unless you use parenthases.

Link to comment

So here is what I came up with, the then and else run fine. My only problem is how to get the darned KPL button to turn off. How can you tell a specific button to turn off? Is it even possible to tie a button to a program?

 

If I try a scene it will loop, so what I need is a statement for XXXXX. I hope this approach is not doomed.

 

If

Status 'Dining - B' is On

And Status 'Kitchen Table Master' is Off

 

Then

Repeat 5 times

Set 'Kitchen Table Master' On

Set 'Kitchen Table Master' Off

Repeat 1 times

Set 'Kitchen Table Master' Off

XXXXXX

Else

Repeat 5 times

Set 'Kitchen Table Master' Off

Set 'Kitchen Table Master' On

Repeat 1 times

Set 'Kitchen Table Master' On

XXXXX

Link to comment

Assign the KeypadLinc button to an ISY Scene as a Responder.

 

In the Program Set "scene with KPL button' Off.

 

The loop is the result of the way the program is coded. Whenever a Wait or Repeat statement is encountered the If is reevaluated. When something in the Program changes the conditions checked by the If the program is triggered again and either the Then or Else is run depending on whether the If is now True or False. This result has nothing to do with using a Scene to turn a Secondary KeypadLinc button Off. Anything the Program does to change the conditions in the If produces the same results.

 

The normal solution is to break the program into 2 Programs. Program 1 has the If statement, Program 2 has the execution logic. That way Program 1 is not reevaluated because it has not Wait or Repeat statements.

 

Another approach is to use If Control rather than If Status. If Control is dependent on actual command flow from the device so the True/False status is not affected by changes the Program makes to device Status.

Link to comment

Archived

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


  • Recently Browsing

    • No registered users viewing this page.
  • Who's Online (See full list)

    • There are no registered users currently online
  • Forum Statistics

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