Code Monkey home page Code Monkey logo

knxnet_ip's Introduction

KNXnetIP

Build Status License: MIT Hex version Coverage Status

KNXnetIP is an Elixir library for communicating with devices on a KNX network using KNXnet/IP. The library enables its users to build applications which integrate with devices on a KNX network. To achieve this, the library provides:

  • Encoding and decoding of KNXnet/IP frames.
  • Encoding and decoding of KNX telegrams, to control the state of the KNX network (GroupValueRead and GroupValueWrite).
  • Encoding and decoding of all common datatypes.
  • A behaviour for KNXnet/IP tunnelling clients.

KNXnetIP was specifically written to provide a tunnelling client which is:

  • Robust. The tunnelling connection must be maintained even on very lossy IP networks, and it must automatically reconnect when the connection drops.
  • Isolated. One application must be able to have multiple concurrent tunnelling connections to different KNX networks.

If you're new to KNX, please check the KNXnet/IP introduction page for an overview of the most important parts.

To create a KNXnet/IP tunnelling client, you'll need to implement a callback module for the KNXnetIP.Tunnel behaviour. See the documentation for KNXnetIP.Tunnel for a thorough example and in-depth descriptions.

Maturity

The library has been used in production as part of the smart city energy lab EnergyLab Nordhavn since August 2017. It sends and receives telegrams to and from more than 30 apartments - and every month it processes more than 70 million telegrams.

We are quite happy with its performance and fault tolerance, but parts of the API are less than ideal. Fixing this will require breaking the API, so expect changes.

The library implements encoding and decoding of the following data structures:

  • KNXnet/IP services:
    • CONNECT_REQUEST
    • CONNECT_RESPONSE
    • DISCONNECT_REQUEST
    • DISCONNECT_RESPONSE
    • CONNECTIONSTATE_REQUEST
    • CONNECTIONSTATE_RESPONSE
    • TUNNELING_REQUEST
    • TUNNELING_ACK
  • Telegrams (cEMI encoded):
    • L_Data.ind
    • L_Data.con
    • L_Data.req
  • Application services:
    • A_GroupValue_Read
    • A_GroupValue_Response
    • A_GroupValue_Write
  • Datapoint types 1-16, 18 and 20 (main group)

The KNXnetIP.Tunnel behaviour sports the following features:

  • Connect to a KNXnet/IP tunnelling server via. UDP.
  • Retry failed connection attempts using a backoff interval.
  • Perform heartbeating according to the specification, and reconnect if the heartbeat fails due to timeouts or other errors.
  • Disconnect and reconnect if the client receives a DISCONNECT_REQUEST from the tunnelling server.
  • Handle duplicate TUNNELLING_REQUESTS from tunnelling server according to the specification.
  • Send TUNNELLING_REQUESTS to the server, and resend TUNNELLING_REQUEST if no TUNNELLING_ACK is received.
  • Disconnect and reconnect if TUNNELING_ACK is not received or signals an error.

License

KNXnetIP is released under the MIT License. See the LICENSE file for further details.

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.