Single precision float value via API

Hi,

I’m investigating a possibility of adding DIY PTVO-based sensors to deCONZ and Phoscon app.

The sensor reports a value via the “Analog Value (Basic)” cluster. I see the correct value in deCONZ (read). But API returns a rounded value. For example, 0.123 returned as 0.

FYI: I’ve defined this sensor in a custom DDF file, where I’ve added the “ZHAConsumption” sub-device, and adjusted the endpoint number, cluster, attribute ID.

Did I miss something?

Hello, no it’s normal, there is no floating values in deconz json, all values are integer (I have a bad english so I m not sure if I m using good word)

But to resume there is no value with decimal, for exemple temperature or humidity are * 100 to have 2 usable decimal.

What is the measured value ? not possible using a more precise one ? like using mA instead of Ampere ?

@Smanar
Thank you! It is clear now. There is no problem scaling a value by 10, 100 or 1000, but Phoscon and other Home Automation Systems will display a sensor’s value incorrectly without additional calculations.

It’s a DIY sensor, there is no defined “rules” you can choose yourself if the value is in X or mX.
Temperature are *100 and there is no problem with third app, it just need to be defined at start.

You can too use “string” type, but for me it’s not the better solution.

Attribute 0x0075 EngineeringUnits, part of the cluster 0x000e Analog Value, is here to indicate the used unit as described in Zigbee specifications :

The EngineeringUnits attribute indicates the physical units associated with the value of the PresentValue
 attribute of an Analog cluster.
Values 0x0000 to 0x00fe are reserved for the list of engineering units with corresponding values specified in Clause 21 of the BACnet standard [A1]. 0x00ff represents 'other'. Values 0x0100 to 0xffff are available for proprietary use.
If the ApplicationType attribute is implemented, and is set to a value with a defined physical unit, the physical unit defined in ApplicationType takes priority over EngineeringUnits.