Web of Things: The IoT revolution

6 Sep 2021 \
5 minutes \
written by Philipp Blum
Categories: Column

Web of Things (or short WoT) is a set of standards by the W3C which enable interoperability for IoT devices. The W3C defines other important standards, such as HTML, CSS or XML.

Disclaimer: I am part of the W3C web of things working group.

Protected ecosystems #

The IoT is here to stay. IKEA smart lights, Philips hue, Xiaomi smart weight or Google Nest. We already have a lot of revolutionary IoT devices.
There is only one problem. These devices are not able to work well with each other.
Each manufacturer has its own ecosystem and is not able to work with the ecosystem of other manufacturer.
In order to enable the next industrial revolution, we need a way to make them interoperable.
This is where the Web of Things standards come into play. It aims to solve this gap.

Embrace the openness #

The W3C is an open organization which defines open standards. The Web of Things standards are free of charge and can be used by everyone. Even more, companies, universities and non-profit foundations can join the W3C WoT working group and work in a colaborative way on these standards.

Backwards compatibility #

Even though the IoT industry is pretty young, we have already seen instances of some significant problems.
Industry user need to rely on devices for years, even decades. They cannot afford to replace their IoT devices every one or two years.
In order to enable the industry 4.0, we need reliable devices and standards.
We have seen in previous instances that the industry is not able to provide this reliable infrastructure yet. Google just recently announce to shut down Android Things. Another famous example were the Sonos audio speaker.
The WoT standards make it possible to manage backwards compatibility and use devices for a longer period of time.

Web of Things Thing Description #

The Web of Things Thing Description (WoT TD for short) is the entry point for the Web of Things.
It gives a device the possibility to describe itself in a unified way. The WoT TD is technology and protocol agnostic. Which means, it is not opinionated when it comes to the protocols and technologies used.
Any existing technology can be used in combination with the WoT TD. It only enables a device to describe itself.
All necessary information in order to interact with the device are present in WoT TD.

Example Web of Thing Thing Description

Following a simple WoT TD. In this use-case HTTP is used as protocol. The WoT TD is avaible under the URL https://mylamp.example.com/.well-known/wot-thing-description. This follows the WoT discovery specification. There are other ways to discover the WoT TD, but we exclude the discovery part in this article in order to reduce complexity.

{
    "@context": [
        "http://www.w3.org/ns/td",
        { "saref": "https://w3id.org/saref#" }
    ],
    "id": "urn:dev:ops:32473-WoTLamp-1234",
    "title": "MyLampThing",
    "@type": "saref:LightSwitch",
    "securityDefinitions": {
        "no_sc": { "scheme": "nosec" }
    },
    "security": "no_sc",
    "properties": {
        "status": {
            "@type": "saref:OnOffState",
            "type": "string",
            "forms": [{
                "href": "https://mylamp.example.com/status"
            }]
        }
    },
    "actions": {
        "toggle": {
            "@type": "saref:ToggleCommand",
            "forms": [{
                "href": "https://mylamp.example.com/toggle"
            }]
        }
    },
    "events": {
        "overheating": {
            "data": { "type": "string" },
            "forms": [{
                "href": "https://mylamp.example.com/oh"
            }]
        }
    }
}

id is used to identify the device. It accepts any URI. Which means a variaty of ID types can be used. The ID can even be a DID in order to connect the device to a distributed ledger, such as a Blockchain.

title is used for some human readable information. It can be used for UI purposes.

@type is used for label information. In this case the label contains the saref class Light switch.

securityDefinitions defines the used security schemas. In this case there no security used. The name for the security can be used in the InteractionAffordance Form. This means each endpoint can be protected with different security scheme, if needed.

We have three types of InteractionAffordance

  • PropertyAffordance
  • ActionAffordance
  • EventAffordance

properties is a map of PropertyAffordance. It contains all available properties for the device.
actions is a map of ActionAffordance. All available actions are defined in it.
events is a map of EventAffordance. As the name suggests, it defines all available events.

Let’s take a look into one InteractionAffordance.

    {
        "properties": {
            "status": {
                "@type": "saref:OnOffState",
                "type": "string",
                "forms": [{
                    "href": "https://mylamp.example.com/status"
                }]
            }
        }
    }

This is a PropertyAffordance with the name status. This InteractionAffordance is available with the name in the scripting API. I am not going to go into more details on the scripting API yet. Let’s take instead a deeper look into this specific PropertyAffordance. The @type is used to label the property accordigly to the saref Light switch class. The form defines where the property can be found and what protocol has to be used. In this case it is HTTP and the property can be queried via a HTTP GET request on https://mylamp.example.com/status

I hope this article gets a rough introduction in what Web of Things is about and what problems get solved with the specification. If you want to get your hands dirty with some practical Web of Things applications, check out our getting started tutorial for the Arduino IDE.