-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capabilities System #57
Comments
There should probably be a readable equivalent for write-only properties. For example, X-10 modules are all write-only. There is no way to determine if a switch is currently set to the on or off setting. |
Yeah, sorry we should really discuss "writable" in #38. That's just what the current W3C spec is doing. But I do find the concept of write only properties really weird and wonder whether that's something we actually want to expose. We could try caching the state in the gateway for Z-Wave. |
From w3c/wot#371: If we we're not limited to JSON-LD syntax and semantic annotations are optional you could actually just rename Without semantic annotations you manually define the schema:
With semantic annotations you could just refer to an external schema:
...which kind of makes sense given the "schema" property is basically a JSON Schema! |
IMHO, this move is highly needed indeed. The sooner the better. This spec will end up with hundreds of unique Web Thing Types, and still they may not cover all devices out there. So a "capability" kind of logic is much more suitable. Projects like https://iotdb.org already explored that topic in depth. |
This is definitely needed. Many of the things I am working with have common attributes with wildly different core functions. For example, smart plugs from Aeon Labs have rgb-color light rings around the plug that are configurable. It would be beneficial to have the capabilities be abstracted and queryable. A use case of this I am looking into is having the ability of setting an entire room to a color theme. If I could query things by location and by the "colorable" capability, this would be a very simple operation. A less esoteric example might be devices that have a battery. It would be nice to be able to pull from a capability list to find all devices and their battery status, rather than needing to know in advance what devices are battery operated and what they call their remaining battery property. |
@dhylands found a good example of a device where this is definitely needed, the "Aeotec ZW100 multi-sensor 6". This device includes many different sensors, and we definitely don't want to have to define a Here is an example of what a Thing Description could look like.
This example includes a top level There are then also An example which includes actions and events:
Actions and events can also have a One thing I'm not sure about is to what extent What is defined by JSON Schema, and what is defined by JSON-LD style semantic annotations? |
I like this direction for a more flexible way to define devices/things. A thought for the e.g.
or With regard to "default" semantic information for IMO, this would lend to an even more flexible way to define how devices/things are presented even at the UI level too (imagine a device optionally providing a CSS file for theming/describing it's components for the UI).
|
@bhagman wrote:
This is what the current W3C specification does, although that's partly because they haven't separated out The downside of allowing multiple What is the difference between
The term "type" is taken from JSON Schema and goes multiple levels deep. A property can be of
The term So we could change one or the other, but it would make us less compatible with those specifications. Note that the current W3C spec has a |
I think capabilities should err on the side of rigidity when defining required sets of properties, actions, and events. I definitely don't think it would be useful to have capabilities that are solely semantic hints. For example, if something has a capability OnOffSwitch but doesn't have a property "on" then what is it trying to accomplish? It's also more useful to an interface to know that "level" must be 0-100 (or at least must have a min/max). There can certainly be weak capabilities, but it makes sense for most of them to be strong to allow the creation of fine-tuned interfaces |
OK, I've started to document a set of capability schemas for a Mozilla schema repository. My hope is that eventually we can use an external schema repository like iot.schema.org (current staging server at iotschema.org) once that matures a bit more and the Thing Description specification is a bit more solid. In the meantime a Mozilla schema repository gives us more flexibility to experiment and define data constraints for types. The repository includes the following types:
A thing can implement multiple capabilities. A capability schema defines a set of properties, actions and events which can be expected for a thing which implements that capability - some of which are required and some of which are optional. Property, Action and Event types describe data constraints for property values, action inputs (and possibly outputs) and event payloads. This defines what primitive data types, units, minimum and maximum values to expect in order to enable ad-hoc interoperability. The idea is that a client can implement UI components for each known property, action and event type such that things can use any combination of those types, without having to stick to a single rigid top level thing type. The top level thing capability types provide additional information to a client to tell it what kinds of properties, actions and events to expect from a thing (as well as semantic information about what it does), without restricting that thing to a single top level type. Below is an example of how capabilities might be used. A lamp implements the This approach currently differs from the latest W3C proposals in that we only implement two of the three or four levels of "types" currently being discussed. We can add additional levels in future if we find they are necessary.
|
closed by 7fe0f9e |
In implementing this specification so far we've found that just defining top level "Web Thing Types" is quite inflexible and have discussed a "capabilities" type system for standardising types of properties, actions and events which can be mixed and matched between types.
Here is a proposed example where
DimmableLight
is a thing type andOnOffProperty
,LevelProperty
,ToggleAction
,FadeAction
andOverheatedEvent
are capabilities defined by an external context at iot.schema.org.You will notice that properties, actions and events also have a "schema", which is the latest W3C proposal for defining data types, and "writable" to define whether a property accepts a PUT request.
The text was updated successfully, but these errors were encountered: