Jump to content

X10 Command Received Infinite Loop


btreinders

Recommended Posts

I was wondering if anyone has a solution to my issue.  I have an 8-button keypadlinc and two of the buttons run X10 lights.  I would like to be able to make sure the LED stays in-sync with the state of the light.  I created a program to turn the light on and off using X10 commands sent from the ISY when the button is pressed.  I do not have the button itself responding to received X10 commands because in the manual it states that can create unwanted reception issues.  From the manual:

"If you are no longer going to utilize an X10 address associated with KeypadLinc, it is very important that 

you remove its X10 address. Otherwise, KeypadLinc will still listen for X10 commands (somewhat 
hindering INSTEON reception) and may respond to spurious X10 “noise” which is unavoidable. 
Furthermore, KeypadLinc will transmit an X10 address and command every time the button is tapped."
 
So, based on that info from the manual I removed the X10 address from the buttons and just use programs based on the insteon signal to send out an X10 signal instead.  One issue with this comes when another X10 controller sends out a command and the LED on the Keypadlinc does not turn on indicating the status of the light.  So I created a program that would look for an X10 on command received and turn on the LED. I also created one to look for an X10 off command and turn off the LED. Now, when I send an off and then on or vice versa, the ISY receives the signal it sent out and then loops infinitely.  I have tried timers, program status, everything I can think of to stop the looping with no success.  It seems that once the ISY receives an X10 signal there is no way to stop it from acting on it.  Thanks so much in advance for any help. 
 
Here are the programs:
 
 
 
Program that looks for the button to be pressed.
 
<Cabinet Lights - D>
 
If
        Status  'KP Button - D - Cabinet Light' is 100%
    And Status  'KP Button - D - Cabinet Light' is not Off
 
Then
        Run Program 'Cabinet Lights - A15' (Then Path)
 
Else
        Run Program 'Cabinet Lights - A15' (Else Path)
 
Program that actually turns the light on or off.  The resource is to keep the X10 controller in sync for widget use. It also sends out an X10 A15 on or off signal.
 
<Cabinet Lights - A15>
 
If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Send X10 'A15/On (3)'
        Wait  1 second
        Resource 'Cabinet Lights On'
 
Else
        Send X10 'A15/Off (11)'
        Wait  1 second
        Resource 'Cabinet Lights Off'
 
Program that receives the X10 off signal:
 
<Cabinet Lights Off X10 Signal Received>
 
If
        X10 'A15/Off (11)' is Received
     Or X10 'A/All Units Off (13)' is Received
     Or X10 'A/All Lights Off (1)' is Received
    And (
             Status  'KP Button - D - Cabinet Light' is 100%
         And Program 'Cabinet Lights On X10 Signal Received' is False
         And $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER is 0
        )
 
Then
        Stop program 'Cabinet Lights On X10 Signal Received'
        Set Scene 'Scenes / KeypadLinc / KeypadLinc LEDs / KeypadLinc LED - D' Off
        $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER  = 1
 
Else
   - No Actions - (To add one, press 'Action')
 
Program that receives the X10 On signal.
 
<Cabinet Lights On X10 Signal Received>
 
If
        X10 'A15/On (3)' is Received
     Or X10 'A/All Lights On (5)' is Received
    And (
             Status  'KP Button - D - Cabinet Light' is Off
         And $KEYPADLINC_D_CABINET_LIGHTS_ON_TIMER is 0
         And Program 'Cabinet Lights Off X10 Signal Received' is False
        )
 
Then
        Set Scene 'Scenes / KeypadLinc / KeypadLinc LEDs / KeypadLinc LED - D' On
        $KEYPADLINC_D_CABINET_LIGHTS_ON_TIMER  = 1
        Stop program 'Cabinet Lights Off X10 Signal Received'
 
Else
   - No Actions - (To add one, press 'Action')
 
Program that resets the timer for off.
 
<Keypadlinc_D_Cabinet_Lights_Off_Timer_Reset>
 
If
        $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER is 1
 
Then
        Wait  4 seconds
        $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER  = 0
 
Else
   - No Actions - (To add one, press 'Action')
 
Program that resets the timer for on.
 
<Keypadlinc_D_Cabinet_Lights_On_Timer_Reset>
 
If
        $KEYPADLINC_D_CABINET_LIGHTS_ON_TIMER is 1
 
Then
        Wait  4 seconds
        $KEYPADLINC_D_CABINET_LIGHTS_ON_TIMER  = 0
 
Else
   - No Actions - (To add one, press 'Action')
 
 
 
 
 
 

 

Link to comment

That is a complicated web you have weaved.  I am not sure that I can even guess everything that is going on there.  I also don't use "resources", so I have no clue what they might do to your programs. 

 

I missed where you described the device that "controls the light".  Is it an X-10 device?  I also missed where you described what (besides the ISY) would transmit an X-10 command.  Are you dimming?  So let me see if I have this straight. 

 

- you have a keypadlinc that you want to use to control a light fixture (button D)

- you have a light fixture on an X-10 device, address A15

- you have some other devices capable of transmitting commands against X-10 address A15

 

Unless I am missing something, this should be relatively simple.  I see too much going on (status rather than control, resources, redundant conditions, etc..) to even try to salvage what you have.  Let's start fresh with a program to send X10 commands in response to the keypad button pressed (ignoring, for now, dim and bright commands): 

 

if

control keypad button D is switched on

and control keypad button D is not switched off

then

Send X10 'A15/On (3)'

else

Send X10 'A15/Off (11)

 

Next, to control a secondary keypad button from the ISY, I believe it necessary to create a scene with the keypad button D as a responder.  I will call it scene D.

 

Finally, create a couple of programs:

 

if

 X10 'A15/On (3)' is Received

     Or X10 'A/All Lights On (5)' is Received

then

set scene D on

else

nothing

 

if

X10 'A15/Off (11)' is Received

     Or X10 'A/All Units Off (13)' is Received
     Or X10 'A/All Lights Off (1)' is Received

then

set scene D off

else

nothing

 

Let me know how this works out.

Link to comment

oberkc,

 

Thank you for the quick response!  I did try your programs and they do work just fine.  I did not know about control as a condition.  I will have to read up on that one.  Once I add the network resource is where things go bad.  The resource sends out an http command to a program running on a PC.  That program in turn sends out an X10 A15 on or off command.  I guess that's where the looping happens.  ISY tells that program to turn on A15 and it receives that command back and acts on it.  I use that program called Active Home Vista to provide usable widgets on my Android phone since Mobilinc does not have a widget that can change it's image based on states. I also use it as a backup in case the ISY signal does not make it to the switch for some reason.  Some switches and units do not always receive the signals from the ISY reliably and vice versa but that's another issue altogether. That's why I chose the ISY and Insteon to migrate with like a lot of other people have.  I still have many X10 devices though.

 

I tried adding timers to your programs using a state variable as a condition to enter the receive programs.  What I see is the receive programs turn solid green (running) even though the state variable condition is not true yet.  Is that possible? I even set the timer for well past when the program on the PC sends out the signal.

 

Here are the three programs now along with one of the timers at the bottom.

 

If
        Control 'KP Button - D - Cabinet Light' is switched On
    And Control 'KP Button - D - Cabinet Light' is not switched Off
 
Then
        Send X10 'A15/On (3)'
 
Else
        Send X10 'A15/Off (11)'
 
 
If
        X10 'A15/Off (11)' is Received
     Or X10 'A/All Units Off (13)' is Received
     Or X10 'A/All Lights Off (1)' is Received
    And (
             $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER is 0
        )
 
Then
        Set Scene 'Scenes / KeypadLinc / KeypadLinc LEDs / KeypadLinc LED - D' Off
        Resource 'Cabinet Lights Off'
        $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER  = 1
        Run Program 'Keypadlinc_D_Cabinet_Lights_Off_Timer_Reset' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 
 
 
If
        X10 'A15/On (3)' is Received
     Or X10 'A/All Lights On (5)' is Received
    And (
             $KEYPADLINC_D_CABINET_LIGHTS_ON_TIMER is 0
        )
 
Then
        Set Scene 'Scenes / KeypadLinc / KeypadLinc LEDs / KeypadLinc LED - D' On
        Resource 'Cabinet Lights On'
        $KEYPADLINC_D_CABINET_LIGHTS_ON_TIMER  = 1
        Run Program 'Keypadlinc_D_Cabinet_Lights_On_Timer_Reset' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 
 
If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Wait  10 seconds
        $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER  = 0
 
Else
   - No Actions - (To add one, press 'Action')
 
 
Link to comment

 

oberkc,

 

Thank you for the quick response!  I did try your programs and they do work just fine.  I did not know about control as a condition.  I will have to read up on that one.  Once I add the network resource is where things go bad.  The resource sends out an http command to a program running on a PC.  That program in turn sends out an X10 A15 on or off command.  I guess that's where the looping happens.  ISY tells that program to turn on A15 and it receives that command back and acts on it.  I use that program called Active Home Vista to provide usable widgets on my Android phone since Mobilinc does not have a widget that can change it's image based on states. I also use it as a backup in case the ISY signal does not make it to the switch for some reason.  Some switches and units do not always receive the signals from the ISY reliably and vice versa but that's another issue altogether. That's why I chose the ISY and Insteon to migrate with like a lot of other people have.  I still have many X10 devices though.

 

I tried adding timers to your programs using a state variable as a condition to enter the receive programs.  What I see is the receive programs turn solid green (running) even though the state variable condition is not true yet.  Is that possible? I even set the timer for well past when the program on the PC sends out the signal.

 

Here are the three programs now along with one of the timers at the bottom.

 

If
        Control 'KP Button - D - Cabinet Light' is switched On
    And Control 'KP Button - D - Cabinet Light' is not switched Off
 
Then
        Send X10 'A15/On (3)'
 
Else
        Send X10 'A15/Off (11)'
 
 
If
        X10 'A15/Off (11)' is Received
     Or X10 'A/All Units Off (13)' is Received
     Or X10 'A/All Lights Off (1)' is Received
    And (
             $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER is 0
        )
 
Then
        Set Scene 'Scenes / KeypadLinc / KeypadLinc LEDs / KeypadLinc LED - D' Off
        Resource 'Cabinet Lights Off'
        $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER  = 1
        Run Program 'Keypadlinc_D_Cabinet_Lights_Off_Timer_Reset' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
 

OK some basics you may need to understand.

 

Status is a program trigger only when the status of a device changes.

Switches is a program trigger only when a signal is sent that can change the status of a device whether the status changes or not.

 

eg:

A lamp is off. status = off

A switch sends a lamp on.

Lamp turns On.  Switches On triggers, Status On triggers

A switch sends an on signal.

Lamp is already On.  Switches On triggers, Status On doesn't trigger

 

Integer and State variables have a similar situation

Integer variables do NOT cause program triggers.

State variables cause triggers unless the program is disabled.

 

In your first program you use a state variable that can stop your program 'Then' execution when it changes

  And (

               $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER is 0

          )

 

When this State variable changes to not 0  (=1 below)  "Else" will immediately run and 'Then' will immediately stop running.

       $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER  = 1

        Run Program 'Keypadlinc_D_Cabinet_Lights_Off_Timer_Reset' (Then Path)

The last line may never run.

Link to comment

If your only concern is the KPL button and everything else works, then

 

If
        X10 'A15/On (3)' is Received
 
Then
        Set Scene 'KPL Button D' On
 
Else
   - No Actions - (To add one, press 'Action')
 

and

 

If
        X10 'A15/Off (11)' is Received
     Or X10 'A15/All Lights Off (1)' is Received
     Or X10 'A15/All Units Off (13)' is Received
 
Then
        Set Scene 'KPL Button D' Off
 
Else
   - No Actions - (To add one, press 'Action')
 
 

Link to comment
Once I add the network resource is where things go bad.  The resource sends out an http command to a program running on a PC.  That program in turn sends out an X10 A15 on or off command.  I guess that's where the looping happens.

 

Yes, I would agree that this is a likely culprit.  I must admit that I don't understand what you are trying to achieve by having an ISY program triggered by an X10 command which issues a resource statement which then issues the same X10 command.  Is it not possible to control your widgets without issuing additional X-10 commands on your power lines?  Also, since you are using insteon to now communicate between the ISY and insteon switches, and you have removed the X-10 address from these insteon switches, there is no value in providing backup communication.

 

If you were to take this step out of your PC program, does this solve your looping problems?

Link to comment

oberkc,

 

Yes taking it out resolves the issue.  I do have to have it issue another command or else the widget will not work to turn the light on and off, it would only provide status.  I guess what I do not understand is how the program can execute when one of the conditions is not true.  Makes no sense to me. 

 

Also, yes the backup is necessary if the ISY cannot reach the X10 device.  I do have a phase coupler and X10 signal amplifier and have done extensive testing to determine that sometimes backup is just necessary.  

 

Thanks!

Link to comment
Also, yes the backup is necessary if the ISY cannot reach the X10 device.  I do have a phase coupler and X10 signal amplifier and have done extensive testing to determine that sometimes backup is just necessary.

 

I am still a little unclear about the extent and types of your devices.  Given that you have eliminated x-10 address (relying, instead, on insteon for this communication) from a few of your keypads, how many devices do you have remaining that occasionally need the repeated x-10 commands?  How flexible is this PC resource...can it send out insteon commands?

Link to comment

I am still a little unclear about the extent and types of your devices.  Given that you have eliminated x-10 address (relying, instead, on insteon for this communication) from a few of your keypads, how many devices do you have remaining that occasionally need the repeated x-10 commands?  How flexible is this PC resource...can it send out insteon commands?

 

I only have one insteon keypad and about 12-14 X10 devices left in the system.  Mostly outlets and lamp modules.  I do have about 15 insteon devices as well.  The PC resource is X10 only.  I only eliminated the X10 address from the keypad based on the statements in the keypad manual about communication issues. That statement is not in other insteon manuals.  I also removed all X10 addresses from all other insteon devices as well just in case.  Maybe I should just go back to having X10 addresses in all my insteon devices? That seemed to work for the most part but I still would see a mis-match between the state of the LED and the state of the light intermittently.  So I read the manual and thought maybe the X10 address was the issue.

 

Do you know why a program can execute when one of the conditions is false?  I would really like to understand that.

Link to comment
Do you know why a program can execute when one of the conditions is false?  I would really like to understand that.

 

All programs execute...it is just a matter of whether the run THEN or ELSE.

 

Depending on the logic employed, it can also not be necessary for all of the conditions to be true for a program to evaluate as true.  For example:

 

"If A or B" can be true even if either A or B is false (but not both). 

 

This is an example that will evaluate true even if "one of the conditions is false". 

 

Do you have a specific example of a program that is not executing as you expect?

Link to comment

I only have one insteon keypad and about 12-14 X10 devices left in the system.  Mostly outlets and lamp modules.  I do have about 15 insteon devices as well.  The PC resource is X10 only.  I only eliminated the X10 address from the keypad based on the statements in the keypad manual about communication issues. That statement is not in other insteon manuals.  I also removed all X10 addresses from all other insteon devices as well just in case.  Maybe I should just go back to having X10 addresses in all my insteon devices? That seemed to work for the most part but I still would see a mis-match between the state of the LED and the state of the light intermittently.  So I read the manual and thought maybe the X10 address was the issue.

 

Do you know why a program can execute when one of the conditions is false?  I would really like to understand that.

I found that my X10 MS units can turn on an Insteon LampLinc quite quickly but the ISY would never know about it. The output of the MS is the only indication something has happened.

 

A program has three (obviously) sections.

The "If" section contains TRIGGERS and some can be turned into conditions to also control the program execution path. When a trigger event occurs the whole If section gets evaluated. Depending the outcome of the logic appraisal of the whole If section the 'Then' or the 'Else' section is executed. One section is always executed for every trigger event.

 

So if you have a STATE variable "Wantit "and a WallSwitch.

 

If

  WallSwitch is switched On

AND

  Wantit = 1

 

When WallSwitch sends a command that it has been turned on and Wantit is 1 then the 'Then' will run. If Wantit is not 1 the "Else" will run.

 

When Wantit changes from anything else to 1, Wallswitch will never be just switched on at the exact same instant so "Else" will always run.

 

 

 

Yeah it takes some swallowing to get used to it but it works well in most cases.

Link to comment

All programs execute...it is just a matter of whether the run THEN or ELSE.

 

Depending on the logic employed, it can also not be necessary for all of the conditions to be true for a program to evaluate as true.  For example:

 

"If A or B" can be true even if either A or B is false (but not both). 

 

This is an example that will evaluate true even if "one of the conditions is false". 

 

Do you have a specific example of a program that is not executing as you expect?

 

Sorry, yes I have a program that is running the "then" section even though the variable in the "if" is not 0 at the same time as it receives the X10 command.

In the program below I can see the program icon going green even when the timer is set to 1.  This is why the program is looping infinitely.  

 

 

If
        X10 'A15/Off (11)' is Received
     Or X10 'A/All Units Off (13)' is Received
     Or X10 'A/All Lights Off (1)' is Received
    And (
             $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER is 0
        )
 
Then
        Set Scene 'Scenes / KeypadLinc / KeypadLinc LEDs / KeypadLinc LED - D' Off
        Resource 'Cabinet Lights Off'
        $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER  = 1
        Run Program 'Keypadlinc_D_Cabinet_Lights_Off_Timer_Reset' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')
Link to comment

 

Sorry, yes I have a program that is running the "then" section even though the variable in the "if" is not 0 at the same time as it receives the X10 command.

In the program below I can see the program icon going green even when the timer is set to 1.  This is why the program is looping infinitely.  

 

 

If
        X10 'A15/Off (11)' is Received
     Or X10 'A/All Units Off (13)' is Received
     Or X10 'A/All Lights Off (1)' is Received
    And (
             $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER is 0
        )
 
Then
        Set Scene 'Scenes / KeypadLinc / KeypadLinc LEDs / KeypadLinc LED - D' Off
        Resource 'Cabinet Lights Off'
        $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER  = 1
        Run Program 'Keypadlinc_D_Cabinet_Lights_Off_Timer_Reset' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')

 

Your parentheses are in the wrong places.

Try this

 

If

    (

    X10 'A15/Off (11)' is Received

     Or X10 'A/All Units Off (13)' is Received

     Or X10 'A/All Lights Off (1)' is Received

    )

     And

             $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER is 0

 

 

In Boolean logic the AND operator takes precedence over the OR operator so that your last X10 trigger was the only one being ANDed with the ....TIMER is 0

Link to comment

Your parentheses are in the wrong places.

Try this

 

If

    (

    X10 'A15/Off (11)' is Received

     Or X10 'A/All Units Off (13)' is Received

     Or X10 'A/All Lights Off (1)' is Received

    )

     And

             $KEYPADLINC_D_CABINET_LIGHTS_OFF_TIMER is 0

 

 

In Boolean logic the AND operator takes precedence over the OR operator so that your last X10 trigger was the only one being ANDed with the ....TIMER is 0

 

larryllix,

 

That was it!  Thank you so much!  I had no idea that it worked that way.  I don't like using a timer since it does delay being able to turn something on and off quickly but I guess for now I will live with it.

 

Also a big thanks to oberkc! I have a much better understanding and will be using the control option in the future instead of status.

Link to comment

larryllix,

 

That was it!  Thank you so much!  I had no idea that it worked that way.  I don't like using a timer since it does delay being able to turn something on and off quickly but I guess for now I will live with it.

 

Also a big thanks to oberkc! I have a much better understanding and will be using the control option in the future instead of status.

Send beer! :-P

Link to comment

Archived

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


×
×
  • Create New...