Skip to main content

Python bindings for KNX

Project description

CONTENT OF THE PYKNX PACKAGE - lwknxclient.py: simple script used to query object value or to set object value. - configure.py: script that patches the linknx XML configuration file to add special rule in order to make the communicator work with linknx. - communicator.py: daemon that is intended to run next to linknx and to catch events from it. It is then easy to write callbacks to react to object modifications. - linknx.py: common module that implement basic functionality for the whole package. The end user is unlikely to use it directly but it can be helpful for people who want to develop new modules that have to interact with linknx.

HOW TO SETUP THE COMMUNICATOR One should edit its linknx configuration file in order to add an attribute “pyknxcallback” to objects for which a python callback should be called whenever their value changes. For instance, here is a valid object definition for the communicator: <object id=”myobject” type=”5.xxx” init=”request” pyknxcallback=”onMyObjectChanged”>This is my object</object>

Then, run the configure.py script to let it automatically patch this xml file. It will add a rule per object that needs to communicate with the communicator. The output file is not expected to be changed by hand after this patch. You are encouraged to always work on the unpatched config file, then to run the configure script again.

In a file of your own, implement the python functions called after the names given in the pyknxcallback attributes. Following the example above, our user script should implement at least one function, named ‘onMyObjectChanged()’. The function should have a single parameter that is the current object value.

Start linknx with the patched configuration file as input.

Start the communicator.py daemon once you want it to react to linknx. On the command line, specify the user script you set up in a previous step. The communicator can also be started before linknx, this is juste a matter of taste. Now, every time the target linknx objects change, the dedicated python callback should be called!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyknx-0.0.1.tar.gz (7.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page