Installationsbeschreibung von Smarthome.py, smartVISU, OWFS, eibd in Verbindung mit dem IBB-Cape auf dem BeagleBoneBlack (nachfolgend BBB)
Vorsicht:
Das ganze ist eine Auflistung der Schritte, die ich bei der Installation notiert habe.
1. Debian Image für BBB erstellen
Dieser Anleitung (klick) downloaden und auf das BBB packen (z.B. WinSCP) (am besten in ein eigenes Verzechnis)
in das Verzeichnis wechseln:
cd /
entpacken:
unzip eibd_debs_armhf.zip
und installieren:
dpkg -i libpthsem20_2.0.8_armhf.deb eibd-server_0.0.5_armhf.deb
evtl. euer Verzeichnis löschen: (optional)
cd ..
rm -r /
Autostart:
nano /etc/init.d/eibd
das Start-Skript einfügen (Beispiel für IBB-Cape):
#!/bin/sh
### BEGIN INIT INFO
# Provides: eibd
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: eibd initscript
# Description: based on init-script from knx-user-forum.de and setup-eibd.sh from KNXlive-project
# Pending: check tpuarts, check KNXnet/IP-Response
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="EIB/KNX daemon"
NAME=eibd
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
DAEMON_ARGS="-e 1.1.0 -c -S -D -i -T --tpuarts-disch-reset --tpuarts-ack-all-group -d -u --pid-file=$PIDFILE tpuarts:/dev/ttyO2"
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
#echo "DEBUG args: $DAEMON_ARGS eibdi: $EIBD_I eibdt: $EIBD_T eibdr: $EIBD_R backend: $EIBD_BACKEND url: $EIBD_URL port: $EIBD_PORT addrtab: $EIBD_BCUADDRTAB"
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
echo "*** Starting $DESC: $NAME using $EIBD_URL"
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
sleep 1
chmod a+rw /tmp/eib
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC using $EIBD_URL" "$NAME"
do_start
case "$?" in
0|1) log_end_msg 0 ;;
2) [ log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
echo "*** Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) log_end_msg 0 ;;
2) [ log_end_msg 1 ;;
esac
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
echo "*** Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
sleep 2
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
chmod setzen
chmod 775 /etc/init.d/eibd
update-rc.d eibd defaults
ausführen
3. owfs und owhttp installieren
Da auf dem IBB-Cape der DS2483 verbaut ist, brauchen wir mindestens owfs-2.9p0
echo "deb experimental main" >> /etc/apt/sources.list
echo "deb testing main" >> /etc/apt/sources.list
apt-get update
da libc6 zu alt ist, müssen wir eine neuere Version installieren (testing)
apt-get -t testing install libc6
ggf. de.UTF8 locals neu generieren
nano /etc/locale.gen
# bei „de_DE.UTF-8 UTF-8“ entfernen
/usr/sbin/locale-gen
owfs installieren
apt-get -t experimental install owserver owhttpd
Config anpassen:
nano /etc/owfs.conf
Zeile mit „FAKE“ ersetzen durch:
server = i2c=ALL:0
owfs neustarten
/etc/init.d/owserver restart
ggf. Einträge aus sources.list entfernen:
nano /etc/apt/sources.list
4. Smarthome.py installieren (nach Smarthome.py Anleitung vorgehen: klick)
NTP-Client installieren:
apt-get install openntpd
Python-Module:
apt-get install python-configobj python-dateutil
für Sonnenstandtrigger folgendes ausführen: (optional)
apt-get install python-pip python-dev
pip install pyephem
Verzeichnis wechseln:
cd /usr/local
Smarthome.py herunterladen:
wget http://github.com/mknx/smarthome/archive/0.9.tar.gz
entpacken:
tar xvzf 0.9.tar.gz
tar.gz löschen:
rm 0.9.tar.gz
Smarthome.py Ordner umbenenen:
mv smarthome-0.9 smarthome
Besitzer wechseln: (optional)
chown -R smarthome
Smarthome-Config erstellen:
nano smarthome/etc/smarthome.conf
Einfügen:
# /usr/local/smarthome/etc/smarthome.conf
lat = 51.1633
lon = 10.4476
elev = 500
tz = 'Europe/Berlin'
Logic-Config erstellen:
leere Datei:
touch smarthome/etc/logic.conf
oder mit Header: (optional)
nano smarthome/etc/logic.conf
und
# /usr/local/smarthome/etc/logic.conf
einfügen
Plugin-Config erstellen:
nano smarthome/etc/plugin.conf
und
# /usr/local/smarthome/etc/plugin.conf
class_path = plugins.knx
# host = 127.0.0.1
# port = 6720
# send_time = 43200 # update date/time every 600 seconds, default none
# time_ga = 5/2/0 # default none
# date_ga = 5/2/1 # default none [sql] class_name = SQL
class_path = plugins.sqlite [visu] class_name = WebSocket
class_path = plugins.visu
# ip='0.0.0.0'
# port=2424
# visu_dir = /var/www/smarthome
smartvisu_dir = /var/www/smartVISU
einfügen.
ins root-Verzechnis wechseln:
cd /
Autostart (Achtung: hier wird der User smarthome voraus gesetzt!):
diese Datei klick )
hier /etc/init.d/ einfügen
chmod ändern
chmod 777 /etc/init.d/smarthome.py
update-rc.d smarthome.py defaults
ausführen
5. smartVISU installieren
bei mir war der Apche2 installiert, daher diesen deinstallieren:
apt-get autoremove apache2
Webserver (lighttpd) und php5 installieren
apt-get install lighttpd php5-cgi php5
Dateiendungen „freischalten“:
nano /etc/lighttpd/conf-available/10-cgi.conf
und editieren:
cgi.assign = (
".pl" => "/usr/bin/perl",
".py" => "/usr/bin/python",
)
php aktivieren:
nano /etc/php5/cgi/php.ini
mit Strg+V ganz nach unten „blättern“ und
cgi.fix_pathinfo=1
aktivieren
und noch
lighttpd-enable-mod fastcgi
lighttpd-enable-mod fastcgi-php
ausführen
in das Verzeichnis des Webservers wechseln
cd var/www
smartVISU downloaden
wget
unzip installieren, da es leider ein *.zip ist
apt-get install unzip
Archiv entpacken:
unzip smartVISU_2.6.zip
Archiv löschen:
rm smartVISU_2.6.zip
Besitzer wechseln
chown -R smartVISU
leere config anlagen
touch /smartVISU/config.php
config.php und /temp beschreibbar machen
chmod 777 smartVISU/config.php
chmod 777 smartVISU/temp
Viel Erfolg!