diff --git a/homematic/CHANGELOG.md b/homematic/CHANGELOG.md index aace6f4..b3a2f44 100644 --- a/homematic/CHANGELOG.md +++ b/homematic/CHANGELOG.md @@ -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 diff --git a/homematic/Dockerfile b/homematic/Dockerfile index dc46aa6..8a2a2ad 100644 --- a/homematic/Dockerfile +++ b/homematic/Dockerfile @@ -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" ] diff --git a/homematic/build.json b/homematic/build.json index 5209a55..dae172d 100644 --- a/homematic/build.json +++ b/homematic/build.json @@ -4,6 +4,6 @@ "i386": "homeassistant/i386-base-ubuntu:18.04" }, "args": { - "OCCU_VERSION": "3.47.10" + "OCCU_VERSION": "3.47.18-1" } } diff --git a/homematic/config.json b/homematic/config.json index 14f31eb..381f145 100644 --- a/homematic/config.json +++ b/homematic/config.json @@ -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" diff --git a/homematic/data/config/HMServer.conf b/homematic/data/config/HMServer.conf new file mode 100644 index 0000000..7b17760 --- /dev/null +++ b/homematic/data/config/HMServer.conf @@ -0,0 +1,2 @@ +hmServerPort=9292 +regaPort=8183 diff --git a/homematic/data/config/InterfacesList.xml b/homematic/data/config/InterfacesList.xml new file mode 100644 index 0000000..83b938e --- /dev/null +++ b/homematic/data/config/InterfacesList.xml @@ -0,0 +1,32 @@ + + + + + + VirtualDevices + xmlrpc://127.0.0.1:9292/groups + Virtual Devices + + + + + + diff --git a/homematic/data/crRFD.conf b/homematic/data/config/crRFD.conf similarity index 96% rename from homematic/data/crRFD.conf rename to homematic/data/config/crRFD.conf index 87166b8..e413b93 100644 --- a/homematic/data/crRFD.conf +++ b/homematic/data/config/crRFD.conf @@ -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 diff --git a/homematic/data/hs485d.conf b/homematic/data/config/hs485d.conf similarity index 100% rename from homematic/data/hs485d.conf rename to homematic/data/config/hs485d.conf diff --git a/homematic/data/log4j.xml b/homematic/data/config/log4j.xml similarity index 100% rename from homematic/data/log4j.xml rename to homematic/data/config/log4j.xml diff --git a/homematic/data/config/rega.conf b/homematic/data/config/rega.conf new file mode 100644 index 0000000..7ef574f --- /dev/null +++ b/homematic/data/config/rega.conf @@ -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 diff --git a/homematic/data/rfd.conf b/homematic/data/config/rfd.conf similarity index 100% rename from homematic/data/rfd.conf rename to homematic/data/config/rfd.conf diff --git a/homematic/data/hm-interface.sh b/homematic/data/hm-interface.sh new file mode 100755 index 0000000..eb18caa --- /dev/null +++ b/homematic/data/hm-interface.sh @@ -0,0 +1,28 @@ +#!/bin/bash + + +function enable_interface(){ + local name=$1 + + sed -i "//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 +} \ No newline at end of file diff --git a/homematic/data/run.sh b/homematic/data/run.sh index ac60880..b5b6ee4 100755 --- a/homematic/data/run.sh +++ b/homematic/data/run.sh @@ -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