Difference between revisions of "Install EIB eibd"

From xPL
Jump to: navigation, search
(Install knx)
(Install knx)
Line 29: Line 29:
 
  ^C
 
  ^C
 
As to my understanding, the <code>busmonitor</code> variants work with filters to be defined
 
As to my understanding, the <code>busmonitor</code> variants work with filters to be defined
whilst the <code>vbusmonitor</code> variants show all messages.ps
+
whilst the <code>vbusmonitor</code> variants show all messages.
  
 
Stop the service:
 
Stop the service:

Revision as of 19:48, 7 January 2022

The EIB / KNX bus can be accessed via the eibd daemon. The original distribution at TU Wien is no longer maintained. The work has been taken over on SourceForge.

Before all, make sure you have installed an xPL hub and a control user.

Install knx

Install knxd:

apt install knxd
apt install knxd-tools

Start the daemon:

su control
knxd -b ipt:192.168.1.204

List commands:

knxtool list

Perform a write:

knxtool on ip:localhost 1/1/1
knxtool off ip:localhost 1/1/1

or:

knxtool groupswrite ip:localhost 1/1/1 1
knxtool groupswrite ip:localhost 1/1/1 0

Listen to the KNX telegrams:

knxtool vbusmonitor1time ip:localhost
^C

As to my understanding, the busmonitor variants work with filters to be defined whilst the vbusmonitor variants show all messages.

Stop the service:

pkill eibd
ps ax | grep eibd | grep -v grep

Install xPL EIB bridge

Download the eibd write and eibd read scripts.

Move the script to xPL scripts directory:

SCRIPTS_BASE_DIR=/home/control/Documents/Controls
mv xpl-eib-eibdWrite.pl $SCRIPTS_BASE_DIR
mv xpl-eib-eibdRead.pl $SCRIPTS_BASE_DIR
chown control:users $SCRIPTS_BASE_DIR/*.pl
chmod 775 $SCRIPTS_BASE_DIR/*.pl

Test xPL EIB writer

The test is shown here on a Linux machine such as a BeagleBone. It has to be slightly adapted on Mac OS.

Open a first terminal window (on any machine with xPL installed) and monitor the xPL protocol:

SCRIPTS_BASE_DIR=/home/control/Documents/Controls
$SCRIPTS_BASE_DIR/xpl-monitor.pl -vf

If the eibd daemon isn't running, launch it in a second window:

su control
eibd -S -D -i --daemon=/var/log/eibd.log ipt:192.168.1.204

Then launch the eibd monitor:

groupsocketlisten ip:localhost

In another terminal window, start the xPL EIB writer:

su control
SCRIPTS_BASE_DIR=/home/control/Documents/Controls
$SCRIPTS_BASE_DIR/xpl-eib-eibdWrite.pl -v -n home

Open yet another terminal and send a message to the EIB tunnelling server:

su control
SCRIPTS_BASE_DIR=/home/control/Documents/Controls
$SCRIPTS_BASE_DIR/xpl-send.pl -v -t cmnd -d dspc-eib.home -c eib.basic group='1/1/1' data=0x01

This should turn on EIB device 1/1/1. The groupsocketlisten window should show the eibd write command.

If no more testing is wanted, stop the EIB daemon:

pkill eibd
ps ax | grep eibd | grep -v grep

Test xPL EIB reader

Open a first terminal window (on any machine with xPL installed) and monitor the xPL protocol:

SCRIPTS_BASE_DIR=/home/control/Documents/Controls
$SCRIPTS_BASE_DIR/xpl-monitor.pl -vf

If the eibd daemon isn't running, launch it in a second window:

su control
eibd -S -D -i --daemon=/var/log/eibd.log ipt:192.168.1.204

Then start the xPL EIB reader:

SCRIPTS_BASE_DIR=/home/control/Documents/Controls
groupsocketlisten ip:localhost | $SCRIPTS_BASE_DIR/xpl-eib-eibdRead.pl -v -n home

Push on an EIB button or send a message to the EIB tunnelling server:

su control
groupswrite ip:localhost 1/1/1 1
groupswrite ip:localhost 1/1/1 0

The EIB activity should appear in the xpl-monitor.pl window.

Stop the EIB daemon:

pkill eibd
ps ax | grep eibd | grep -v grep

Launch the xPL EIB interface at startup

The EIB writer is to be launched after the xPL hub. The EIB reader is launched as a pre-start script.

Debian with SystemD

On Debian with systemd (such as Raspbian or Ubuntu), the scripts can be defined as services.

Edit /lib/systemd/system/eib.service:

[Unit]
Description=eib over Ethernet
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=control
Group=users
ExecStart=/usr/local/bin/eibd -S -D -i ipt:192.168.1.204
Restart=always

[Install]
WantedBy=multi-user.target


Edit /lib/systemd/system/xpl-eib-write.service:

[Unit]
Description=xPL eib write
After=xpl-hub.service eib.service

[Service]
Type=simple
User=control
Group=users
ExecStart=/home/control/Documents/Controls/xpl-eib-eibdWrite.pl -n home
Restart=always

[Install]
WantedBy=multi-user.target


Edit /lib/systemd/system/xpl-eib-read.service:

[Unit]
Description=xPL eib read
After=xpl-hub.service eib.service

[Service]
Type=simple
User=control
Group=users
ExecStart=/bin/bash -c '/usr/local/bin/groupsocketlisten ip:localhost | /home/control/Documents/Controls/xpl-eib-eibdRead.pl -n home'
Restart=always

[Install]
WantedBy=multi-user.target

Activate the services:

su
systemctl enable eib.service
service eib start
systemctl enable xpl-eib-write.service
service xpl-eib-write start
systemctl enable xpl-eib-read.service
service xpl-eib-read start

Reboot and check:

ps aux | grep -v grep | grep -i xpl
ps ax | grep -i xpl | grep -v grep | sed 's/.*\/Controls\///'
systemctl list-units --type=service --state=running | grep eib
service xpl-eib* status

Ubuntu with Upstart

Edit /etc/init/xpl-eib.conf:

################################################################################
# xPL EIB interface to an eibd daemon
#
description "xPL EIB interface"
version     "1.0"
author      "Francois Corthay"

#-------------------------------------------------------------------------------
# Configuration variables
#
env SCRIPTS_DIR='/home/control/Documents/Controls'
env EIBD_DIR='/usr/local/bin'
env SCRIPT_NAME='xpl-eib-eibdWrite.pl'
env PARAMETERS='-n home'

#-------------------------------------------------------------------------------
# Start and stop conditions
#
start on xpl-hub_started          
stop on shutdown
respawn
setuid control
setgid users

#-------------------------------------------------------------------------------
# Start eibd daemon and reader before the writer
#
pre-start script
  $EIBD_DIR/eibd -S -D -i -d ipt:192.168.1.204
  $EIBD_DIR/groupsocketlisten ip:localhost | $SCRIPTS_DIR/xpl-eib-eibdRead.pl $PARAMETERS &
end script

#-------------------------------------------------------------------------------
# Stop eib daemon on shutdown
#
pre-stop script
  pkill eibd
end script

#-------------------------------------------------------------------------------
# Start daemon
#
exec $SCRIPTS_DIR/$SCRIPT_NAME $PARAMETERS

Start the device and test it:

su root
killall eibd
service xpl-eib start

su control
SCRIPTS_BASE_DIR=/home/control/Documents/Controls
$SCRIPTS_BASE_DIR/xpl-send.pl -v -t cmnd -d dspc-eib.home -c eib.basic group='1/1/1' data=0x01
$SCRIPTS_BASE_DIR/xpl-send.pl -v -t cmnd -d dspc-eib.home -c eib.basic group='1/1/1' data=0x00

Reboot the PC and check for the daemons:

ps ax | grep -i xpl | grep -v grep
initctl list | grep xpl