Configure reporting for Data Type: Single Precision Floating Point (0x39)

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:

(I don't have the LUA code, so it I am not sure how the threshold floating value 0.01 is actually coded)

The problem is that trying to code the same reporting configuration in HE results in a weird presentation of the floating point value

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}"

EDIT: found this site : Floating Point to Hex Converter which helps to understand the float to hex conversion.

@mike.maxwell can you advise, please?

I'll have a look, thanks for the detail!

1 Like

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)
}

I just need to fix the conversion for these float datatypes, it obviously ain't right.
Fixing that will however break that last example you sent...

1 Like

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.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.