Jump to content
C4 Forums | Control4

Doorbell Events Programming


Recommended Posts

Just got the CA Contact and Elk Board package installed. it's working great. I want to do some advanced programming. 


I've determined that most people who come to my door ring it twice within 30-60 seconds if I don't immediately come to the door. Package deliveries typically ring once and dash off. These are my two use cases. 


I'd like to program events based on two rings and one ring. Two problems. I don't think I am using or expiring a timer correctly. And the other problem is my TVs. 


Here is the basic of my coding:


If Doorbell is pressed

 -Start Doorbell timer

  If Doorbell timer is running

     If Doorbell pressed

     -Stop Doorbell Timer

      -If TV is off

          -Turn on TV

         -Show Bookmark on HC-250

         -Turn off TV

     -If TV is on

         -Show bookmark

          -Turn TV back to previous input

If Doorbell timer expires

  -- Send email that a package was delivered



Since my family doesn't always use SR-250/150s to turn on the TVs, the C4 system doesn't know when the TVs were turned on or off. So, it is sending IR that is turning off the TV when it is On when it needs to be actually seeing that it is on (If TV is Off). I thought the IR was smarter and sent distinct On and OFF codes. I guess it doesn't?  So, how can I get around this? 


Also, what if someone keeps ringing the doorbell over and over. I want to capture two rings. Anything over that I want to ignore in the system. I don't want the ringing loop to start all over again. Do I need an additional timer that says something like "wait five minutes before setting the timer again?




Link to comment
Share on other sites

Oh my.

Well to start, if a driver has discrete on/off codes depends on who made the driver and if the TV even HAS discrete codes. That say as long as you program to turn a device to be on/off (and NOT use the send IR command option) the system stays aware of whether or not a device (such as a TV) is (supposed) to be on or off. The problem is you CANNOT use other methods to rurn that TV on or off. Even if you DO have discreet codes, you're messing with the system awareness - best is to learn them to stop doing it. If there are indeed discrete codes available at least it'll put things back in synch instead of messing it up more though.


One of the problems you'll be facing is that while you can capture the current selected source, you can only capture ONE (per room) at a time - you're worry on multiple presses is a reasonably one, because in it's basic form those multiple presses will cause the on-screen to be captured as the current source, defeating the return to previous source and indeed the power off settings.

That doesn't mean there isnt a solution however.

Link to comment
Share on other sites

Variable: DB active (boolean)

Variable: DB count (number)

Variable: TV capture (device)

Variable: TV state (boolean)

Timer: DB timer (non repeating - you'll likely have to play with the desired time, I'd start with 2 minutes)


WHEN doorbell is pressed

IF DB active is true

-DB count +1

IF DB active is false

-set DB active to true

RESET DB timer {this is NOT embedded - while this may delay executing some of the programming a bit, doing it this way means every time the button is pressed the timer restarts, which helps against the incessant button pushers}


WHEN DB count changes

IF DB count is equal to 1 {note equal, not equal or greater - using a number variable here helps make sure to prevent multiple presses mess things up, and keeps your option open to add more programming should you wish it}

-IF Living room is on {take note that thus IF is embedded under the first IF}

--set TV state to true {note the two dshes here to mean it is embedded under the SECOND IF}

--set TV capture to the value of [room] CURRENT SELECTED DEVICE

-delay 100ms {note that we're back to embedding under the FIRST IF only - delays like these are hardly noticeable for the user, but ensure the system has a chance to catch up to all the changes}

-Send command "CONTROL4" to [room] {this has proven to be the most effective way of choosing the on-screen device - you'll find it in the ACTION tab when selecting the room itself}

-delay 100ms

-select bookmark [camera] on the [controller doing on-screen]


WHEN DB timer expires {note that this could be 2 minutes (or other timer length you choose) or several hours depending on how hard-core of a button masher you're finding at your door ;) )

IF DB count is 0

-send email "package"

IF DB count is equal to or greater than 1 {here you DO use anything above 1 as well}

-IF TV state is TRUE {note: IF within IF again}

--set [room] CURRENT SELECTED DEVICE to the value of TV capture

-IF TV state is FALSE {this one back embedded under the first IF, not another embedding of the second IF}

--turn [room] off

set DB count to 0 {no longer embedded under any IF}

set TV state to false

set DB active to false



A few notes:

-I changed it to where the TV/camera stays on as long as the timer runs. This CAN cause a TV to stay on here for a long time (if people keep pressing the doorbell) but it keeps things a lot cleaner than trying to introduce more timers in here.

-The TV will ONLY turn onto the camera if the doorbell is pressed at least two times, I gathered that is what you wanted to happen?

-It's late, the code should be good, but it's far from impossible I made a mistake in here - report back here if you run into issues.

Link to comment
Share on other sites

Cyknight--thank you for the coding and the explanation behind it. I am an intermediate in Composer HE, I felt like this lesson took me up a notch. I've added it all into Composer, but haven't had a chance to test yet. I can't start ringing the door bell at this late hour -- but I will be in the morning!! I'll let you know how it goes. 

Link to comment
Share on other sites

Sorry, busy days and first time I can have a look on a computer...


You're setting the 'capture' value to the room's TV every time, so the TV itself becomes the source every time. It seems you're using the wrong subset of commands fort he variable.

In programming you need to use the option "Set to Value of" - the second option, NOT the first  "Set to Value". In that drop down list find "Living Room->CURRENT_SELECTED_DEVICE" and use that instead.

Link to comment
Share on other sites


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.