Jump to content
C4 Forums | Control4

Misfire when using variables


Recommended Posts

Hi guys. Can't seem to find this subject covered, but has anyone experienced a 'misfire' issue when using variables in a lighting scene? It seems when the system has been idle for a while, pressing a button that toggles a variable scene (on Press) sometimes (but not all the time) does nothing on the first press, but works on the second. This is frustrating for the client, as he sometimes presses, gets no response, so presses again, where-after the scene is either executed, or it toggles. It's not a ZigBee issue, because if I program a simple command like Press>Scene On, the response is immediate and reliable. Using ZigBee Pro Vers. 2.

Any advise greatly appreciated, Paddy.

Link to comment
Share on other sites


I'm guessing you have an on scene and an off scene you are toggling via a variable? If so then you are going to see the effect you are seeing. Say you activate the toggle which executes the on scene. Now walk around and turn all those lights off manually or via a different method. Now try to activate your toggle light scene. Nothing will happen since you have already manually turned them off (the customer thinks he is issuing an on scene when in fact the first press is toggling to the off scene). Do it again and the on scene will occur.

Link to comment
Share on other sites

Hi pharmdsmith

Many thanks for replying. Yes, what you say makes perfect sense. Now that I think about it, the client has an ALL OFF scene next to his bed! Is this something the client just has to accept if he wants to toggle assorted scenes from 1 button, or is there another way to program the scenes?

There are 5 scenes that are using variables, on 2 different 3-button k/pads:

1. Toggle Kitchen lights

2. Toggle Living Area lights

3. Toggle Rest Of House lights

1. Toggle Master Bedroom lights

2. Toggle Master Bathroom lights

3. All Off

I can see now how his retiring for the night and using the All Off button to kill the house lights (which is what one wants, after all) would 'confuse' the above scenes if the system 'though' they were still on. But at the risk of sounding stupid, what's the solution? ;)

Thanks again for your help, Paddy.

Link to comment
Share on other sites

you have several options all which requires more programming. I have done this for a customer in the past. Testing is imperative in complex programming.

Option 1 - Create a number variable for each scene. When the light state changes to on (nested option variable) increment the variable +1 for each scene it is associated with. When the light state changes to off decrement the variable -1 for each scene it is associated with. You will need to add house cleaning to ensure the variable stay accurate for undiscovered problems - like when scene all off is press set the variable to 0, it the variable goes below 0 set to 0, if above x set to x.

Then when you press the button if the variable is 0 execute the on scene. if the variable is greater than 0 (meaning at least one light is on) execute the off scene.

You could go on to set the LED based on the variable to indicate if there is a light on in the scene. IE if the variable is 0 set the LED to off if the variable is greater then 0 set the LED to on.

Option 2 - would give feedback to the toggle. When a scene is executed toggle the LED based on which scene executed. This way if the LED is on the Off scene willbe executed and Vice versa.

Option 3 - Although the sure fire way is to have 2 buttons one for the on scene and one for the off scene.

As with any programming I have found there may be several right answers, just different ways to accomplish it via programming.

Link to comment
Share on other sites

Hi Brett

Many thanks for your excellent advice, although I have to say my programming skills are not good enough to implement your options 1 or 2. Do any of your training videos deal with such complex programming? :)

Thanks again, Paddy.

Link to comment
Share on other sites

It is on my list, i hope to have a few new ones out next week.

Hi Brett

Many thanks for your excellent advice, although I have to say my programming skills are not good enough to implement your options 1 or 2. Do any of your training videos deal with such complex programming? :)

Thanks again, Paddy.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.