WebThingsIO / api

Web Thing API Specification
http://iot.mozilla.org/wot/
Other
164 stars 25 forks source link

Include human-readable label in Property resource #140

Closed flatsiedatsie closed 4 years ago

flatsiedatsie commented 4 years ago

I'm working on a voice control add-on.

When I ask the virtual leak sensor what it's state is, the api will answer only with False.

To turn this into a human readable response, I have to create a look-up table. if it's a leak sensor and the response is False, say 'dry', etc

Wouldn't it be an idea to also return a human readable value through the api?

mrstegeman commented 4 years ago

There are no defined labels for property states in either the spec or the schemas. These labels will depend entirely on the language, the interface, etc. Our UI defines labels for certain states, but those label will not necessarily apply to other UIs or other languages.

flatsiedatsie commented 4 years ago

Alright, perhaps I can rephrase it: is there a way to find out what labels the user expects to be spoken via the API?

mrstegeman commented 4 years ago

No, there is not. I'm going to move this to a different repo so we can consider it for inclusion in the spec, but my initial thoughts are that this is a UI concern, so not totally relevant to the spec. However, given that we do include labels for other things, it may make sense to include.

benfrancis commented 4 years ago

@flatsiedatsie I think you're already doing the right thing by having the client generate a meaningful response to the user based on the semantic annotations already in the Thing Description.

The API is not a UI, it just contains some hints to the client as to the semantic meaning of a given operation.