Git Product home page Git Product logo

knxnet's Introduction

Build Status

KNXNET

knxnet is a Python3 library to create and decode KNXnet/IP datagram for Tunnelling.

Then you can send/receive the frames to/from a KNXnet/IP gateway with UDP.

This library was developed to suit the needs of the project HES-SO/EMG4B. It is not complete and some commands/parameters are missing.

Installation

python setup.py install

Usage

  • To create a frame you can use the factory:
    BinaryFrame = create_frame(SERVICE_TYPE_DESCRIPTOR, *param)
  • To decode a frame:
    KnxnetObject = decode_frame(frame)

then you have access to all fields in the KNX frame

  • The following SERVICE_TYPE_DESCRIPTOR are available, with the required parameters for frame creation:
 * CONNECTION_REQUEST:
    create_frame(ServiceTypeDescriptor.CONNECTION_REQUEST,
                 CONTROL_ENPOINT,
                 DATA_ENDPOINT)

- CONNECTION_RESPONSE:
    create_frame(ServiceTypeDescriptor.CONNECTION_RESPONSE,
                 CHANNEL_ID,
                 STATUS,
                 DATA_ENDPOINT)

- CONNECTION_STATE_REQUEST
    create_frame(ServiceTypeDescriptor.CONNECTION_STATE_REQUEST,
                 CHANNEL_ID,
                 CONTROL_ENPOINT)

- CONNECTION_STATE_RESPONSE
    create_frame(ServiceTypeDescriptor.CONNECTION_STATE_RESPONSE,
                 CHANNEL_ID,
                 STATUS)

- DISCONNECT_REQUEST
    create_frame(ServiceTypeDescriptor.DISCONNECT_REQUEST,
                 CHANNEL_ID,
                 CONTROL_ENPOINT)

- DISCONNECT_RESPONSE
    create_frame(ServiceTypeDescriptor.DISCONNECT_RESPONSE,
                 CHANNEL_ID,
                 STATUS)

- TUNNELLING_REQUEST
    create_frame(ServiceTypeDescriptor.TUNNELLING_REQUEST,
                 DEST_GROUP_ADDR,
                 CHANNEL_ID,
                 DATA,
                 DATA_SIZE)

- TUNNELLING_ACK
    create_frame(ServiceTypeDescriptor.TUNNELLING_ACK,
                 CHANNEL_ID,
                 STATUS)
  • Parameters type:

    CONTROL_ENDPOINT is a Hpai object or a tuple with IP as string and port as int: through NAT, put everything to zero ('0.0.0.0', 0)

    DATA_ENDPOINT is a Hpai object or a tuple with IP as string and port as int: through NAT, put everything to zero ('0.0.0.0', 0)

    CHANNEL_ID is a byte

    STATUS is a byte: 0 = all ok

    DEST_GROUP_ADDR is the destination group address as string '16/5/2' or as GroupAdress object

    DATA is a datapoint type (only boolean and 8 bit unsigned are currently supported)

    DATA_SIZE in byte

KNX tunnelling

Tunnelling

Example

Check Actuasim project to see an example of use of the knxnet library. The main application work as a server. A sample client can be found in tests folder.

knxnet's People

Contributors

leadrien avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

k-eex pfpinca

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.