Linux lab: Mozilla's WebThings Gateway

Crash Landing

Article from Issue 230/2020
Author(s):

The smart home is gaining momentum, and Mozilla joins the fray. Mozilla WebThings is billed as an open platform for managing IoT devices. We decided to investigate.

Many Internet of Things (IoT) solutions are proprietary tools that limit choice and compromise user privacy. As one might expect, the open source community, which has always prized freedom and openness, has been hard at work on solutions that would avoid the many problems associated with vendor lock-in.

The Mozilla project recently added a promising new technology to the IoT mix. Mozilla's WebThings [1] is an implementation of the Web of Things architecture, which attempts to build the IoT around proven and well known Internet technologies, such as REST, HTTP, and JSON.

According to Mozilla's website, WebThings consists of two primary components:

  • WebThings Gateway [2] – a software distribution for smart home gateways focused on privacy, security, and interoperability. The gateway acts as an interface between the IoT network and the Internet or local network.
  • WebThings Framework [3] – a collection of reusable software components to help developers build their own web things .

WebThings, which is open source and freely available on GitHub [4] supports a number of home automation protocols, including Zigbee [5], which has been under development for more than 15 years, and Z-Wave [6].

An open platform for IoT with multiple protocol support is a very promising development – but does WebThings work now with real-world IoT devices? We decided to find out.

Hardware

WebThings Gateway runs on a conventional Raspberry Pi (models 1 to 4) with a modified Raspbian operating system. Mozilla also offers an image for the Turris Omnia WLAN router [7], and the WebThings developers are working on a version for OpenWRT-based devices. Users control devices with the Things graphical user interface.

To enable communication between the computers on the network and Zigbee or Z-Wave IoT devices, you'll also need to plug a suitable gateway device into the Raspberry Pi. For our tests, we used the ConBee II Zigbee [8] USB stick. UZB, a Z-Wave USB stick, is also available [9].

First Contact

We used a Raspberry Pi 4B as our gateway computer. As end devices, we used several Zigbee-capable lamps by manufacturers Aurora, Enlite, Müller-Licht, and Philips. We also added a switchable OSRAM socket to the Zigbee network.

To build the WebThings Gateway system for the Raspberry Pi, download the image from the project website and unpack the archive. Then transfer the resulting image to a MicroSD card, which acts as the boot medium. (See the instructions on the Mozilla WebThings website [10].) Then plug the ConBee II stick into the Raspberry Pi and start the system.

Next set up a WLAN named WebThings Gateway nnnn, where nnnn is a random string of characters and digits. Users will connect to this WLAN hotspot on other computers. Open a web browser and type http://gateway.local in the address bar; this opens a list of available wireless networks. Select your WLAN from the list and associate your Rasp Pi with the desired WLAN by entering the WPA2 key (Figure 1).

Figure 1: WLAN detection already works reliably with Mozilla's WebThings Gateway.

Then log in to this WLAN on your computer and call the http://gateway.local URL once again. In the browser, Mozilla's gateway creates a subdomain that allows access to the gateway from the Internet. The keys for secure access to the gateway using the HTTPS protocol are generated in the background (Figure 2). You may have to forward the gateway IP address and port on the router.

Figure 2: Thanks to a separate subdomain, WebThings allows access via the Internet.

In the next step, create a new user account in the browser. Enter the desired name, password, and email address. You are then taken to an almost empty screen that prompts you to search for new equipment. To start the search, press the plus button bottom right.

The system now searches the local network for connected Zigbee devices and lists them in the browser window. Alternatively, you can use the Add by URL link to manually integrate smart devices on the WLAN via their IP addresses.

The system settings can be accessed by opening the menu hidden behind the hamburger icon top left in the browser window. In the Settings submenu, first change the system settings. Use the system settings to create additional users and integrate other devices, which Mozilla refers to as Things, into the system. In addition, you can modify the WLAN or the subdomain configuration (Figure 3).

Figure 3: The WebThings Settings dialog offers several options.

Modules

To operate most devices, you will need to retroactively install add-ons. Right from the start, only the WebThings, Z-Wave, and Zigbee modules are active. The WebThings module is used to integrate smart end devices that can be addressed via WLAN into Mozilla's home automation software. You can install additional modules later to access terminal devices, communicate via Bluetooth, and more (Figure 4).

Figure 4: Add-on modules let you add additional devices to the network.

Clicking on the plus button in the bottom right corner of the add-ons list display takes you to a list of additional modules. Click on the + Add button to integrate the module with the system.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Smart Home with Zigbee

    The RaspBee II module turns your Raspberry Pi into a smart control center for Zigbee devices.

  • Z-Wave

    Z-Wave connects components in the smart home and ensures that remote commands from the control station take effect on real household appliances. We look at how it works, its range, the security of the protocol, and some basics that every Z-Waver should know.

  • ioBroker + Rasp Pi

    Control devices from different manufacturers of home automation devices from a single interface by combining free software and a Raspberry Pi.

  • FHEM

    If you want to equip your home with smart technology, you will need to deal with a variety of providers and what are often incompatible standards. FHEM is a free integration platform that houses the building blocks under one roof and offers visually appealing interfaces.

  • Programming Snapshot – Power Outages

    A power failure can cause the IQ of a smart home to plummet suddenly. An emergency power supply and a script on the SmartThings platform can prevent a total outage and inform the owner. The polyglot Perlmeister embarks on a foray into the territory of the Groovy scripting language in this issue.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News