Zigbee.[something] Commands Reference?


(Mike Wesley) #1

Hey All.

I’m trying to create a new Device Handler for a Develco Smart Plug Mini that connects via Zigbee.

I’ve read though all the documentation but can’t seem to find a complete list of all the zigbee.[something] commands.

I have created a new Zigbee device handler using the template in the IDE and there are a lot of zigbee.[something] commands that don’t seem to be documented. A few examples are:

zigbee.onOffRefresh()
zigbee.simpleMeteringPowerRefresh()
zigbee.electricMeasurementPowerRefresh()
zigbee.onOffConfig()
zigbee.simpleMeteringPowerConfig()
zigbee.electricMeasurementPowerConfig()
zigbee.parseDescriptionAsMap()
zigbee.convertHexToInt()

Where are all these coming from and what do they do?

On this page of the documentation (http://docs.smartthings.com/en/latest/device-type-developers-guide/building-zigbee-device-handlers.html) it states that:

The use of ‘raw …’ commands is deprecated. Instead use the documented methods on the ZigBee library. If you need to do something that requires the use of a ‘raw’ command let us know and we will look at adding it to the ZigBee library.

I’m assuming that means don’t use commands like:

zigbee.readAttribute(“0x0002”, “0x0000”)

to pull information from the device. Instead use zigbee.[somecommand] to do it instead.

But there are all these human readable commands?


(Tony Fleisher) #2

The zigbee reference is found in the API Documentation section. There is also a link to it from the top of the Zigbee Primer page (the previous page from the one you posted).


(Mike Wesley) #3

Yeah, but none of those commands are listed anywhere in that documentation, except for:

zigbee.parseDescriptionAsMap()
zigbee.convertHexToInt()

So where do the other commands come form?!


(jeff prisco) #4

did you ever get a response? I have the same problem


(Tom Manley) #5

Commands like zigbee.readAttribute and zigbee.command are encouraged. What the documentation means is don’t use the legacy "raw ..." command. I’d add other legacy commands like "st rattr ..." and "st wattr" to that list of commands to avoid using.

This should be documented but in the meantime here is the source:

	def onOffRefresh(){
		readAttribute(ONOFF_CLUSTER, 0x0000)
	}

	def levelRefresh(){
		readAttribute(LEVEL_CONTROL_CLUSTER, 0x0000)
	}

	def hueSaturationRefresh(){
		readAttribute(COLOR_CONTROL_CLUSTER, 0x0000) + readAttribute(COLOR_CONTROL_CLUSTER, 0x0001)
	}

	def colorTemperatureRefresh() {
		readAttribute(COLOR_CONTROL_CLUSTER, 0x0007)
	}

	def electricMeasurementPowerRefresh() {
		readAttribute(ELECTRICAL_MEASUREMENT_CLUSTER, 0x050B)
	}

	def simpleMeteringPowerRefresh() {
		readAttribute(SIMPLE_METERING_CLUSTER, 0x0400)
	}

	def onOffConfig(minReportTime=0, maxReportTime=600) {
		configureReporting(ONOFF_CLUSTER, 0x0000, DataType.BOOLEAN, minReportTime, maxReportTime, null)
	}

	def levelConfig(minReportTime=1, maxReportTime=3600, reportableChange=0x01) {
		configureReporting(LEVEL_CONTROL_CLUSTER, 0x0000, DataType.UINT8, minReportTime, maxReportTime, reportableChange)
	}

	def simpleMeteringPowerConfig(minReportTime=1, maxReportTime=600, reportableChange=0x05) {
		configureReporting(SIMPLE_METERING_CLUSTER, 0x0400, DataType.INT24, minReportTime, maxReportTime, reportableChange)
	}

	def electricMeasurementPowerConfig(minReportTime=1, maxReportTime=600, reportableChange=0x0005) {
		configureReporting(ELECTRICAL_MEASUREMENT_CLUSTER, 0x050B, DataType.INT16, minReportTime, maxReportTime, reportableChange)
	}

	def colorTemperatureConfig(minReportTime=1, maxReportTime=3600, reportableChange=0x10) {
		configureReporting(COLOR_CONTROL_CLUSTER, 0x0007, DataType.UINT16, minReportTime, maxReportTime, reportableChange)
	}

	def batteryConfig(minReportTime=30, maxReportTime=21600, reportableChange=0x01) {
		configureReporting(POWER_CONFIGURATION_CLUSTER, 0x0020, DataType.UINT8, minReportTime, maxReportTime, reportableChange)
	}

	def temperatureConfig(minReportTime=30, maxReportTime=3600, reportableChange=0x0064) {
		configureReporting(TEMPERATURE_MEASUREMENT_CLUSTER, 0x0000, DataType.INT16, minReportTime, maxReportTime, reportableChange)
	}

	def iasZoneConfig(minReportTime=0, maxReportTime=SECONDS_IN_HOUR) {
		enrollResponse() +
			configureReporting(IAS_ZONE_CLUSTER, ATTRIBUTE_IAS_ZONE_STATUS, DataType.BITMAP16, minReportTime, maxReportTime, null) +
			configureReporting(IAS_ZONE_CLUSTER, ATTRIBUTE_IAS_ZONE_CIE_ADDRESS, DataType.IEEE_ADDRESS, minReportTime, maxReportTime, null)
	}

ZigBee DTH - configure() & refresh() - correct method in 2018?
(Bradlee S.) #6

Is there a more complete reference? I’m having a hell of a time dealing with a Zigbee scene controller and would love info on how to go about testing it. I can send it all sorts of commands, but either don’t get responses or get back nothing of value.


(Tom Manley) #7

Can you provide some examples of what you’re trying to do that isn’t working?


(Bradlee S.) #8

Instead of cluttering this up, I posted here:
Help a newbie write a Device Handler for a Zigbee Multi-Button Scene Controller