Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage Articles Web of Things over IoT and Its Applications

Web of Things over IoT and Its Applications

Key Takeaways

  • Interoperability is one of the essential attributes of any internet-facing appliance.
  • Web of Things is a web standard of the Internet of Things to enable communication between smart things and web-based applications.
  • Mozilla WebThing gateway is a smart IoT gateway that can be used to integrate smart devices in a vendor-neutral way and to provide a web interface to monitor and control devices over the web.
  • The Mozilla IoT project provides lots of add-ons to integrate with different smart appliances, third-party APIs, cloud etc. Being an open source project, anybody can add new plugins into this project.
  • The Mozilla IoT project provides REST API adhering to the Web of Things standard to communicate with smart devices.

My mom is a diabetic patient with high blood pressure and spends most of her time alone at home. One day, while I was working at the office, my mobile phone started buzzing on my desk. In my Continuous Glucose Monitor (e.g. dashboard I noticed that my mom’s sugar level was getting significantly low, maybe due to an excessive insulin intake or due to insulin intake without food. I immediately made a call to my neighbor and asked her to give my mother some sugary drink. I unlocked my home’s front door for her to enter the house, and switched on my car AC. I decided to return home early and for the rest of the day I worked from there.

I carried through all the actions described above from my office desk, remotely, using my smartphone. My phone is indeed smart and all of that was possible, thanks to the Internet of Things (IoT).

IoT is another bit of technical jargon in the same line as Artificial Intelligence, Virtual Reality, and Machine Learning. Actually, we are rather moving towards the Internet of Everything. Beyond physical things, technology is focusing on all-round connectivity, intelligence, and cognition between people, data, as well as processes. See the schematic representation of everything in It seems the future is coming with tons of IoT devices, Pebibyte of data, and insights extracted from those data using analytics, machine learning, deep learning etc.

What is Internet of Things (IoT)

The Internet of Things is the network of physical objects or "things" embedded with electronics, software, sensors, actuators, and connectivity to enable objects to exchange data with the manufacturer, operator and/or other connected devices.


The definition given above is quite straightforward. Conceptualizing IoT is not so difficult. Now just think — Smart Home, Smart City, Smart Transportation, Smart Farming etc. everything can go smart, easily acceptable and expandable if it is accessible and affordable to everyone irrespective of their socio-economic position — starting from business tycoons, world leaders, technologists like you, up to individual farmers. So it is not only a technological revolution but also a social “coup”.

There are lots of discussions going on about the social impact of this technology. Will it free up or collapse human potential and/or mind? Some agree about the inevitability of these technologies but at the same time they are recommending to slow down these transformation processes. However, at the end of the day, this process is inescapable. Every discovery brings benefits on the one hand and adverse effects on the other. At the present crossroad, many people like me believe this technology should be easily and affordably available in every corner of the society.

Why WoT

If you go back to the introductory example for a moment, you will see that. to monitor blood sugar levels, I needed an IoT-enabled Continuous Glucose Monitor (CGM) device; to open the front door remotely, I needed an IoT-enabled smart door lock; to switch on my car AC, I needed an IoT-enabled Car AC device. I could also need an IoT gateway to integrate all my home IoT appliances.

All these devices are manufactured by different vendors, adhering to different low-level network protocols and standards. As a consequence of that, all these devices have separate apps, or some of them are grouped based on vendor partnerships.  In the end, I have to open each of those apps one by one to perform each task to complete the workflow. Also I cannot have any common dashboard from where I can monitor all my appliances, since my IoT devices are not able to communicate with each other in a vendor neutral manner over the internet. It turns out my smartphone is not smart enough, hah!

Internet connectivity is a minor concern for low-level sensors or hardware devices. Low level sensors such as temperature sensor, and motion sensor, usually transfer data using low level protocols like Bluetooth Low Energy (BLE), Zigbee, 6LoWPAN, etc., which are not Internet compatible. Since IoT Gateways understand those low level protocols, they basically play the role of adapters between the internet and those sensors. Protocol transformation would also take place here. IoT gateways are installed inside smart homes, smart factories etc., i.e., inside Local Area Network where no unified communication standard is available, thus, those gateways can be used to communicate using proprietary data format over the internet. Additionally, there are multiple cloud vendors that are providing IoT services in different shapes and textures. Once again there is a lack of standardization. AWS Alexa is tied with Philips Hue so AWS and Hue can understand their data format but no one else can. This is gravitating towards the vendor lock-in black hole. To get rid of this problem, IoT needs vendor neutral standards for the internet.

The Web of Things groups, namely the Web of Things Interest Group and the Web of Things Working group, are trying to standardize communication protocols between different IoT smart devices and between smart devices and cloud platforms over the internet. The two groups created two popular specifications known as Web of Things Architecture and Web of Things Descriptions to address compatibility, scalability, interoperability, discoverability, security etc., which we are going to review in the following sections.

Web of Things (WoT)

The major portion of the WoT specification is the Thing Description. Thing is an abstract representation of a physical or virtual entity. A Thing Description includes  the metadata and interfaces of a Thing in a standardized way, with the aim to make the Thing able to communicate with other Things  in a heterogeneous world.

According to the WoT standard, the behavior of a Thing can be expressed by describing the interaction between the consumer and the Thing. This is known as Interaction Affordances, which is a property of objects that can show users what actions they can  carry through.

When affordances are taken advantage of, the user knows what to do just by looking: no picture, label, or instruction needed.

— Don Norman, Grand Old Man of User Experience

Things have four types of interaction affordances: Properties, Actions, Events, and Navigation affordance (i.e. Web links).

Other important features to describe Things’ behavior are Data Schema, which is a payload structure that is exchanged across Consumers and Things during interactions; Public and Private Security Configuration, which help to secure the data at rest and in transit; and the mapping between interaction affordances and concrete messages for specific protocols using Protocol Bindings. Please refer for more detail.

Figure 1

Real world WoT applications

Everything given above is just theory. Are there any real implementations? Eclipse and Mozilla did some good work on this aspect. As of now, I mainly explored the Mozilla WebThings project, which has two parts: 

  1. WebThings Gateway - A smart IoT gateway focused on interoperability and security, which is also an integral part of the gateway.
  2. WebThings Framework - A collection of reusable software components to help developers to build their own web things, which directly expose the Web Thing API.

Let us move out from the boring theory. In the next section we are going to go deeper with a hands-on session with the Mozilla WebThings Gateway. Let’s get our hands dirty and try to set up the WebThings Gateway and access it over the internet using Web Thing API.


Sometime near the end of 2017 or the beginning of 2018, the Mozilla IoT team initiated the two open source projects mentioned above keeping interoperability and the open nature of the internet in mind. Of these two projects I am currently checking out the gateway project. Below are the steps to set up an MWT gateway to access things over the internet using WoT compatible REST API.


I have installed Mozilla WebThings (MWT) gateway in my old Raspberry Pi and you can do the same following the step by step installation guide here.

After successful installation and connection over Wi-Fi or Ethernet (I used shared Ethernet), I was able to find my Pi local IP address by executing the following Address Resolution Protocol (ARP) command:

arp -a

Once I entered my Pi IP in the browser, the MWT gateway redirected me to the initial login/registration page. After registration, it brought me to the local and remote domain setting page. You can set up a remote domain, which enables remote access to your MWT gateway across the internet. The remote domain name is managed through a Mozilla-owned AWS server.

Figure 2

Note: If you skip setting the remote domain at install time, you will not be prompted again and you will lose the opportunity to set it. As a consequence, the MWT gateway will not be accessible from  the internet.

Mozilla allows us to provide the hostname which we want to use. The  fully qualified domain name is <hostname>

Below, you can see the web interface of the Mozilla WebThing Gateway dashboard. The dashboard displays connected smart devices and active add-ons along with their current state. Users can monitor and control their smart devices from the dashboard, for example they can monitor current room temperature, room light status, wind speed etc. Users can interact with connected smart devices like switch on/off the smart light, change the color of the light, increase or decrease light brightness, open smart lock, start AC etc.

Figure 3

The Mozilla WebThings Gateway provides a list of its main options as shown in Figure 4. Here, you can see all available features of the MWT gateway.

Figure 4

  1. Things: Open Things dashboard to monitor and control Things.
  2. Rules: Set rules (e.g if temperature is above than the threshold value then switch on  the AC).
  3. Logs: View logs.
  4. Floorplan: It allows users to arrange devices on a floor pan of the home. It is easy to monitor and control devices floor and/or room wise.
  5. Settings: It helps users to configure the gateway.

To configure the gateway as per your requirements, for example, to create new users, to install new add-ons, configure your location, etc. you have to navigate to the Settings menu option shown in Figure 5. In the next few paragraphs, we are going to review a few of the options to configure add-ons and custom things so they can be accessed through MWT REST API.

Figure 5

Figure 6

From the Developer menu you can navigate to the developer setting options. This has three sub menus, 1) Enable SSH: Here you can enable SSH support to access the gateway using putty or other SSH client over port 22, 2) View Internal Logs: You can view internal logs from this menu, and 3) Create local authorization: You can create local authorization to generate JWT token to authorize external REST calls.

After enabling SSH, I can access my Pi using putty or any other SSH client.

Figure 7

The Users menu provides you the option to add and remove additional users and to enable or revoke access to this gateway.

Figure 8

The most interesting part of the gateway is that it has lots of Add-ons. You can navigate to the Add-ons page from the Settings->Add-ons menu.

You can integrate the gateway with the General Purpose Input Output (GPIO) slot of the Pi using a GPIO adapter. You can also add the Azure IoT bridge add-on with the MWT gateway to connect devices to an Azure IoT Hub.

There are lots of other interesting adapters for different systems, like Chromecast; Kafka, which can be used to expose the devices as topics on a kafka broker; Philips Hue; Z-Wave; Zigbee etc.

Figure 9

I integrated the MWT gateway with external API providers using weather-adapter. Here, I configure the weather adapter with the OpenWeatherMap API provider. Other available providers are DarkSky and AccuWeather.

Figure 10

Using the virtual-things-adapter adds-on, you can create custom Virtual Things with custom properties adhering to the WoT Capability Schemas. The schema context defines the WoT capability schemas along with its Properties, Actions, Events. During virtual thing creation, the add-on automatically generates an unique ID of the thing which is required to access the thing using the  API.

Figure 11

Figure 12

If there is any pre-installed Thing, for example if you developed any custom thing using WebThings Framework and deployed it on your Pi, then you need to pass that Thing’s URL here to make it accessible via MWT gateway.

Figure 13

Local authorization is another important setting, if you are going to use the REST API, MWT is generating an access token to authorize incoming requests. To this aim, from the Developer menu you can navigate to the local token service to generate a Json Web Token (JWT).

Figure 14

You can allow/deny to authorize Things based on your choice.

Figure 15

The token service generates a Json Web Token which you can use to access Things over REST.

Figure 16

Using the Developer menu, you can navigate to the internal log view. In the example below, I can view different transactions I carried through on my Pi, such as opening a database, loading an add-on, invoking an API for certain properties, etc. These logs are helpful to debug and fix any issue inside the Pi.

Figure 17

Below are some sample internal logs.

2020-07-26 07:40:34.108 INFO   : Opening database: /home/pi/.mozilla-iot/log/logs.sqlite3

2020-07-26 07:40:43.779 INFO   : DNS config is: gateway

2020-07-26 07:40:43.796 INFO   : Service Discovery: changing profile - local domain is now: gateway

2020-07-26 07:40:59.310 INFO   : Service Discovery: state changed to: true

2020-07-26 07:40:59.645 INFO   : HTTPS server listening on port 4443

2020-07-26 07:40:59.656 INFO   : Redirector listening on port 8080

2020-07-26 07:41:06.271 INFO   : Loading add-on: gpio-adapter

2020-07-26 07:41:06.336 INFO   : Loading add-on: thing-url-adapter

2020-07-26 07:41:06.366 INFO   : Loading add-on: weather-adapter

2020-07-26 07:41:15.114 INFO   : Checking for add-on updates...




2020-07-26 07:44:30.600 INFO   : getValue for property temperature for: Weather (Nayabad) returning 86

2020-07-26 07:44:30.612 INFO   : getValue for property feelsLike for: Weather (Nayabad) returning 97

2020-07-26 07:44:30.623 INFO   : getValue for property humidity for: Weather (Nayabad) returning 89

Now, after having made the Pi available through the gateway, let's invoke the REST API to list all available Things using Postman:

Figure 18

This is a rundown of Postman input and output:

API description: Retrieve the list of Things


Authorization: Authorization token (JWT) in the request header. Token generated using the Local Token Service mentioned above.

Method: GET

Success response code: 200

The response content is a list of Things. Each JSON response has following main parts:

  1. title:  The title member is a human-friendly string which describes the device.
  2. @context: It is an optional annotation which can be used to provide a URI for a schema repository which defines standard schemas for common "types" of device capabilities.
  3. @type: It is an optional annotation which can be used to provide the names of schemas for types of capabilities a device supports, from a schema repository referred to in the @context member.
  4. properties: A map of Property objects which describe the attributes of the device.
  5. actions: A map of Action objects which describe functions that can be carried out on a device.
  6. events: A map of Event objects which define the types of events which may be emitted by a device.
  7. links: An array of Link Objects which link to other resources of a thing.
  8. id: An identifier of the device in the form of a URI [RFC3986] (e.g. a URL or a URN).
  9. securityDefinitions: It provides an authorization protocol (e.g. oauth 2.0), scopes and other security related attributes.

I was able to fetch the details about the custom virtual thing by using its unique id (virtual-things-custom-f7c9e797-6d79-4d71-9245-f3b69a104c5e) and accessing the following URL:        

There are lots of other REST and WebSocket APIs to access and manipulate Things. You can get the API details from the latest Web Thing API documentation.


In this article I have briefly discussed the Web of Things standard and its usefulness in the IoT landscape. We also discussed the Mozilla IoT project, which is an open source project adhering to the WoT specifications, namely, the WebThings Gateway project and some basic steps to configure MWT gateway.

I will conclude by saying that to build a smart device we need a language using which every IoT device can speak with each other over the internet. This is possible if and only if a global standard can amalgamate this cutting edge technology within the society in a true sense. Using such open standard API along with device and/or cloud specific adapters, developers can easily build their own custom heterogeneous solutions, for example, a single app which can monitor GCM dashboard and can control my home smart door lock and car AC.

About the Author

Tridib Bolar is based in Kolkata, India and he's working as a Cloud Solution Architect for an IT firm. He has been working in a programming landscape for over 17 years. Mostly engaged with the AWS platform, he is exploring GCP as a side project as well. In addition to being an admirer of the cloud serverless paradigm, he is also an enthusiast of IoT technology. Currently, he is exploring the interoperability of smart devices over the internet.  

Rate this Article