Closed tim-hellhake closed 4 years ago
Please open a gateway issue to support this.
Nevermind, done: https://github.com/mozilla-iot/gateway/issues/2577
Hi @benfrancis,
Hectopascal is equivalent to millibars so is a standard unit for barometric pressure, even though not strictly an SI unit.
I think it makes sense for schemas to permit standard units of all kinds, not only SI ones.
Cheers 🙂
@madb1lly Unfortunately that's not what the specification says so conforming clients would not understand the unit. See https://github.com/mozilla-iot/schemas/pull/65#pullrequestreview-473394749
Hello @benfrancis,
Nonetheless, hecto is a permitted SI prefix denoting 10^2, so hPa is an acceptable SI unit even if Pa is the base unit. I don't see where in the Thing description spec SI prefixes are not permitted? In fact one example gives units of milliseconds, which is the same type of usage of an SI unit.
On that basis it seems that hPa is totally acceptable, isn't it?
PS - Yes I did have to educate myself on what an SI unit really is, hence why I now contradict myself about whether or not hPa is strictly an SI unit or not.
@madb1lly Having looked at the original source (also educating myself!) I think you're right. "hecto" is listed in Table 7 (SI prefixes). Also, good point about milliseconds.
This does mean that writing a general purpose WoT client might be a bit trickier than I thought as far as units are concerned, as the number of possible units explodes! But it is at least consistent with the specification. Sorry for the false alarm :)
I considered using Pa instead of hPa but because of the milliseconds
example, I thought prefixes would be ok 😬
This does mean that writing a general purpose WoT client might be a bit trickier than I thought as far as units are concerned, as the number of possible units explodes! But it is at least consistent with the specification. Sorry for the false alarm :)
Yes, unit conversion difficulties are (almost) as old as a hills: https://www.mentalfloss.com/article/25845/quick-6-six-unit-conversion-disasters
However, if SI units are used then it shouldn't be too difficult. I did a quick web search and found several existing JSON structures for representing SI units. It shouldn't be too difficult for someone with the skills (i.e. not me!) to use one for the gateway, or any other WebThing explorer.
Resolves #30