Having the functionality to press and hold a keypad or dimmer for a certain period of time to fire certain programming is one of my favorite things. I use alot of press and holds in my house to turn certain things or “modes” on or off, as well as other various programming tasks. At my old website I got a lot of requests for this, so I did a write-up on how to do it. Unfortunately that write-up got lost, and we’ve had some requests to do another here, so here you have it!

In the example I’m going to use, I’ll tell you how I toggle the house in and out of “Vacation Mode” (which was covered in the write-up found here). The first thing you need to do is create a boolean variable. This is done in Composer under the Agents tab. Be descript in naming your variables. Over time, you will end up with a lot of them (I have over 50 in my project) and you want to be able to look back know exactly what they are for. So create a boolean variable, and name it appropriately (“Mud Room Press and Hold” in this example).

Once the variable is created, go into the Programming tab and in the “Device Events” pane select the device you want to have the press and hold on. In this example, it is the bottom button on the dimmer in the Mud Room, so I will select “Bottom Button Pushed”. Now over the the device actions tab, I will select my newly created variable, and set it to True. Next, set it so when the button is released, it sets the variable to False.


Now, the next part of the programming will be done on the variable.

Back in the Device Actions pane, scroll down to Variables, and click the little “+” sign. Select the variable we just set to toggle, in this case “Mud Room Press and Hold”. The first thing we want to do is put in a delay. The delay is the amount of time that you have to hold the button down for your programming to take place. I use 1.5 seconds, or 1500 milliseconds. You can insert the delay by looking in the Device Actions pane, under “Programming Control”.

Next, still in the Device Actions pane, select the variable, and click on the Conditional tab. Select “If True”, and drag that into the center. Now, whatever you “Nest” under that conditional statement will take place if that button is held down for 1.5 seconds. In this case, we are going to toggle the variable “Vacation Mode”.

Now, I wanted to a visual indicator let me know easily if the house is in “Vacation Mode” or not, so I setup the LED on that dimmer to change color once the “Vacation Mode” was set. I did this under the “Vacation Mode” variable, and it looks like this:

Any questions or comments hit me up with a reply below, or check out the thread about this on C4Forums, located here.

Share