Default unit is not being taken into consideration at v4 47X Beta when validating a command that have unit marked as required property

I just added API v4 47X Beta in my test workflow and it is failing with the following message:

Invalid value for Formaldehyde Measurement.formaldehydeLevel value: {value=20.0} error: Required field missing: unit


The same exact unit tests are being executed with API v3 46X and it is working successfully.

It isn’t a problem to me.
I just wanted to make sure unit is really required in this new version.


Hi, @w35l3y
I’ll ask the team about this error to see if they have more info and I’ll get back to you.

1 Like

I checked a little more closely, required properties weren’t being checked properly, so they fixed it. Thanks!
The issue is default unit isn’t being taken into consideration.

It is affecting all capabilities that have unit listed as required property.

In my case, it stopped at Formaldehyde Measurement.formaldehydeLevel because it is the first unit test that have capability affected.

Sorry for the delay. Yes, the team confirmed they applied more validations.

If it’s marked as required, it means the unit must be included in any capability event, it is important for conversions, especially the ones of temperature. So, please include them from now on to avoid any issues, I’ll share with the team your comment about the default value to see if that can be considered.

1 Like

So here is what I have… All these unit tests failed on my tests because of the absent of unit scale.

Capability Status Default unit Acceptable unit scales
:yellow_circle: bodyWeightMeasurement proposed kg kg, lbs, 斤
:red_circle: carbonMonoxideMeasurement live ppm ppm
:green_circle: dewPoint live - F, C
:yellow_circle: feederPortion proposed g g, lbs, oz
:yellow_circle: formaldehydeMeasurement live ppm ppm, mg/m^3
:green_circle: precipitationMeasurement proposed - mm, in
:red_circle: radonMeasurement live pCi/L pCi/L
:red_circle: relativeBrightness proposed level level
:green_circle: temperatureMeasurement live - F, C
:green_circle: thermostatCoolingSetpoint live - F, C
:green_circle: thermostatHeatingSetpoint live - F, C
:red_circle: tvocMeasurement live ppm ppm
:green_circle: vehicleOdometer proposed - mi, km, m
:green_circle: vehicleRange proposed - mi, km, m
:green_circle: Ok, as there isn’t any default unit scale
:yellow_circle: There is a default unit scale
:red_circle: There is only ONE acceptable unit scale AND there is a default unit scale

In summary, I still think a good approach would be to respect the default unit scale defined for the capability.