Help Decipher Thing Shield Code


(Brian) #1

Can someone help explain to me what the simulator raw data is, and how to decipher it, on the example thing shield code? Also what is the catchall for?

metadata {
	// Automatically generated. Make future change here.
	definition (name: "On/Off Shield", namespace: "smartthings", author: "SmartThings") {
		capability "Actuator"
		capability "Switch"
		capability "Sensor"
	}

	// Simulator metadata
	simulator {
		status "on":  "catchall: 0104 0000 01 01 0040 00 0A21 00 00 0000 0A 00 0A6F6E"
		status "off": "catchall: 0104 0000 01 01 0040 00 0A21 00 00 0000 0A 00 0A6F6666"

		// reply messages
		reply "raw 0x0 { 00 00 0a 0a 6f 6e }": "catchall: 0104 0000 01 01 0040 00 0A21 00 00 0000 0A 00 0A6F6E"
		reply "raw 0x0 { 00 00 0a 0a 6f 66 66 }": "catchall: 0104 0000 01 01 0040 00 0A21 00 00 0000 0A 00 0A6F6666"
	}

	// UI tile definitions
	tiles {
		standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true, canChangeBackground: true) {
			state "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821"
			state "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
		}

		main "switch"
		details "switch"
	}
}

// Parse incoming device messages to generate events
def parse(String description) {
	def value = zigbee.parse(description)?.text
	def name = value in ["on","off"] ? "switch" : null
	def result = createEvent(name: name, value: value)
	log.debug "Parse returned ${result?.descriptionText}"
	return result
}

// Commands sent to the device
def on() {
	zigbee.smartShield(text: "on").format()
}

(Duncan) #2

Here’s the format for the ZigBee catchall packet (basically just any ZigBee message the hub doesn’t know how to interpret).

The last field is the data, for the SmartShield it’s an ASCII string always starting with ‘\x0a’ – that first one says “on” and the second says “off”.

Off the top of my head I’m not sure what the fields on the raw command are, but for the shield it always starts with “raw 0x0 { 00 00 0a” and then the ASCII command bytes.


(Brian) #3

Thanks for the response @duncan it helps out, but still a bit over my head. Ill do more research.