WebThings is an open source implementation of the Web of Things, including the WebThings Gateway and the WebThings Framework.
Deploy this app to Linode with a free $100 credit!
Web of Things gateway.
(If you're just installing on your PC, you can skip this step).
If you're installing on a Raspberry Pi then you may need to set up the OS on the Raspberry Pi first. See here for instructions.
$ sudo apt update
$ sudo apt install \
autoconf \
build-essential \
curl \
git \
libbluetooth-dev \
libboost-python-dev \
libboost-thread-dev \
libffi-dev \
libglib2.0-dev \
libpng-dev \
libudev-dev \
libusb-1.0-0-dev \
pkg-config \
python-six \
python3-pip
$ sudo -H python3 -m pip install git+https://github.com/WebThingsIO/gateway-addon-python#egg=gateway_addon
$ sudo dnf --refresh upgrade
$ sudo dnf group install "C Development Tools and Libraries"
$ sudo dnf install \
autoconf \
bluez-libs-devel \
boost-devel \
boost-python2-devel \
boost-python3-devel \
curl \
git \
glib2-devel \
libffi-devel \
libpng-devel \
libudev-devel \
libusb1-devel \
pkgconfig \
python2-pip \
python3-pip
$ sudo -H python2 -m pip install six
$ sudo -H python3 -m pip install git+https://github.com/WebThingsIO/gateway-addon-python#egg=gateway_addon
$ brew update
$ brew install \
autoconf \
libffi \
pkg-config
$ sudo -H python2 -m pip install six
$ sudo -H python3 -m pip install git+https://github.com/WebThingsIO/gateway-addon-python#egg=gateway_addon
nvm allows you to easily install different versions of node. To install nvm:
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
Reinitialize your terminal session.
$ . ~/.bashrc
(If you already installed node via nvm you can skip this step)
Follow the directions from NodeJS to install on your platform.
The following is required in order to let node and python3 use the Bluetooth adapter.
$ sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
$ sudo setcap cap_net_raw+eip $(eval readlink -f `which python3`)
$ git clone https://github.com/WebThingsIO/gateway.git
$ cd gateway
.nvmrc
file will be used by nvm to determine which version of node to install.$ nvm install
$ nvm use
$ nvm alias default $(node -v)
$ node --version
v10.23.0
$ npm --version
6.14.9
Note: these versions might differ from the LTS version installed locally.
$ npm ci
$ sudo firewall-cmd --zone=public --add-port=4443/tcp --permanent
$ sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent
$ sudo firewall-cmd --zone=public --add-port=5353/udp --permanent
Set up domain:
If you plan to use the provided tunneling service to set up a _.webthings.io
domain:
$ npm start
If you plan to use your own SSL certificate:
privatekey.pem
and certificate.pem
in the ssl
sub-directory of the userProfile
directory specified in your config. You can use a real certificate or generate a self-signed one by following the steps below.$ WEBTHINGS_HOME="${WEBTHINGS_HOME:=${HOME}/.webthings}"
$ SSL_DIR="${WEBTHINGS_HOME}/ssl"
$ [ ! -d "${SSL_DIR}" ] && mkdir -p "${SSL_DIR}"
$ openssl genrsa -out "${SSL_DIR}/privatekey.pem" 2048
$ openssl req -new -sha256 -key "${SSL_DIR}/privatekey.pem" -out "${SSL_DIR}/csr.pem"
$ openssl x509 -req -in "${SSL_DIR}/csr.pem" -signkey "${SSL_DIR}/privatekey.pem" -out "${SSL_DIR}/certificate.pem"
$ npm start
The Gateway requires a browser that supports: - Fetch - Web Sockets - ECMAScript 2015 (ES6) - CustomEvent - Custom Elements (V1) - Shadow DOM (V1)
Currently, that translates roughly to: - Firefox 63+ - Chrome 54+ - Edge 79+ - Safari 10.1+ - Opera 41+
If you are using VS Code, simply use the "launch" target. It will build the gateway in debugger mode.
If you are not using VS Code, run npm run debug
and it will build the gateway and launch it with --inspect
.
In order to run the browser tests, you'll need to install Google Chrome and a JDK (e.g. OpenJDK).
To run the linter and all tests:
$ npm run test
To run a single test:
$ npm run jest build/test/{test-name}.js
config/
- Gateway configuration filesdeb/
- Tools for building .deb packagesdocker/
and Dockerfile
- Tools for building Docker imageimage/
- Tools for building the Raspberry Pi imagerpm/
- Tools for building .rpm packagessrc/
addons-test/
- Add-ons used strictly for testingcontrollers/
- App URL routes and their logiciso-639/
- Small utility for interacting with ISO-639 data, i.e. locale namesmodels/
- Data model and business logicplatforms/
- Platform-specific functionalityplugin/
- Utility classes and methods used by add-onsrules-engine/
- The rules enginetest/
- Integration and unit testsviews/
- Handlebars templatesaddon-loader.ts
- Script used for starting up Node-based add-onsaddon-manager.ts
- Manages add-ons (e.g. Zigbee, Z-Wave)addon-utils.ts
- Utilities for add-ons, e.g. for reading the manifestsapp.ts
- The main back endcertificate-manager.ts
- Certificate registration and renewal, via Let's Encryptconstants.ts
- System-wide constantsdb.ts
- Manages the SQLite3 databasedeferred.ts
- Wraps up a promise in a slightly more convenient manner for passing around, or savingec-crypto.ts
- Elliptic curve helpers for the ES256 curveerrors.ts
- Common error classesjwt-middleware.ts
- Express middleware for determining authentication statuslog-timestamps.ts
- Utilities for adding timestamps to console logging functionsmigrate.ts
- User profile migrationoauth-types.ts
- OAuth typespasswords.ts
- Password utilitiesplatform.ts
- Platform-specific utilitiespush-service.ts
- Push notification servicerouter.ts
- Routes app URLs to controllerssleep.ts
- Small utility to implement a promise-based sleeptunnel-service.ts
- Utilities to determine state of tunnel and manage the PageKite processuser-profile.ts
- Manages persistent user datautils.ts
- Various utility functionswifi-setup.ts
- Initial Wi-Fi setup code for Raspberry Pi OSstatic/
- Static CSS, JavaScript & image resources for web app front endtools/
- Helpful utilities (not part of the build)package.json
- npm module manifestPlease login to review this project.
No reviews for this project yet.
Open Source IoT Platform with a wide range of integration o…
Open source “Internet of Things” application and API to sto…
Open-source IoT Platform - Device management, data collecti…
Comments (0)
Please login to join the discussion on this project.