01-28-2015, 01:36 AM
I have a response associated with a CBUS switch in the kitchen which I use to call the kids down to dinner by flashing their bedroom lights on & off 10 times....
When I initially uploaded it & tested it, it worked perfectly, as it has numerous other times, however, I\'ve noticed it very often doesn\'t... I *think* it might be working the first time only after a system reset, and thereafter not working, which obviously made me look for a counter or flag not getting reset in the code and thus failing a conditional test... but I\'ve poured over the code for ages, and I can\'t see what would stop it working... I\'ll paste the full response code below:
******************************************************
If Counter Counter201 = 0 Then ! On FIRST loop only, do some initialisation
Announce Call Children
Copy Counter CBUSVictoriLight To Counter205 ! Save current level of Victorias light
Copy Counter CBUSAdamsLight To Counter206 ! Save current level of Adams light
End If
If Counter Counter201 <= 10 Then ! Loop will repeat 10 times
Do KidsBedLightON ! Response turns both rooms lights on at 100%
Do KidsBedLightOFF After 1 Seconds Using FlashKids-timer1 ! Response turns both rooms lights OFF
If Counter Counter201 = 10 Then ! After 10 loops restore everything to normal & exit
Set Counter201 = 0 ! Reset counter 201 back to 0
Copy Counter Counter205 To CBUSVictoriLight ! Restore Victorias light to previous level
Copy Counter Counter206 To CBUSAdamsLight ! Restore Adams light to previous level
Exit Response
End If
Increment Counter201
Say Number
Do FlashKidsBedroom After 2 Seconds Using FlashKids-timer2 ! Response recursively calls itself with a delay
End If
*****************************************************
When it doesn\'t work, it only partially doesn\'t work... it *always* does the announcement \"Call children\" which is conditional on counter201=0 so from that I know that I must be resetting counter 201 to 0 at the end of the response... however, what does NOT happen is the announcement of the number (I have 1... 2... 3... etc. announced on the keypad so I can be aware of the response running), and the lights do not flash...
To be clear, the 2 responses called to turn the lights on & off, definitely don\'t do anything other than a CBUS group on/off command, so they can\'t be having any impact on the conditional logic...
Can anyone figure out why the response always starts, but doesn\'t always get to the main code block?
Cheers
Paul G.
When I initially uploaded it & tested it, it worked perfectly, as it has numerous other times, however, I\'ve noticed it very often doesn\'t... I *think* it might be working the first time only after a system reset, and thereafter not working, which obviously made me look for a counter or flag not getting reset in the code and thus failing a conditional test... but I\'ve poured over the code for ages, and I can\'t see what would stop it working... I\'ll paste the full response code below:
******************************************************
If Counter Counter201 = 0 Then ! On FIRST loop only, do some initialisation
Announce Call Children
Copy Counter CBUSVictoriLight To Counter205 ! Save current level of Victorias light
Copy Counter CBUSAdamsLight To Counter206 ! Save current level of Adams light
End If
If Counter Counter201 <= 10 Then ! Loop will repeat 10 times
Do KidsBedLightON ! Response turns both rooms lights on at 100%
Do KidsBedLightOFF After 1 Seconds Using FlashKids-timer1 ! Response turns both rooms lights OFF
If Counter Counter201 = 10 Then ! After 10 loops restore everything to normal & exit
Set Counter201 = 0 ! Reset counter 201 back to 0
Copy Counter Counter205 To CBUSVictoriLight ! Restore Victorias light to previous level
Copy Counter Counter206 To CBUSAdamsLight ! Restore Adams light to previous level
Exit Response
End If
Increment Counter201
Say Number
Do FlashKidsBedroom After 2 Seconds Using FlashKids-timer2 ! Response recursively calls itself with a delay
End If
*****************************************************
When it doesn\'t work, it only partially doesn\'t work... it *always* does the announcement \"Call children\" which is conditional on counter201=0 so from that I know that I must be resetting counter 201 to 0 at the end of the response... however, what does NOT happen is the announcement of the number (I have 1... 2... 3... etc. announced on the keypad so I can be aware of the response running), and the lights do not flash...
To be clear, the 2 responses called to turn the lights on & off, definitely don\'t do anything other than a CBUS group on/off command, so they can\'t be having any impact on the conditional logic...
Can anyone figure out why the response always starts, but doesn\'t always get to the main code block?
Cheers
Paul G.

