w35l3y
(Wesley Menezes)
March 22, 2023, 10:42pm
1
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
capabilities.formaldehydeMeasurement.formaldehydeLevel(20.0)
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.
nayelyz
(SmartThings Developer Support)
March 22, 2023, 11:26pm
2
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
w35l3y
(Wesley Menezes)
March 25, 2023, 5:39pm
3
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.
nayelyz
(SmartThings Developer Support)
March 27, 2023, 3:44pm
4
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
w35l3y
(Wesley Menezes)
April 13, 2023, 10:08am
5
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
bodyWeightMeasurement
proposed
kg
kg, lbs, 斤
carbonMonoxideMeasurement
live
ppm
ppm
dewPoint
live
-
F, C
feederPortion
proposed
g
g, lbs, oz
formaldehydeMeasurement
live
ppm
ppm, mg/m^3
precipitationMeasurement
proposed
-
mm, in
radonMeasurement
live
pCi/L
pCi/L
relativeBrightness
proposed
level
level
temperatureMeasurement
live
-
F, C
thermostatCoolingSetpoint
live
-
F, C
thermostatHeatingSetpoint
live
-
F, C
tvocMeasurement
live
ppm
ppm
vehicleOdometer
proposed
-
mi, km, m
vehicleRange
proposed
-
mi, km, m
Legend
Ok, as there isn’t any default unit scale
There is a default unit scale
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.