Comfort  Automation/ Security System Forums Home
Home Search search Menu menu Not logged in - Login | Register
Comfort Automation/ Security System Forums > Support > Questions on Programming Comfort > Logic problem in my response - but I can't find it

Logic problem in my response - but I can't find it
 Moderated by: slychiu
 New Topic   Reply   Printer Friendly 
 Rate Topic 
AuthorPost
 Posted: Wednesday Jan 28th, 2015 12:36 am
   PM  Quote  Reply 
1st Post
Pgordon
Member
 

Joined: Saturday Sep 23rd, 2006
Location: London, United Kingdom
Posts: 237
Status: 
Offline

  back to top

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.

 



 Posted: Wednesday Jan 28th, 2015 04:31 pm
   PM  Quote  Reply 
2nd Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5493
Status: 
Offline

  back to top

I cannot see anything wrong with the response either

can you check "Show status"  for the counters that are used especially 201 and then Execute the Response. It would be useful to see how the counter changes

Perhaps the timer should be increased to say 4 seconds to see if that is a factor inhibiting the say number. I think only 1 announcement can be made at a time so if the previous announcement is not completed, the new announcement may not be heard



 Posted: Tuesday Feb 3rd, 2015 03:28 pm
   PM  Quote  Reply 
3rd Post
Swiss-Toni
UCM Pi Users


Joined: Thursday Sep 15th, 2011
Location: Greater London, United Kingdom
Posts: 349
Status: 
Offline

  back to top

I have had problems where the keypad dioes not send full comands when I have uploaded comfiguration files to the comfort panel, sometimes you have to also upload the kepads after files have been loaded upto your comfort panel. it seems like that the keypads becomes slightly disjointed from the comfort panel.

Give it a try if it works
:)

Last edited on Tuesday Feb 3rd, 2015 03:29 pm by Swiss-Toni



 Current time is 05:06 am
Comfort Automation/ Security System Forums > Support > Questions on Programming Comfort > Logic problem in my response - but I can't find it
Top




UltraBB 1.172 Copyright © 2007-2014 Data 1 Systems