Thing property decimal/float

I am building a door sensor using a battery-powered ESP8266.
I have successfully described the thing with two properties; OpenProperty and VoltageProperty.

Is it possible for the VoltageProperty to accept decimals/float?
I read that the WoT Capability Schemas for VoltageProperty is type - number/integer.
Is number/integer the same format?

I am trying to update the VoltageProperty with a float and getting a compile error:
no match for ‘operator=’ (operand types are ‘ThingPropertyValue’ and ‘float’)

Some inexperienced coding by me, the error is resolved.

However, decimals sent from the ESP8266 are being rounded to integers in the gateway. e.g. ESP8266 output 1.12 displayed on gateway as 1V.

When I turn on the log for the VoltageProperty it shows actual decimal values.

Im guessing #1870 is the answer…
Next release…

The issue is that you need to include a multipleOf directive in your property description, e.g. "multipleOf": 0.1. That tells the UI how many decimal places to use. The UI was updated to do that in the 0.9 gateway release, but there is not currently a way to add multipleOf in the webthing-arduino library.

Thanks Michael.
I’ll add an issue on the library.

Hi Michael
Thanks for getting the library updated.
As a complete newb, how do I use this in my code?

*** code ****
ThingDevice workshopDoor(“workshopDoor”, “Workshop Door”, sensorTypes);
ThingProperty batteryProperty(“batteryVoltage”, “Battery Voltage”, NUMBER, “VoltageProperty”);

void setup() {
adapter = new WebThingAdapter(“doorsensor”, WiFi.localIP());
workshopDoor.addProperty(&batteryProperty);
adapter->addDevice(&workshopDoor);
adapter->begin();

double batteryVal = realVoltage;
batteryVoltageValue.number = batteryVal;
batteryProperty.setValue(batteryVoltageValue);

I have changed my property description and it seems to be working OK.
ThingProperty batteryProperty(“Battery Voltage”, “Battery Voltage”, NUMBER, “multipleOf: 0.1”);

ThingDevice workshopDoor("workshopDoor", "Workshop Door", sensorTypes);
ThingProperty batteryProperty("batteryVoltage", "Battery Voltage", NUMBER, "VoltageProperty");

void setup() {
    adapter = new WebThingAdapter("doorsensor", WiFi.localIP());
    batteryProperty.multipleOf = 0.1;
    batteryPropery.unit = "volt";
    workshopDoor.addProperty(&batteryProperty);
    adapter->addDevice(&workshopDoor);
    adapter->begin();

    ...
}

I believe that should do the trick.