ZigBee binding between two devices

As I mentioned in the other thread, the update to the documentation is coming. Until then here are some useful methods for executing commands:

 * @param cluster - zigbee cluster in hex (even hex characters)
 * @param attribute - attribute to be refreshed (even hex characters)
 * @return - sends the refresh command to the device

def refreshData(cluster, attributeId)

example of using and concat for refresh:

def hueSaturationRefresh(){
	refreshData("0x0300", "0") + refreshData("0x0300", "1")
}

To use the refresh command in the DTH code use it as zigbee.refreshData("0xcluster", "0xattr")

@rpress Anything in particular that you are looking for?

It seems like you want to control device B directly from device A without the hub stepping in, correct?

@workmonk Yes, that’s right. I do have it working now, but the one time configuration is not really streamlined. Ideally in the preferences for the device I could select other devices. e.g. I could tell the switch which bulbs to bind with. That’s what I am looking for. Right now I have to find the MAC address and the endpoint of each bulb, and enter those into the preferences manually. Then I have to click the configure() button in the IDE to send the new bindings, because I can’t get it working in updated().

I have a ZigBee switch talking directly to one or more ZigBee bulbs. Whenever the switch controls the bulbs, the bulbs will report their state change back to SmartThings, which keeps everything synchronous. SmartThings can control the bulbs directly and the switch won’t care.

The advantage to this configuration is that the response is nearly instantaneous. Also if the hub goes down the switch will still be able to control the light. This is working with most bulbs (not Cree) and when it works it’s awesome.

1 Like

Oh and to be specific, the first thing I’d like to work is something like this in a device type. This currently only works in a SmartApp.

preferences {
section(“On/Off Binding”) {
input “onOffBinding”, “capability.switch”, multiple: true, title: “Devices to Control”, required: false
}
}

The second thing is this. Currently this only works in configured() but I’d like it to work in updated(). It seems like it used to work in updated() but doesn’t right now.

def updated() {
[“zdo bind 0x${device.deviceNetworkId} 1 ${binding1ep} 0x0006 {${device.zigbeeId}} {${binding1mac}}”,“delay 200”]
}

Is there a method in the zigbee object for accessing the Ember command line directly? That could allow me to do the above code in updated(). Something like:

def updated() {
zigbee.command(“zdo bind 0x${device.deviceNetworkId} 1 ${binding1ep} 0x0006 {${device.zigbeeId}} {${binding1mac}}”)
}

I was working on something similar, although not for binding; and I figured I would need to use a SmartApp to handle grabbing the other devices. In a SmartApp, you can access the deviceNetworkId and pass that to the device handler for zigbee commands; but when I tried to pull the endpointId of a device, it gave me an error.

Does anyone know if it’s possible to access what endpointId a device uses from a SmartApp? It’s used from within Zigbee devices.

5:43:09 PM: error java.lang.IllegalArgumentException: Property ‘endpointId’ is not supported for devices @ line 38