[OBSOLETE] Original & Aqara Xiaomi Zigbee Sensors (contact, temp, motion, button, outlet, leak, etc)

No, it has the high-bit set so it’s a negative number. Converted as a two’s complement it’s -858.

According to what I’ve read, the sensor will send a confirmation attribute report immediately after the write attribute packet for changing the sensitivity setting is received.

But I suspect it’s not working, because of several reasons. Firstly:

So if the change to sensitivity level is made via the preference settings, then the writeAttribute command should be sent immediately after the user presses “save” in settings. Pressing save will call the updated() routine in the DTH code, so the command should be sent from there (either every time the user hits save, or do a check to see if the value of sensitivity has changed.

So according to what @Zach_Varberg says above, you’d want to explicitly send the hub command like this (for the low sensitivity setting):

sendHubCommand(zigbee.writeAttribute(0x0000, 0xFF0D, 0x20, 0x15, [mfgCode: 0x115F]).collect { new physicalgraph.device.HubAction(it) }, 0)

The above line addresses the second reason your zigbee.writeAttribute call probably doesn’t work.

From the ST Developer’s Reference here, the correct signature for the call is this:

zigbee.writeAttribute(Integer Cluster, Integer attributeId, Integer dataType, value, Map additionalParams=[:])

I’ve added [mfgCode: 0x115F] as an additional parameter to the zigbee.writeAttribute call because from what I’ve read here, manufacturer specific code needs to be included in the ZCL header of the message sent to the sensor in order for the write attribute command to be recognized.

So that should hopefully get it to work. I will be adding it the DTH code I’m working on, but of course still have no way to test.

As far as checking whether the sensitivity setting is working, the best method would be to place the sensor on something with a constant level of vibration (like an oscillating fan) and then change the sensitivity setting and observe if there’s any major change in the XYZ Acceleration values.