Jump to content

On/Off loop in programs


xgfreon

Recommended Posts

When i create programs to change the status of a switch or keypad link which way is the best?

the scenario i have is when verbally having Alexa turn on said device I want all switches that also control that device to change to the same state. What i have been using works for the most part but sometimes it goes into an on/off loop and I have to disable the program for a minute. At first i thought it was just when rebooting the polisy but i changed to not enable at startup and have caught this same program looping if someone just pushed the on button funny. Maybe add a wait 5s to the else line?

image.thumb.png.367900f931c6b01efa877a76112c5a32.png

Link to comment

This program would, under certain circumstances, cause a "loop".  For example, if your keypad link device is currently off, and you ask Alexa to turn it on (forcing an execution of the THEN action), the program would trigger itself and run again.  I must admit I don't see the value of this program.  Basically, it seems that it is saying "if a device is on, then turn it on, otherwise turn it off".

1 hour ago, xgfreon said:

the scenario i have is when verbally having Alexa turn on said device I want all switches that also control that device to change to the same state.

I would handle this with a scene.  Put all switches in the scene that you want to control the device.  When you ask Alexa to turn on/off the device, create a routine that responds by turning on/off the scene.

Link to comment

Edit... I don't think this is what you want, but I left here just in case... see my next post for solution to what I think you are asking.

You need to use two programs. Here is example where a button on Zen32 toggles a light on/off. Note my documentation..

The program that does the actual toggle needs to be disabled so it does not trigger itself.

-----------------------------------------------------------------------------------
Button1 SW - [ID 00C0][Parent 00D8]

If
        'Test / ZY Zen32 Scene Button 1' is switched On
 
Then
        Run Program 'Button1 Toggle Light' (If)
 
Else
   - No Actions - (To add one, press 'Action')
 
Toggle Light on/off in program "Button1 Toggle Light" when Zen32 Button 1 is pressed.


-----------------------------------------------------------------------------------
Button1 Toggle Light - [ID 00C1][Parent 00D8][Not Enabled]

If
        'Computer Room / Computer Room Closet' Status is Off
 
Then
        Set 'Computer Room / Computer Room Closet' On
 
Else
        Set 'Computer Room / Computer Room Closet' Off
 
Performs the actual toggle called by Button1 SW.
This program needs to be disabled otherwise it will trigger itself and run endlessly in race condition.

 

Edited by brians
Link to comment

 

Oh I re-read your post again and I think I misunderstood what you want to do. I was thinking of toggling a switch on/off using one ON command. I left here anyways for reference.

If I understand correctly... you have a scene with two or more Insteon switches. However when you control the actual switch using Alexa (or even in Admin Console etc) the way Insteon works is it does not update the other switches in the scene.

This has been discussed before over the years, but what you want to do is just turn on/off the other switches in the scene based on the actual load device state (ie. the switch that controls the light)...

Here is a program that keeps a remote switchlinc that is in a virtual 3-way scene in sync when I turn on/off the actual switchlinc that is the load using AC or something like Alexa.

Front Hallway - [ID 0036][Parent 0033]

If
        'Entrance / Front Hallway' Status is On
 
Then
        Set 'Entrance / Front Hallway Slave' On
 
Else
        Set 'Entrance / Front Hallway Slave' Off
 

In the case of keypadlincs, there is no way to turn them on/off directly and the workaround is they must instead be put in a scene as a responder to be able to be turned on/off.

Here is another program with upstairs hallway but also has a keypadlinc button.

Upstairs Hallway - [ID 004C][Parent 0033]

If
        'Upstairs / Upstairs Hallway' Status is On
 
Then
        Set 'Upstairs / Upstairs Hallway Slave' On
        Set 'KPL Sync LED scenes / EC Upstairs Hallway KLD' On
 
Else
        Set 'Upstairs / Upstairs Hallway Slave' Off
        Set 'KPL Sync LED scenes / EC Upstairs Hallway KLD' Off
 

And the scene that controls the Keypad Linc looks like...

Among tons of other scenes controlling all keypads LEDs.1134926127_Screenshot2023-02-03at9_05_32PM.thumb.png.7b4fa0be575b4457337a2451f99222f5.png

You can also sync dimmers using a variable too eg.

Chandelier - [ID 004D][Parent 0033]

If
        'Entrance / Chandelier' Status >= 1%
 
Then
        $Dim_Level_Temp  = 'Entrance / Chandelier' Status 
        Set 'Entrance / Chandelier Slave' On '$Dim_Level_Temp %'
 
Else
        Set 'Entrance / Chandelier Slave' Off
 
This program sets the SwitchLinc dimmer to proper dim level. Requires a temp variable to hold the status and set it.

 

Note that if you press the actual switches, the scenes set the state of all the buttons, but these are for when you turn on/off a light using Alexa. I hope this this what you are asking.

 

Link to comment

Thanks, I have yet to play with variables. I realize now that I do have most these in scenes, especial to get keypad Linc status to change. I didn't realize that in most cases I should have my Alexa command just switch on the scene rather than the switch. That will probably fix the few that are giving me the issues. Thanks for leaving me some ideas, now I will have to mess with getting those dimmer status to sync as well.

Link to comment
Guest
This topic is now closed to further replies.

×
×
  • Create New...