I was working today on a HE driver for a device that requires reporting configuration of the Analog Input (Basic) (0x000c) cluster.
SmartThings old Groovy code is : zigbee.configureReporting(ANALOG_INPUT_BASIC_CLUSTER, ANALOG_INPUT_BASIC_PRESENT_VALUE_ATTRIBUTE, DataType.FLOAT4, 0, 600, 1)
Connecting the same device to ST hub using an LUA driver shows this command:
Seems like a bug in HE zigbee.configureReporting for DataType.FLOAT4 (0x29) type ...
I have patched this with a hardcoded "he cr 0x${device.deviceNetworkId} 0x01 0x000c 0x0055 0x39 0x0000 0x0258 {0ad7233c}"
Probably we just need to better document this rarely used DataType.FLOAT4 (0x39) data format.
This is another ST Groovy code ported to Hubitat which works as expected:
def setPeopleCounter(peoplecounter) {
int pc = Float.floatToIntBits(peoplecounter);
return zigbee.writeAttribute(ANALOG_INPUT_BASIC_CLUSTER, ANALOG_INPUT_BASIC_PRESENT_VALUE_ATTRIBUTE, DataType.FLOAT4, pc, [:], 250)
}
Yes, I thought, that such a change would not be backward compatible with the existing code.
So maybe leaving it as it is now would be a better approach.... a bug that has turned into a feature already.
I have found at least one other community driver in HE which uses the same Float.floatToIntBits conversion.