All Projects → wirepas → gateway

wirepas / gateway

Licence: Apache-2.0 License
Wirepas's Linux gateway reference implementation built on top of Wirepas's dual mcu api and Wirepas' gateway to backend api

Programming Languages

python
139335 projects - #7 most used programming language
c
50402 projects - #5 most used programming language
shell
77523 projects
Dockerfile
14818 projects
Makefile
30231 projects

Projects that are alternatives of or similar to gateway

lua-systemd
Systemd bindings for Lua
Stars: ✭ 33 (-25%)
Mutual labels:  dbus
OmniPause
Control all of your media players with a single command
Stars: ✭ 33 (-25%)
Mutual labels:  dbus
mijia-homie
A Homie MQTT bridge for the Xiaomi Mijia 2 hygrometer-thermometer. This repo also serves as the monorepo for a handful of helper crates related to Homie and Bluetooth.
Stars: ✭ 40 (-9.09%)
Mutual labels:  dbus
awesome-power widget
A Power widget for the Awesome Window Manager
Stars: ✭ 25 (-43.18%)
Mutual labels:  dbus
yet-another-spotify-lyrics
Command Line Spotify Lyrics with Album Cover
Stars: ✭ 78 (+77.27%)
Mutual labels:  dbus
node-dbus-next
🚌 The next great dbus library for node
Stars: ✭ 141 (+220.45%)
Mutual labels:  dbus
InitWare
The InitWare Suite of Middleware allows you to manage services and system resources as logical entities called units. Its main component is a service management ("init") system.
Stars: ✭ 164 (+272.73%)
Mutual labels:  dbus
yags
Go powered statusline generator
Stars: ✭ 18 (-59.09%)
Mutual labels:  dbus
mpris-rs
Idiomatic MPRIS D-Bus interface library for Rust
Stars: ✭ 37 (-15.91%)
Mutual labels:  dbus
java-systemd
Java access to systemd via D-Bus
Stars: ✭ 32 (-27.27%)
Mutual labels:  dbus
NetworkManager-WiFi-WebUI
Web interface (python2/twisted) for NetworkManager daemon to manage WiFi connections
Stars: ✭ 42 (-4.55%)
Mutual labels:  dbus
bluez-dbus
bluetooth library for linux OSes using DBus and bluez (http://www.bluez.org/).
Stars: ✭ 49 (+11.36%)
Mutual labels:  dbus
xmonad-log
DBus monitor for xmonad log events.
Stars: ✭ 31 (-29.55%)
Mutual labels:  dbus
gtk-sni-tray
A StatusNotifierHost widget written using the gtk+3 bindings for haskell provided by gi-gtk.
Stars: ✭ 24 (-45.45%)
Mutual labels:  dbus
bitw
Minimalist BitWarden client
Stars: ✭ 110 (+150%)
Mutual labels:  dbus
dbus-java
Improved version of java DBus library provided by freedesktop.org (https://dbus.freedesktop.org/doc/dbus-java/)
Stars: ✭ 124 (+181.82%)
Mutual labels:  dbus
dasbus
DBus library in Python 3
Stars: ✭ 52 (+18.18%)
Mutual labels:  dbus
usblockout
USBLockout monitors your user session and triggers Grsecurity Deny New USB feature.
Stars: ✭ 52 (+18.18%)
Mutual labels:  dbus
gonetworkmanager
Go D-Bus bindings for NetworkManager
Stars: ✭ 54 (+22.73%)
Mutual labels:  dbus
softwarecontainer
Framework to manage and contain applications in an automotive setting
Stars: ✭ 19 (-56.82%)
Mutual labels:  dbus

Wirepas Linux Gateway

Codacy Badge Build Status

Gateway overview

This repository contains Wirepas' reference gateway implementation, which relies on a set of services to exchange data from/to a Wirepas Mesh network from/to a MQTT broker or host device. The implemented API is described here.

The services will be known from now on as sink service and transport service. The sink service is responsible to interface locally with a Wirepas device running its Dual MCU API. The transport service packs network messages on protobuffers and publishes them on top of MQTT according to Wirepas Backend API.

Figure 1, provides an overview of the gateway implementation and the apis involved at each step.

Wirepas gateway architecture

Figure 1 - Gateway services overview.

Option 1: native installation

Requirements

The implementation is based on DBus. The C binding used to access DBus is sdbus from systemd library so even if systemd is not required to be running, the libsystemd must be available.

Systemd version must be higher or equal to 221. You can check it with:

systemd --version

In order to build the sink service or the transport python wheel that contains C extensions, systemd headers are needed

sudo apt install libsystemd-dev

Python 3 and a recent pip version (>= 18.1)

sudo apt install python3 python3-dev python3-gi
wget https://bootstrap.pypa.io/get-pip.py \
   && sudo python3 get-pip.py && rm get-pip.py \
   && sudo pip3 install --upgrade pip

Installation

The implementation uses system bus that has enforced security. In order to obtain a service name on system bus, the user launching the sink service must be previously declared to system. Provided file com.wirepas.sink.conf must be copied under /etc/dbus-1/system.d/ and edited with the user that will launch the sink_service (and transport service).

To change the default wirepas user, please edit the following lines from com.wirepas.sink.conf:

    <!-- Only wirepas user can own the service name -->
    <policy user="wirepas">

It is recommended to restart your gateway once this file is copied.

Sink service

You can either build yourself the sink service by foolowing instructions from sink_service folder or you can use prebuilt version available for each release on release section of this repository. Download the one for your architecture (Arm or Amd64)

Transport service

To build the wheel yourself, please refer to the transport's service readme file.

Alternatively, you can use prebuilt Python wheels. You can either get it through PyPi or from the release section of this repository.

The library contains a c extension which will be compiled upon installation (even with prebuilt wheel). Please ensure that you have met all the build requirements prior to attempting the installation.

If you get the wheel from release section of this repository:

    pip3 install wirepas_gateway-*.tar.gz

or from PyPi

    pip3 install wirepas_gateway

Configuration and starting services

Sink service configuration

A sink service must be started for each connected sink on Gateway:

    sink_service/build/sinkService -p <uart_port> -b <bitrate> -i <sink_id>

Parameters are:

  • uart_port: uart port path (default: /dev/ttyACM0)
  • bitrate: bitrate of sink uart (default: auto baudrate. 125000, 115200 and 1000000 bps are tested)
  • sink_id: value between 0 and 9 (default: 0).

If multiple sinks are present, they must have a different sink_id.

Transport service configuration

Parameters can be set from command line or from a setting file in YAML format. To get the full list of parameters, please run:

    wm-gw --help

From command line

Here is an example to start the transport module from the command line:

    wm-gw \
          --mqtt_hostname "<server>" \
          --mqtt_port <port> \
          --mqtt_username <user> \
          --mqtt_password <password> \
          [--mqtt_force_unsecure] \
          --gateway_id <gwid> \

where:

  • mqtt_hostname: Hostname or IP where the MQTT broker is located

  • mqtt_port: MQTT port

  • mqtt_username: MQTT user

  • mqtt_password: MQTT password

  • mqtt_force_unsecure: Toggle to disable TLS handshake. Necessary to establish connections to unsecure port (default: 1883).

  • gateway_id: The desired gateway id, instead of a random generated one

    It must be unique for each gateway reporting to same broker

From configuration file

    wm-gw --settings=settings_files.yml

All parameters that are accepted by the transport service can be set through the settings file. An example of a settings_file.yml file is given below:

    #
    # MQTT brocker Settings
    #
    mqtt_hostname: <IP or hostname where the MQTT broker is located>
    mqtt_port: <MQTT port (default: 8883 (secure) or 1883 (local))>
    mqtt_username: <MQTT user>
    mqtt_password: <MQTT password>
    mqtt_force_unsecure: <true | false>

    #
    # Gateway settings
    #
    gateway_id: <The desired gateway id, must be unique for each gateway>
    gateway_model: <Custom gateway model, can be omitted>
    gateway_version: <Custom gateway version, can be omitted>

    #
    # Filtering Destination Endpoints
    #
    ignored_endpoints_filter: <Endpoints to filter out. Ex: [1, 2, 10-12]>
    whitened_endpoints_filter: <Endpoints to whiten. Ex: [1, 2, 10-12]>

Optional

Start services with systemd

Please see this Wiki entry

See local messages on Dbus interface

Launch local gateway process to see messages received from sinks at Dbus level. It can be launched from the command line with:

wm-dbus-print
Configure a sink locally

There is a script installed along the Wirepas Transport wheel that allow the configuration of sinks locally

Please see its help page for more information.

wm-node-config --help

Option 2: Docker installation

In order to ease the installation in a Docker environment, please see the instruction in docker folder. The Docker files under container folder are still used for our internal CI but must no be used for other purposes. They will be removed at some point.

Contributing

We welcome your contributions!

Please read the instructions on how to do it and please review our code of conduct.

License

Copyright 2019 Wirepas Ltd licensed under Apache License, Version 2.0 See file LICENSE for full license details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].