Thing Description
The Thing Description (TD) (or W3C WoT Thing Description (TD)) is a royalty-free, open information model with a JSON based representation format for the Internet of Things (IoT). A TD provides a unified way to describe the capabilities of an IoT device or service with its offered data model and functions, protocol usage, and further metadata. Using Thing Descriptions help reduce the complexity of integrating IoT devices and their capabilities into IoT applications.[1] The TD originated from the Web of Things (WoT) initiative of the international standards organization of the W3C which has the intention to increase the interoperability in the IoT.[2] Since April 2020, the Thing Description[3] is a W3C recommendation (W3C WoT Thing Description 1.0). In December 2023, the W3C published 1.1 version of the Thing Description recommendation.[4] PrinciplesThe major principle of the Thing Description is to provide a human-readable and machine-interpretable interface description of an IoT device/Thing. In that context, the WoT Thing Description is to the IoT what index.html is to a website: it can be considered as the entry point of a physical or virtual Thing/device.[5] Thing Description are not limited to a specific communication protocol, rather it provides a framework called a WoT Binding Template.[6] Such a Protocol Binding defines the mapping from an Interaction Affordance to concrete messages of a specific IoT protocol such as MQTT, HTTP, CoAP, Modbus or OPC UA. The WoT Thing Description defines 3 kinds of Interaction Affordances, named Property, Action and Event: PropertyAn Interaction Affordance that exposes state of an IoT device. This state can then be retrieved (read) and optionally updated (write). Devices can also choose to make Properties observable by pushing the new state after a change. ActionAn Interaction Affordance that allows to invoke a function of an IoT device, which manipulates state (e.g., toggling a lamp on or off) or triggers a process on the device (e.g., dim a lamp over time). EventAn Interaction Affordance that describes an event source, which asynchronously pushes event data to the subscribers of the event (e.g., overheating alerts). Components and standard technologiesIn general, the Thing Description is designed to reuse and rely on established Internet and Web standards, this includes:
Thing Description examplesBelow is an example TD serialized in JSON-LD format, which has one property, one action and one event. The IoT device represented by this TD uses the HTTP protocol but a TD can represent any protocol with a URI scheme, as shown in the example below. {
"@context": "https://www.w3.org/2019/wot/td/v1",
"id": "urn:dev:ops:32473-WoTLamp-1234",
"title": "MyLampThing",
"securityDefinitions": {
"basic_sc": {"scheme": "basic", "in":"header"}
},
"security": ["basic_sc"],
"properties": {
"status" : {
"type": "string",
"forms": [{
"href": "https://mylamp.example.com/status",
"htv:methodName":"GET"
}]
}
},
"actions": {
"toggle" : {
"forms": [{
"href": "https://mylamp.example.com/toggle",
"htv:methodName":"POST"
}]
}
},
"events":{
"overheating":{
"data": {"type": "string"},
"forms": [{
"href": "https://mylamp.example.com/oh",
"htv:methodName":"GET",
"subprotocol": "longpoll"
}]
}
}
}
This TD represents an Internet connected lamp, which could be thought as a simple version of a Philips Hue lamp. From this TD example, a client knows that there exists one Property affordance with the title status (lines 10-16). In addition, information is provided in lines 13-14 that this Property is readable with an HTTP GET request to the URI This example also specifies the Below is the same connected lamp but using MQTT protocol and no security. {
"@context": [
"https://www.w3.org/2019/wot/td/v1",
{"mqv": "http://www.example.org/mqtt-binding#"}
],
"id": "urn:dev:ops:32473-WoTLamp-1234",
"title": "MyLampThing",
"securityDefinitions": {
"nosec_sc": {"scheme": "nosec"}
},
"security": ["nosec_sc"],
"properties": {
"status" : {
"type": "string",
"forms": [{
"href": "mqtt://mylamp.example.com/status",
"mqv:controlPacketValue": "SUBSCRIBE"
}]
}
},
"actions": {
"toggle" : {
"forms": [{
"href": "mqtt://mylamp.example.com/toggle",
"mqv:controlPacketValue": "PUBLISH"
}]
}
},
"events":{
"overheating":{
"data": {"type": "string"},
"forms": [{
"href": "mqtt://mylamp.example.com/oh",
"mqv:controlPacketValue": "SUBSCRIBE"
}]
}
}
}
Differently from the last TD, here the forms include MQTT protocol as specified by the WoT Binding Templates. More specifically, lines 17, 25 and 34 describe what message types should be used to use the affordances. For example, instead of HTTP GET and longpoll subprotocol to observe the overheating event, a client can subscribe to this event using the MQTT protocol. Furthermore, a WoT device with MQTT protocol can be both a publisher and a subscriber. For the property and event affordances, it would publish the values, whereas for action affordances it would subscribe to the action topics that other MQTT publishers can trigger by publishing to these topics. ImplementationsThing Description editing and validation tools
Implementations using Thing Description
See alsoReferences
|