Calibrì – EIB on a MySQL database




Introduction


Calibrì is based on the Calimero libraries, these handle all communication between Calibrì itself and the EIB gateway.

This project was born to cope with the lack of software to easily read and write on EIB bus systems from a Server/PC. It also aims at giving a standard interface (MySQL) on which you can build your own software to manage EIB bus installations.



What is Calibrì?


Calibrì is an open source (GPL) project to read and write telegrams on EIB Bus systems. This can be done by reading and writing on Calibrì's MySQL tables.

We decided to use one of the most standard interfaces available on the net, such as the MySQL DBMS, to expose the Bus system and make it accessible from networks or from your local server/PC.

Calibri's database contains three main tables:

  1. TelegramsRead
  2. TelegramsWrite
  3. EibLogger


There is a third table called Log – PLEASE – do not confuse Log with EibLogger, they do two different things...

Default username and password for the database are domotica and calibri respectively (they are hard-coded into the program ... I know this is not the best solution ever but I will keep it this way for now, there might be space for implementing a config file driven parameterization in the future).

Calibrì sits on a tight loop to check for changes in the TelegramsWrite table, this is used to send telegrams on the BUS, a new message can be sent only if its primary and secondary types are defined in the TelegramsRead table. The TelegramsRead table copes with two important functions:


  1. To provide the latest value of a specific Group Address (GA hereafter) that has been seen on the BUS.
  2. To define, for each GA, its Primary and Secondary Type (or DPT).


Please note that if no DPT is given for a specific GA its value cannot be read correctly, therefore Calibrì will give a String representation of the Message object associated with that specific Message (pretty useless, might be improved in the future ... ).

Calibrì will not appreciate if you will insert wrong types in the TelegramsRead table. In fact, at present time, there is no catching of such an occurrence and therefore the problem is forwarded to the Calimero libraries.

You can find more information about Primary and Secondary DPTs on Calimero libraries' website.

The EibLogger table, instead, gives an historic view of the BUS installation, recording each single message value up to 15 days in the past. Again, no correct values are given if Primary and Secondary DPTs are not set correctly.

Calibrì's database, at present time, is far from being optimized. It is quite verbose and expensive Java operations that could be demanded to the DBMS are instead executed in “Java-land” (e.g. Date and Time calculations). This will be one of the first points we will be focusing on in the next releases of Calibrì.



Rady, set, GO!


First of all you need a KNXnet/IP router, whatever brand should work. I tried several and they all worked great. Refer to Calimero's website for more information about this.


Un-Tar the archive:

tar xvfz Calibri.tar.gz

cd Calibri



Import Calibrì's databse and set some permissions:

mysql < src/db/Calibri.sql -u root -p

mysql -u root -p

CREATE USER domotica IDENTIFIED BY 'calibri';

GRANT ALL PRIVILEGES ON *.* TO 'domotica'@'%'
IDENTIFIED BY 'calibri' WITH GRANT OPTION;

exit;


Get started, the easy (and dirty) way!

cd bin/lib

java -jar calibri.jar --ip YourEIBRouter-IPAddress


DONE! Calibri is now up and running, logging messages on your server. I have also created a small script to make it run as a daemon on linux machines. Here's the source:



#!/bin/sh

start-stop-daemon --start --background --pidfile /var/run/calibri.pid --make-pidfile --exec /path/to/java -- -jar /path/to/your/calibri.jar --ip YourEIB/IP-IPAddress