All the software written by me, described in these pages, is available as open source on github.

Regarding the PIC firmware loaded in the KNXgate board, follow the instructions on the author web site.

As aforementioned, the electrical signals on the KNX bus are converted in 8 bit serial data by the KNXgate hardware. They are interpreted by an application on node.js server and web published via a web server on the same SBC. Both client and server program are written in javascript. With the obvious differences between client and server application, there is a good porting compatibility between the two sides of the system and an effort saving using the same coding language.

To run in polling mode: after init, a timed function asks every 250ms to KNXgate to send the content of its buffer, if available, using the "@r" command.

For interrupt mode: in init procedure use command "@l" to enable continuos log of data received.

Let's analyze the application server part of the program.
In initialization section the program loads all the modules, starts the web server and begins listening for websocket connection requests. Then opens the serial port toward KNXgate and initialize it according to the operating mode needed.
When the "data received from serial" event triggers the listener, the packet decoding function starts separating all the information embedded from the telegram ...
...and prepares a json data structure to send to a potential client.
update on 27-08-2016


Server procedures
The structure of the telegram according to the KNX standard.
In the opposite direction, a web socket listener waits for a connection event. When the json file sent from the client arrives, it is decoded and the corresponding commands are sent to the KNXgate through the serial line in order to control the desired device on the bus.