Giter Site home page Giter Site logo

knx-mqtt-bridge's Introduction

knx-mqtt-bridge

npm license github-issues

A KNX / MQTT bridge

nodei.co

Features

Bridges KNX and MQTT using the knx.js library. A Dockerfile is also provided for creating a working docker container.

KNX events are written to the MQTT topic knx/x/y/z where x/y/z is the group address. Writing to KNX is done by sending an MQTT message to topic knx/x/y/z/write with the value to write as the message. Again x/y/z is the group address to write to. The bridge also supports reading of values by sending an MQTT message to knx/x/y/z/read.

It's highly recommended to provide an ETS export of all the group addresses and their corresponding datapoint types. By doing this, values will be automatically converted from and to its raw type. If you are reading or writing to an unknown group address the raw byte buffer is what's being communicated and you would need to convert back and forth yourself.

Providing an ETS export is done by exporting an XML of all group addresses and its datapoint types from the ETS software. This file is then referenced from the configuration file.

Install

npm install -g knx-mqtt-bridge

Run

KNX_MQTT_CONFIG=config.yaml knx-mqtt-bridge

Configuring

See config.example.yaml for a configuration example. By default, the bridge will try to connect to a KNX router using the multicast address. If you prefer unicast you can add ipAddr and ipPort to the options block under knx in the configuration file.

Usage

Writing values to a mapped group address is straight forward. Send a message to knx/x/y/z/write with the value to write. However, if the group address is not mapped to a datapoint you can still write to that group address but you would have to provide the raw buffer yourself. Again, you can still write to knx/x/y/z/write, however knx-mqtt-bridge need to know the datapoint type of the address you are writing to for proper conversion. This is especially true for dpt1, dpt2 and dpt3. In this case you pass that information to the topic, like so: knx/x/y/z/write/dpt1. For instance, if you would want to send a 1/true to light switch using mosquitto_pub it could look something like this: mosquitto_pub -h localhost -t 'knx/1/1/65/write/dpt1' -m "{\"type\":\"Buffer\",\"data\":[1]}". For any datapoint other than dpt1, dpt2 or dpt3 you don't need to pass that additional information.

Dependencies

Package Version Dev
js-yaml 3.12.0
knx >=2.3.0
mqtt ^2.18.1
winston 3.0.0
xml-js 1.6.4

License

knx-mqtt-bridge's People

Contributors

dersimn avatar pakerfeldt avatar qm3ster avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.