Add homematic regahss support (#704)

* Add homematic regahss support

* Fix

* fix-data

* fix link

* Fix name

* Fix startup commands

* Fix path

* Optimaze

* Fix rega config handling

* Fix style for config

* Fix HMServer jar

* Dynamic interfaces

* fix chmod

* Fix variable

* Update changelog

* Fix lint

* Add webinterface link
This commit is contained in:
Pascal Vizeli
2019-09-23 14:45:11 +02:00
committed by GitHub
parent a9e4163670
commit 1a4e604de4
13 changed files with 196 additions and 12 deletions

View File

@@ -1,5 +1,10 @@
# Changelog
## 9.0
- Add Regahss (WebUI) support (experimentel)
- Update OCCU to 3.47.18
## 8.3
- Update OCCU to 3.47.10

View File

@@ -9,6 +9,7 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
libusb-1.0 \
lighttpd \
openjdk-11-jre-headless \
&& rm -rf /var/lib/apt/lists/*
@@ -17,7 +18,7 @@ ARG BUILD_ARCH
# Install OCCU
WORKDIR /usr/src
RUN curl -SL https://github.com/eq-3/occu/archive/${OCCU_VERSION}.tar.gz | tar xzf - \
RUN curl -SL https://github.com/jens-maus/occu/archive/${OCCU_VERSION}.tar.gz | tar xzf - \
&& cd occu-${OCCU_VERSION} \
&& mkdir -p /opt/hm \
&& mkdir -p /opt/hm/etc/config \
@@ -25,38 +26,55 @@ RUN curl -SL https://github.com/eq-3/occu/archive/${OCCU_VERSION}.tar.gz | tar x
&& mkdir -p /opt/HMServer \
&& mkdir -p /var/status \
&& mkdir -p /boot \
\
&& echo "VERSION=${OCCU_VERSION}" > /boot/VERSION \
&& ln -s /opt/hm/etc/config /etc/config \
\
&& if [ "${BUILD_ARCH}" = "armv7" ]; \
then \
cd arm-gnueabihf; \
else \
cd X86_32_Debian_Wheezy; \
fi \
\
&& cp -R packages-eQ-3/RFD/bin /opt/hm/ \
&& cp -R packages-eQ-3/RFD/lib /opt/hm/ \
&& cp -R packages-eQ-3/RFD/opt/HmIP/* /opt/HmIP/ \
&& cp -R packages-eQ-3/LinuxBasis/bin /opt/hm/ \
&& cp -R packages-eQ-3/LinuxBasis/lib /opt/hm/ \
&& cp -R packages-eQ-3/HS485D/bin /opt/hm/ \
&& cp -R packages-eQ-3/HS485D/lib /opt/hm/ \
&& rm -f packages-eQ-3/WebUI/bin/ReGa* \
&& cp -R packages-eQ-3/WebUI/bin /opt/hm/ \
&& cp -R packages-eQ-3/WebUI/lib /opt/hm/ \
&& rm -rf packages-eQ-3/WebUI/etc/config* packages-eQ-3/WebUI/ect/rega.conf \
&& cp -R packages-eQ-3/WebUI/etc/* /opt/hm/etc/ \
&& cp -R packages-eQ-3/WebUI-Beta/bin /opt/hm/ \
&& rm -f packages/lighttpd/etc/lighttpd/lighttpd_ssl.conf \
&& cp -R packages/lighttpd/etc/lighttpd /opt/hm/etc/ \
&& cd ../ \
\
&& cp -r firmware / \
&& mv /firmware/HmIP-RFUSB/hmip_coprocessor_update.eq3 /firmware/HmIP-RFUSB/hmip_coprocessor_update-2.8.6.eq3 \
&& cp -R HMserver/opt/HmIP/* /opt/HmIP/ \
&& cp -a HMserver/opt/HMServer/HMIPServer.jar /opt/HMServer/ \
&& cp -a HMserver/opt/HMServer/*.jar /opt/HMServer/ \
&& cp -R HMserver/opt/HMServer/groups /opt/HMServer/ \
&& cp -R HMserver/opt/HMServer/measurement /opt/HMServer/ \
&& cp -R HMserver/opt/HMServer/pages /opt/HMServer/ \
&& cp -R WebUI/* / \
&& ln -s /www /opt/hm/www \
\
&& touch /opt/hm/etc/config/userAckSecurityHint \
&& touch /opt/hm/etc/config/firewallConfigured \
\
&& rm -rf /usr/src/occu-${OCCU_VERSION}
ENV HM_HOME=/opt/hm LD_LIBRARY_PATH=/opt/hm/lib:${LD_LIBRARY_PATH}
# Update config files
COPY data/rfd.conf data/hs485d.conf data/crRFD.conf data/log4j.xml /etc/config/
COPY data/config/* /opt/hm/etc/config/
# Setup start script
COPY data/run.sh /
COPY data/hm-firmware.sh /usr/lib/
COPY data/hm-firmware.sh data/hm-interface.sh /usr/lib/
WORKDIR /data
CMD [ "/run.sh" ]

View File

@@ -4,6 +4,6 @@
"i386": "homeassistant/i386-base-ubuntu:18.04"
},
"args": {
"OCCU_VERSION": "3.47.10"
"OCCU_VERSION": "3.47.18-1"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "HomeMatic OCCU",
"version": "8.3",
"name": "HomeMatic CCU",
"version": "9.0",
"slug": "homematic",
"description": "HomeMatic central based on OCCU",
"url": "https://home-assistant.io/addons/homematic/",
@@ -11,12 +11,15 @@
"auto_uart": true,
"gpio": true,
"apparmor": false,
"webui": "http://[HOST]:[PORT:80]/",
"ports": {
"80/tcp": null,
"2001/tcp": 2001,
"2000/tcp": 2000,
"2010/tcp": 2010
},
"ports_description": {
"80/tcp": "Regahss Webinterface",
"2001/tcp": "Homematic xmlrpc",
"2000/tcp": "HomematicWire xmlrpc",
"2010/tcp": "HomematicIP xmlrpc"

View File

@@ -0,0 +1,2 @@
hmServerPort=9292
regaPort=8183

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8" ?>
<interfaces v="1.0">
<!--rf
<ipc>
<name>BidCos-RF</name>
<url>xmlrpc_bin://127.0.0.1:2001</url>
<info>BidCos-RF</info>
</ipc>
rf-->
<ipc>
<name>VirtualDevices</name>
<url>xmlrpc://127.0.0.1:9292/groups</url>
<info>Virtual Devices</info>
</ipc>
<!--ip
<ipc>
<name>HmIP-RF</name>
<url>xmlrpc://127.0.0.1:2010</url>
<info>HmIP-RF</info>
</ipc>
ip-->
<!--wired
<ipc>
<name>Hm-Wired</name>
<url>xmlrpc://127.0.0.1:2000</url>
<info>Hm-Wired</info>
</ipc>
wired-->
</interfaces>

View File

@@ -1,6 +1,6 @@
Config.Dir=/data/crRFD
#Config.Include=hmip_user.conf
Config.Include=/data/hmip_user.conf
# Directory Configuration
Persistence.Home=/data/crRFD

View File

@@ -0,0 +1,72 @@
################################################################################
# rega.conf
# Standard-Einstellungen für die logikschicht
################################################################################
#*******************************************************************************
# Pfade für Konfiguration-Dateien
#*******************************************************************************
# UserConfigFileName
# Benuterdefinierte Konfigurationdatei.
# Diese Datei kann die hier festgelegten Werte überschreiben, z.B. das
# Session-Timeout
# Standard: /etc/config/rega.conf
UserConfigFileName=/data/rega_user.conf
# DomFileName
# DOM-Datei. Enthält das Objekt Modell (Programme, Systemvariablen, ...)
# Standard: /etc/config/homematic.regadom
DomFileName=/data/homematic.regadom
# TimeConfigFileName
# Enthält Zeit- und Positionseinstellungen.
# Standard: /etc/config/time.conf
TimeConfigFileName=/etc/config/time.conf
# XmlRpcFileName
# Enthält die Liste der unterstützen Schnittstellen zur
# Anbindung von HomeMatic Geräten
# Standard: /etc/config/InterfacesList.xml
XmlRpcFileName=/etc/config/InterfacesList.xml
#*******************************************************************************
# HTTP-Einstellungen
#*******************************************************************************
# HttpDocPath
# Pfad des HTTP-Root-Verzeichnisses
# Standard: /www/rega
HttpDocPath=/www/rega
# HttpListenerPort
# Portnummer des WebServers
# Standardwert: 8181
HttpListenerPort=8183
# VirtualPathInternalConfig
# Standard: /config/
VirtualPathInternalConfig=/config/
# VirtualPathInternalConfigDest
# Standard: 80:/config/
VirtualPathInternalConfigDest=80:/config/
# SessionTimout
# Zeit in Sekunden, nach der eine Session abläuft.
# Standard: 300
SessionTimeout=300
#*******************************************************************************
# Ereignisse
#*******************************************************************************
# OnStartup
# Wird nach dem Laden des DOM ausgelöst
# Standard: /bin/hm_startup
OnStartup=/bin/hm_startup
# OnAddDevice
# Wird beim Hinzufügen eines Geräts ausgeführt
# Standard: /bin/hm_autoconf
OnAddDevice=/bin/hm_autoconf

28
homematic/data/hm-interface.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
function enable_interface(){
local name=$1
sed -i "/<!--$name/d" /etc/config/InterfacesList.xml
sed -i "/$name-->/d" /etc/config/InterfacesList.xml
}
function init_interface_list() {
local rf=$1
local ip=$2
local wired=$3
if [ "$rf" == "true" ]; then
enable_interface "rf"
fi
if [ "$ip" == "true" ]; then
enable_interface "ip"
fi
if [ "$wired" == "true" ]; then
enable_interface "wired"
fi
}

View File

@@ -1,4 +1,5 @@
#!/bin/bash
# shellcheck disable=SC1091
set -e
CONFIG_PATH=/data/options.json
@@ -18,8 +19,17 @@ mkdir -p /data/crRFD
mkdir -p /data/rfd
mkdir -p /data/hs485d
# shellcheck disable=SC1091
# Init files
touch /data/hmip_user.conf
touch /data/rega_user.conf
touch /data/homematic.regadom
# Import helpers
. /usr/lib/hm-firmware.sh
. /usr/lib/hm-interface.sh
# Setup Interfaces
init_interface_list "$RF_ENABLE" "$HMIP_ENABLE" "$WIRED_ENABLE"
# RF support
if [ "$RF_ENABLE" == "true" ]; then
@@ -117,6 +127,9 @@ if [ "$HMIP_ENABLE" == "true" ]; then
sleep 30
cp -f /etc/config/hmip_address.conf /data/
fi
else
java -Xmx64m -Dlog4j.configuration=file:///etc/config/log4j.xml -Dfile.encoding=ISO-8859-1 -jar /opt/HMServer/HMServer.jar /etc/config/HMServer.conf &
WAIT_PIDS+=($!)
fi
# Register stop
@@ -128,7 +141,18 @@ function stop_homematic() {
}
trap "stop_homematic" SIGTERM SIGHUP
# sync time periodically
# Wait until interfaces are initialized
sleep 30
# Start Regahss
"$HM_HOME/bin/ReGaHss" -f /etc/config/rega.conf &
WAIT_PIDS+=($!)
# Start WebInterface
lighttpd-angel -D -f /opt/hm/etc/lighttpd/lighttpd.conf &
WAIT_PIDS+=($!)
# Sync time periodically
if [ "$RF_ENABLE" == "true" ]; then
while true
do