How should Capabilities indicate the Units of Measurement of their Attributes and Commands


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #1

Continuing the discussion from Capability.airPressure:

I don’t have many suggestions at the moment, but figured I’d spin off the Topic.
Almost everything in the above post is relevant (i.e., definition of the Attribute, units, conversion, etc.).

Offhand: SmartThings ought to pick a universal measurement system (i.e., metric!) and that should be the basis for primary Attribute values units. A static Attribute could confirm the units, but really, it should be sufficient to define it in the documented Capability.

This leaves it up to the Device Handler to do unit conversion for Tile Displays.
SmartApps probably should do their own unit conversion if needed.

I hate to “go there”, but I suppose “optional” attributes could be provided by some Capabilities or “ad hoc” attributes by some Device Handlers.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

So the Event Class has a Property called “unit”.

https://graph.api.smartthings.com/ide/doc/event

I suppose that helps avoid ambiguity of the data value; but this sure puts a LOT of pressure on the SmartApp to interpret the value. – Unless, of course, the sole purpose is for display (i.e., "${value} ${unit}).