Discover zigbee attribute ids

I’m trying to improve on a device handler written for the Philips Hue Motion Sensor. I’d like to try and get the sensitivity adjustment support worked into it.

I think I should be able to do a zigbee.writeAttribute to adjust the appropriate sensitivity attribute. The motion sensing part of the device is against attribute 0x0406 I believe, but I can’t work out how to find out what attributes are available to set. Is this just something that Philips keeps secret to make it hard for people to integrate with the device? Or is there a way of discovering available attributes and getting their value?
When I do a readAttribute on the device, it’s not clear to me what type I get back. The documentation on the zigbee object isn’t clear what it is meant to return: http://docs.smartthings.com/en/latest/ref-docs/zigbee-ref.html#zigbee-readattribute

When I log the return value I get something like this: Sensitivity: [st rattr 0xCF91 0x02 0x0406 0x2683, delay 2000]

But I get that back no matter the attribute I request at the 0x0406 level:

zigbee.readAttribute(0x0406,0x0001) = [st rattr 0xCF91 0x02 0x0406 0x0001, delay 2000]
zigbee.readAttribute(0x0406,0x0002) = [st rattr 0xCF91 0x02 0x0406 0x0002, delay 2000]
etc…

Any help much appreciated if anyone knows how to get more info out of the device or what documentation I can look at to better understand querying an undocumented device?

Thanks,
Kieran

From ZigBee documentation of Occupancy Sensor Cluster 0x0406.

4.8.2.2.2 PIR Configuration Set 
The PIR sensor configuration attribute set contains the attributes summarized in Table 4-25. 

Table 4-25. Attributes of the PIR Configuration Attribute Set
Identifier Name Type Range Access Default Mandatory/Optional
0x0010 PIROccupiedToUnoccupiedDelay Unsigned 16-bit integer 0x00 – 0xfffe Read/Write 0x00 O
0x0011 PIRUnoccupiedToOccupiedDelay Unsigned 16-bit integer 0x00 – 0xfffe Read/Write 0x00 O
0x0012 PIRUnoccupiedToOccupiedThreshold Unsigned 8-bit integer 0x01 – 0xfe Read/Write 0x01 O

4.8.2.2.2.1 PIROccupiedToUnoccupiedDelay Attribute 
The PIROccupiedToUnoccupiedDelay attribute is 16 bits in length and specifies the time delay, in seconds, 
before the PIR sensor changes to its unoccupied state after the last detection of movement in the sensed area. 

4.8.2.2.2.2 PIRUnoccupiedToOccupiedDelay Attribute 
The PIRUnoccupiedToOccupiedDelay attribute is 16 bits in length and specifies the time delay, in seconds, 
before the PIR sensor changes to its occupied state after the detection of movement in the sensed area. This 
attribute is mandatory if the PIRUnoccupiedToOccupiedThreshold attribute is implemented. 

4.8.2.2.2.3 PIRUnoccupiedToOccupiedThreshold Attribute 
The PIRUnoccupiedToOccupiedThreshold attribute is 8 bits in length and specifies the number of movement 
detection events that must occur in the period PIRUnoccupiedToOccupiedDelay, before the PIR sensor 
changes to its occupied state. This attribute is mandatory if the PIRUnoccupiedToOccupiedDelay attribute is 
implemented.

It looks like you may want to look at attributes 0x0011 and 0x0012 but they are optional so they may not be implemented.

1 Like

Thanks for the quick response. Where might I find that documentation? I’m quite new to this and don’t really have a background in the zigbee protocol or documentation.

Thanks again for that. That looks like a really useful thread. I found a PDF that seemed to have the information that you referenced there, but how am I meant to find this stuff?

Any idea what object type is returned by that zigbee.readAttribute call and how to get some more useful data out of it than just that toString output?

You can code it like this.

// Parse Zigbee Responses
def parse(String description) {

log.trace "parse() --- description: $description"
Map map = [:]
if (description?.startsWith('read attr -')) {
    map = parseReportAttributeMessage(description)
}
def result = map ? createEvent(map) : null

log.debug "parse() --- returned: $result"

return result
}

private Map parseReportAttributeMessage(String description) {
Map descMap = zigbee.parseDescriptionAsMap(description)
Map resultMap = [:]
if (descMap.clusterInt == 0x0406 && descMap.attrInt == 0x0011) {
   def value = Integer.parseInt(descMap.value, 16)
}
}

value will be a decimal value of the result of attribute 11.