Wired doorbell to HE?

Care to elaborate on what your tweaks are? I just received one of these Sage Doorbell devices today as well. Thanks!

Just fixed an error and redo some logging stuffs.

1 Like

Thanks. I’ll give your version a try this weekend.

@cuboy29 have you noticed the driver produces duplicate pushed events? I figured out a simple fix. Just comment out the “sendEvent()” calls as shown below.

private Map getDoorbellPressResult(cluster) {
    def linkText = getLinkText(device)
    def buttonNumber = (cluster.command as int)
    def result = [:]
    
    // map buttons per Hughes described defaults for green and yellow wires
    
    switch(buttonNumber) {
        case 0: 
            if (!isDuplicateCall(state.lastButton2Updated, state.timeBetweenPresses) )
            {
		       log.debug ("Rear Doorbell Pressed!")       
               result = [ name: 'pushed', value: "2", isStateChange: true ]
               //sendEvent(name: "pushed", value: "2", isStateChange: true)
            }
            state.lastButton2Updated = new Date().time	
            break

        case 1: 
            if (!isDuplicateCall(state.lastButton1Updated, state.timeBetweenPresses) )
            {		
		       log.debug ("Front Doorbell Pressed!")
               result = [ name: 'pushed', value: "1", isStateChange: true ]
               //sendEvent (name: "pushed", value: "1", isStateChange: true) 
            }
            state.lastButton1Updated = new Date().time
    }
    return result
}
3 Likes

The driver worked fine for me. I actually modified it for my purposes and made it a Contact Switch as opposed to Pushable Button. With it being a Contact Switch I now get notifications in HomeKit when the doorbell rings. Exactly what I needed. Thanks a lot for the driver.

Here's the modified code in case anybody's interested. I removed the "back door" doorbell but it's easy to add in. I also removed all other functionality (except the actual sensor opening/closing). The code below is all you need for the it to work as a sensor.

metadata {
    definition (name: "SAGE Doorbell Sensor", namespace: "darwinsden", author: "darwin@darwinsden.com") {
        capability "Contact Sensor"
		capability "Sensor"
        capability "Configuration"
        fingerprint endpointId: "12", inClusters: "0000,0003,0009,0001", outClusters: "0003,0006,0008,0019", model: "Bell", manufacturer: "Echostar"
    }
}

def ensureClosed(){
    sendEvent(name: "contact", value: "closed", displayed: false, isStateChange: true) 
}
 
def parse(String description) {
    def cluster = zigbee.parse(description)
    if(cluster.profileId != 0x0104 || cluster.command == 0x0B || cluster.command == 0x07 || (cluster.data.size() > 0 && cluster.data.first() == 0x3e)){
        return
    }
    if(cluster.clusterId == 0x0006){
        //log.debug("ding dong")
        sendEvent(name: "contact", value: "open", displayed: false, isStateChange: true)
        runIn(1, ensureClosed)
    }
}

def refresh() {
       configure()
 }

def configure() {
   ensureClosed()
}

def updated()
{
    configure()
}

Dan

I've already notified the poster of the driver.

The driver on github has different handling for button 1 and button 2. I wanted to get your advice on the correct code.

Below is the code as posted on github, the "result =" is different for button 1 and 2. For me button 1 (front) worked properly button 2 (rear) produced duplicate events, leading to your fix above.

However when I commented out the "sendEvent" line of button 1, no events occurred for button 1 and single events for button 2.

My question: Which "result" line would be the preferred code?

Mike

switch(buttonNumber) {
    case 0: 
        if (!isDuplicateCall(state.lastButton2Updated, state.timeBetweenPresses) )
        {
	       //log.debug ("BUTTON2 PRESS!")               
           result = [ name: 'pushed', value: "2", isStateChange: true ]
           sendEvent(name: "pushed", value: "2", isStateChange: true)
        }
        state.lastButton2Updated = new Date().time	
        break

    case 1: 
        if (!isDuplicateCall(state.lastButton1Updated, state.timeBetweenPresses) )
        {		
	       //log.debug ("BUTTON1 PRESS!")
           result = [ name: 'button', value: "pushed", data: [buttonNumber: 1], isStateChange: true]
           sendEvent (name: "pushed", value: "1", isStateChange: true) 
        }
        state.lastButton1Updated = new Date().time
}
return result

}

This is mine...

switch(buttonNumber) {
181
        case 0: 
182
            if (!isDuplicateCall(state.lastButton2Updated, state.timeBetweenPresses) )
183
            {
184
               log.debug ("Rear Doorbell Pressed!")       
185
               result = [ name: 'pushed', value: "2", isStateChange: true ]
186
               //sendEvent(name: "pushed", value: "2", isStateChange: true)
187
            }
188
            state.lastButton2Updated = new Date().time  
189
            break
190
​
191
        case 1: 
192
            if (!isDuplicateCall(state.lastButton1Updated, state.timeBetweenPresses) )
193
            {       
194
               log.debug ("Front Doorbell Pressed!")
195
               result = [ name: 'pushed', value: "1", isStateChange: true ]
196
               //sendEvent (name: "pushed", value: "1", isStateChange: true) 
197
            }
198
            state.lastButton1Updated = new Date().time
199
    }
200
    return result
2 Likes

Thanks

Mike

here is my version of the driver. I've taken what others have done before, then added parameters to store custom names for each contact. Useful for logs.

4 Likes

Hello Trunzoc.
I had noticed many postings with code for this device. Mine was delivered yesterday. Can you tell me if people are free to use your code please? And if so..is it as simple as copy and paste to the drivers code? Anything else needed?
Thank You
Mac

Take a look at the code itself for the license info displayed pretty prominently towards the top.

As a zigbee device all you should have to do is add the driver code to your hub. I don’t have one of these, so I don’t know for sure the hub auto-assigns the driver correctly, but if it doesn’t you can manually reassign the driver in the device’s details page after it has paired, then save and hit the configure button at the top of the page.

Yep. Free to use, as all user drivers and apps should be!

1 Like

I cant seem to get this to work for me, ive tried a bunch of different drivers and 2 sage door bell sensors and nothing happens when I ring the door bell. No events show up in the sensor details page. Im stumped.

I hate to ask the obvious but I assume you paired the sensor with the hub using Zigbee discovery and saved it after it was found? Does the sensor show up in your devices? If so, does the sensor just never change state when you ring the bell? Mine will show open as long as I’m pushing the doorbell button, so if that’s not happening, it might be wired wrong.

It pairs straight away and automatically picks the sage device driver, click configure then try the door bell but nothing happens. Install seems straight forward and doubt I got that wrong twice, green to front door, white to transformer, yellow to rear doorbell.

Might hit it with a multimeter tomorrow and see what's happening at the connections, but the door bell chimes normally so no idea what else it could be.

I'm having a similar problem. Paired straight away. It selected the SAGE driver. I tested mine however on an 18v AC was wort but can't get it to show up on a log, nor does it control a light i set up in Simple lighting when a button is pressed.
Any troubleshooting thoughts?
Thanks
Mac

Appreciate the reply. Question for you. Should there be a status anywhere on the device page using your driver? I know with switches, there is typically a status indicator ( on or off). With this i see "Current States" Number of Buttons 2.....but nothing to indicate if the button was pressed.
I paired the device, it selected the Sage driver. Prior to installing i simply tried to power or activate from an 18v ac power supply. No state changes and nothing in the logs.
Appreciate your thoughts.
Mac

I don’t use the original driver but the modified driver I use (posted above) uses a sensor capability as opposed to switch and it shows open/closed in the driver. Might be a good way to troubleshoot if the original driver doesn’t show state.

Here’s a link.

CrazyIvan, and chance you'd post your contact code with both buttons identified?

I definitely like the idea of contact sensors better than buttons.