/dobaos

hello, friend

about

Dobaos is an implementation of Bus Access Object Server(BAOS) binary protocol for Weinzierl 83x modules. Dobaos was written in a D programming language and is suitable for embedded Linux computers due to small resource consumption.

The main feature is to provide JSON API over binary protocol for multiple clients.

Messages between dobaos process and clients has following form:

{
  "method": "set value",
  "payload": [{
        "id": 1,
        "value": 1
    }, {
        "id": 2,
        "value": 27.3
    }]
}

Datapoint values are automatically converted.

getting started

pre-requisites

Required: redis-server.

For Debian-based distros:

sudo apt-get install redis-server

Optional: nodejs for dobaos.tool cli interface.

For Debian-based distros:

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs

installation

Check out /downloads section.

Compile yourself or purchase binaries from there.

Program device via ETS.

Use Weinzierl BAOS 830 application.

ets

If you have existing connection to KNX bus(USB/IP interface) - just use it. If not - you can put 83x module into LinkLayer mode and use llsdk as a gateway. To do so make sure at first that dobaos process is stopped and UART device is not used by another process.

Then run llpub and llnet apps at the same time(use two different ssh sessions or terminal multiplexer).

If you are using purchased binaries:

sudo sw2ll

ETS will not discover automatically our KNXNet/IP gateway because this feature is not implemented in llnet app. Add it manually: put your single board computer ip address, port 3671 and don’t forget to set “NAT” checkbox.

ip interface settings

To put BAOS module into programming mode use llprog tool:

llprog -m 1

Run.

Make sure that llpub process is not running. You may use sw2baos script.

For a first time running it is recommended to set device path explicitly:

dobaos -d /dev/ttyS1

Default is /dev/ttyAMA0.

dobaos.tool

Install:

sudo npm install -g dobaos.tool

Run:

dobaos-tool

This tool provides command-line interface for dobaos service.

Examples:

Print out description of all configured datapoints:

description *

Get value of multiple datapoints:

get 1 2 3

Set value of multiple datapoint:

set [1: true, 2: 0, 3: 34.5]

node-red

Install node-red

npm install -g node-red

Run node-red process so it will create all necessary files in your home directory.

node-red

Go into ~/.node-red directory and install node-red-contrib-dobaos package:

cd ~/.node-red
npm install node-red-contrib-dobaos

Restart node-red process.

There is two nodes:

Datapoint value node trigger new message when datapoint(s) has changed on bus.

Id parameter may have integer value or array of integers to catch multiple datapoints. If id equals 0(zero), then all datapoints will be catch.

datapoint value node

Dobaos method node allows to call dobaos api methods from node-red:

datapoint method node

js library

With this module you can work with datapoints from your nodejs projects.

Installing:

npm install --save dobaos.js

Boilerplate example:

const Dobaos = require("dobaos.js");
const dobaos = Dobaos();

const processBaosValue = function(payload) {
    if (Array.isArray(payload)) {
        return payload.forEach(processBaosValue);
    }

    let {id, value, raw} = payload;
    console.log("datapoint value has changed: ");
    console.log(id, value);
}

dobaos.on("datapoint value", processBaosValue);

dobaos.on("ready", function() {
    console.log("client ready");
});

dobaos.init();

python client

Installation:

pip3 install dobaos

Boilerplate example:

import time
import dobaos

doba = dobaos.Dobaos()

# now process incoming messages
def process_baos_value(payload):
    did = payload['id']
    value = payload['value']
    raw = payload['raw']
    print(did, value, raw)

def process_server_item(payload):
    sid = payload['id']
    value = payload['value']
    print(sid, value)

while True:
    time.sleep(0.01)

    dpoints = doba.get_dpcast()
    for d in dpoints:
        process_baos_value(d)

    sitems = doba.get_sicast()
    for i in sitems:
        process_server_item(i)