mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-17 05:04:21 +01:00
HomeMatic: s6-overlay & tempio (#1713)
* HomeMatic: s6-overlay & tempio * Use tempio * fix line end * Fix dev version * Fix bugs
This commit is contained in:
@@ -4,6 +4,8 @@ set -eE
|
||||
DOCKER_TIMEOUT=30
|
||||
DOCKER_PID=0
|
||||
|
||||
SUPERVISOR_VERSON="$(curl -s https://version.home-assistant.io/dev.json | jq -e -r '.supervisor')"
|
||||
|
||||
|
||||
function start_docker() {
|
||||
local starttime
|
||||
@@ -85,7 +87,7 @@ function run_supervisor() {
|
||||
-e SUPERVISOR_NAME=hassio_supervisor \
|
||||
-e SUPERVISOR_DEV=1 \
|
||||
-e SUPERVISOR_MACHINE="qemux86-64" \
|
||||
homeassistant/amd64-hassio-supervisor:dev
|
||||
"homeassistant/amd64-hassio-supervisor:${SUPERVISOR_VERSON}"
|
||||
}
|
||||
|
||||
function init_dbus() {
|
||||
|
||||
@@ -1,157 +1,27 @@
|
||||
# Changelog
|
||||
|
||||
## 10.3
|
||||
## 11.0.0
|
||||
|
||||
- Migrate to s6-overlay & tempio
|
||||
- Update OCCU to 3.55.5-1
|
||||
|
||||
## 10.3.0
|
||||
|
||||
- Flush ReGaHss config on shutdown
|
||||
- Add ReGaHss reset option
|
||||
|
||||
## 10.2
|
||||
## 10.2.0
|
||||
|
||||
- Update Bashio to fix the wait function
|
||||
- Extend the log output
|
||||
|
||||
## 10.1
|
||||
## 10.1.0
|
||||
|
||||
- Fix issue with SSL
|
||||
|
||||
## 10.0
|
||||
## 10.0.0
|
||||
|
||||
- Add Ingress support
|
||||
- Disable external ports per default
|
||||
- Fix wrong version number
|
||||
- Speedup start without sleeps
|
||||
|
||||
## 9.9
|
||||
|
||||
- Update glibc for armv7
|
||||
|
||||
## 9.8
|
||||
|
||||
- Update OCCU to 3.51.6-1
|
||||
|
||||
## 9.7
|
||||
|
||||
- Fix glibc error on i386/amd64
|
||||
|
||||
## 9.6
|
||||
|
||||
- Update OCCU to 3.49.17-4
|
||||
- Use new gcc8 binary for i386
|
||||
- Change ReGaHass to normal version
|
||||
|
||||
## 9.5
|
||||
|
||||
- Fix ReGaHss binary
|
||||
|
||||
## 9.4
|
||||
|
||||
- Update OCCU to 3.49.17-2
|
||||
- Use new gcc8 binary for armhf
|
||||
- Don't use ReGaHss-beta
|
||||
|
||||
## 9.3
|
||||
|
||||
- Update from bash to bashio
|
||||
- Use debian as base image
|
||||
- Fix config for group settings
|
||||
|
||||
## 9.2
|
||||
|
||||
- Update OCCU to 3.47.22-3
|
||||
|
||||
## 9.1
|
||||
|
||||
- Optimize InterfaceList handling
|
||||
- Make userprofiles static
|
||||
|
||||
## 9.0
|
||||
|
||||
- Add Regahss (WebUI) support (experimentel)
|
||||
- Update OCCU to 3.47.18-1
|
||||
|
||||
## 8.3
|
||||
|
||||
- Update OCCU to 3.47.10
|
||||
- Add Port descriptions
|
||||
|
||||
## 8.2
|
||||
|
||||
- Update OCCU to 3.45.7
|
||||
|
||||
## 8.1
|
||||
|
||||
- Update OCCU to 3.43.15
|
||||
- Migrate to new arch layering
|
||||
- Better handling for errors with Firmware updates
|
||||
|
||||
## 8.0
|
||||
|
||||
- Update OCCU to 3.41.11
|
||||
- Fix write error when starting OCCU / HmIP
|
||||
- Redirect HMIPServer log to console
|
||||
|
||||
## 7.0
|
||||
|
||||
- Update OCCU to 3.41.7
|
||||
|
||||
## 6.0
|
||||
|
||||
- Allow customer firmware updates inside `/share`
|
||||
- Update Hardware on startup
|
||||
- Limit HmIP server to 64mb memory
|
||||
- Set `rf_enable` default to `false`
|
||||
|
||||
## 5.0
|
||||
|
||||
- Save hmip_address.conf persistent
|
||||
|
||||
## 4.0
|
||||
|
||||
- New ubuntu base images
|
||||
- Support firmware update of HM-MOD-RPI-PCB, HmIP-RFUSB
|
||||
- Add HmIP support with HmIP-RFUSB
|
||||
|
||||
## 3.0
|
||||
|
||||
- Add periodically time sync
|
||||
|
||||
## 2.0
|
||||
|
||||
- Fix wrong Timezone
|
||||
- Update OCCU to 3.37.8
|
||||
|
||||
## 1.0
|
||||
|
||||
- Change version format to other core add-ons
|
||||
- Update OCCU to 2.35.16
|
||||
- Disable AppArmor to work on system like HassOS
|
||||
|
||||
## 2.31.25-p2
|
||||
|
||||
- Bugfix with reset value on GPIO
|
||||
|
||||
## 2.31.25-p1
|
||||
|
||||
- Add `reset` options for RF modules
|
||||
|
||||
## 2.31.25-p0
|
||||
|
||||
- Update OCCU to 2.31.25
|
||||
|
||||
## 2.31.23-p0
|
||||
|
||||
- Update OCCU to 2.31.23
|
||||
|
||||
## 2.29.22-1-p1
|
||||
|
||||
- Fix bug in script
|
||||
- Add wired port into config
|
||||
|
||||
## 2.29.22-1-p1
|
||||
|
||||
- Change config logic
|
||||
- Add support for wired
|
||||
|
||||
## 2.29.22-1-p0
|
||||
|
||||
- Initial
|
||||
|
||||
@@ -19,7 +19,9 @@ ARG BUILD_ARCH
|
||||
|
||||
# Install OCCU
|
||||
WORKDIR /usr/src
|
||||
RUN curl -SL https://github.com/jens-maus/occu/archive/${OCCU_VERSION}.tar.gz | tar xzf - \
|
||||
RUN \
|
||||
set -x \
|
||||
&& curl -SL https://github.com/jens-maus/occu/archive/${OCCU_VERSION}.tar.gz | tar xzf - \
|
||||
&& cd occu-${OCCU_VERSION} \
|
||||
&& mkdir -p \
|
||||
/boot \
|
||||
@@ -74,15 +76,8 @@ RUN curl -SL https://github.com/jens-maus/occu/archive/${OCCU_VERSION}.tar.gz |
|
||||
\
|
||||
&& rm -rf /usr/src/occu-${OCCU_VERSION}
|
||||
|
||||
ENV HM_HOME=/opt/hm LD_LIBRARY_PATH=/opt/hm/lib:${LD_LIBRARY_PATH}
|
||||
ENV \
|
||||
HM_HOME=/opt/hm \
|
||||
LD_LIBRARY_PATH=/opt/hm/lib:${LD_LIBRARY_PATH}
|
||||
|
||||
# Update config files
|
||||
COPY data/config/* /opt/hm/etc/config/
|
||||
COPY data/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Setup start script
|
||||
COPY data/run.sh /
|
||||
COPY data/hm-firmware.sh data/hm-interface.sh /usr/lib/
|
||||
|
||||
WORKDIR /data
|
||||
CMD [ "/run.sh" ]
|
||||
COPY rootfs /
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"i386": "homeassistant/i386-base-debian:bullseye"
|
||||
},
|
||||
"args": {
|
||||
"OCCU_VERSION": "3.51.6-1",
|
||||
"CCU_VERSION": "3.51.6"
|
||||
"OCCU_VERSION": "3.55.5-1",
|
||||
"CCU_VERSION": "3.55.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "HomeMatic CCU",
|
||||
"version": "10.3",
|
||||
"version": "11.0.0",
|
||||
"slug": "homematic",
|
||||
"description": "HomeMatic central based on OCCU",
|
||||
"url": "https://github.com/home-assistant/hassio-addons/tree/master/homematic",
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/usr/bin/env bashio
|
||||
# shellcheck disable=SC2012
|
||||
|
||||
|
||||
function firmware_update_hmip() {
|
||||
local DEVICE="$1"
|
||||
local FROM_VERSION=
|
||||
local TO_VERSION=
|
||||
|
||||
FROM_VERSION="$(java -Xmx64m -jar /opt/HmIP/hmip-copro-update.jar -p "${DEVICE}" -v | grep "Application version =" | cut -d' ' -f5)"
|
||||
TO_VERSION="$(ls /firmware/HmIP-RFUSB/hmip_coprocessor_update-*.eq3 | sed 's/.*hmip_coprocessor_update-\(.*\)\.eq3/\1/' | tail -n1)"
|
||||
if [ "${FROM_VERSION}" != "${TO_VERSION}" ]; then
|
||||
if java -Xmx64m -jar /opt/HmIP/hmip-copro-update.jar -p "${DEVICE}" -f "/firmware/HmIP-RFUSB/hmip_coprocessor_update-${TO_VERSION}.eq3"; then
|
||||
bashio::log.info "HmIP update to ${TO_VERSION} was successful"
|
||||
else
|
||||
bashio::log.error "HmIP update ${TO_VERSION} fails!"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function firmware_update_rfd() {
|
||||
if "${HM_HOME}/bin/eq3configcmd" update-coprocessor -lgw -u -rfdconf /etc/config/rfd.conf -l 1; then
|
||||
bashio::log.info "RFd update was successful"
|
||||
else
|
||||
bashio::log.error "RFd update fails!"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function firmware_update_wired() {
|
||||
if "${HM_HOME}/bin/eq3configcmd" update-lgw-firmware -m /firmware/fwmap -c /etc/config/hs485d.conf -l 1; then
|
||||
bashio::log.info "Wired update was successful"
|
||||
else
|
||||
bashio::log.error "Wired update fails!"
|
||||
fi
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env bashio
|
||||
|
||||
|
||||
function enable_interface(){
|
||||
local name="$1"
|
||||
local description="$2"
|
||||
local port="$3"
|
||||
|
||||
(
|
||||
echo " <ipc>"
|
||||
echo " <name>${name}</name>"
|
||||
echo " <url>xmlrpc://127.0.0.1:${port}</url>"
|
||||
echo " <info>${description}</info>"
|
||||
echo " </ipc>"
|
||||
) >> /etc/config/InterfacesList.xml
|
||||
}
|
||||
|
||||
|
||||
function init_interface_list() {
|
||||
local rf=$1
|
||||
local ip=$2
|
||||
local wired=$3
|
||||
|
||||
echo -e "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<interfaces v=\"1.0\">" > /etc/config/InterfacesList.xml
|
||||
enable_interface "VirtualDevices" "Virtual Devices" "9292/groups"
|
||||
|
||||
if [ "$rf" == "true" ]; then
|
||||
enable_interface "BidCos-RF" "BidCos-RF" "2001"
|
||||
fi
|
||||
|
||||
if [ "$ip" == "true" ]; then
|
||||
enable_interface "HmIP-RF" "HmIP-RF" "2010"
|
||||
fi
|
||||
|
||||
if [ "$wired" == "true" ]; then
|
||||
enable_interface "Hm-Wired" "Hm-Wired" "2000"
|
||||
fi
|
||||
|
||||
echo "</interfaces>" >> /etc/config/InterfacesList.xml
|
||||
}
|
||||
@@ -1,195 +0,0 @@
|
||||
#!/usr/bin/env bashio
|
||||
# shellcheck disable=SC1091
|
||||
set -e
|
||||
|
||||
WAIT_PIDS=()
|
||||
|
||||
# Init folder
|
||||
mkdir -p /share/hm-firmware
|
||||
mkdir -p /share/hmip-firmware
|
||||
mkdir -p /data/crRFD
|
||||
mkdir -p /data/rfd
|
||||
mkdir -p /data/hs485d
|
||||
mkdir -p /data/userprofiles
|
||||
|
||||
ln -s /data/userprofiles /etc/config/userprofiles
|
||||
|
||||
# Init files
|
||||
touch /data/hmip_user.conf
|
||||
touch /data/rega_user.conf
|
||||
touch /data/homematic.regadom
|
||||
touch /data/userprofiles/userAckInstallWizard_Admin
|
||||
|
||||
# Import helpers
|
||||
. /usr/lib/hm-firmware.sh
|
||||
. /usr/lib/hm-interface.sh
|
||||
|
||||
# Setup Interfaces
|
||||
init_interface_list "$(bashio::config 'rf_enable')" \
|
||||
"$(bashio::config 'hmip_enable')" \
|
||||
"$(bashio::config 'wired_enable')"
|
||||
|
||||
# RF support
|
||||
if bashio::config.true 'rf_enable'; then
|
||||
bashio::log.info "Setup BidCos-RF"
|
||||
|
||||
for rf_device in $(bashio::config 'rf|keys'); do
|
||||
TYPE=$(bashio::config "rf[${rf_device}].type")
|
||||
|
||||
# Update config
|
||||
if [ "$TYPE" == "CCU2" ]; then
|
||||
DEVICE=$(bashio::config "rf[${rf_device}].device")
|
||||
(
|
||||
echo "[Interface $1]"
|
||||
echo "Type = CCU2"
|
||||
echo "ComPortFile = $DEVICE"
|
||||
echo "AccessFile = /dev/null"
|
||||
echo "ResetFile = /sys/class/gpio/gpio18/value"
|
||||
) >> /etc/config/rfd.conf
|
||||
|
||||
# Init GPIO
|
||||
if [ ! -d /sys/class/gpio/gpio18 ]; then
|
||||
echo 18 > /sys/class/gpio/export
|
||||
sleep 2
|
||||
fi
|
||||
if [ "$(cat /sys/class/gpio/gpio18/direction)" != "out" ]; then
|
||||
echo out > /sys/class/gpio/gpio18/direction
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
echo 0 > /sys/class/gpio/gpio18/value || echo "Can't set default value!"
|
||||
sleep 0.5
|
||||
fi
|
||||
done
|
||||
|
||||
# Update Firmware
|
||||
firmware_update_rfd
|
||||
|
||||
# Run RFD
|
||||
"$HM_HOME/bin/rfd" -c -l 0 -f /opt/hm/etc/config/rfd.conf &
|
||||
WAIT_PIDS+=($!)
|
||||
fi
|
||||
|
||||
# Wired support
|
||||
if bashio::config.true 'wired_enable'; then
|
||||
bashio::log.info "Setup Hm-Wired"
|
||||
|
||||
for wired_device in $(bashio::config 'wired|keys'); do
|
||||
SERIAL=$(bashio::config "wired[${wired_device}].serial")
|
||||
KEY=$(bashio::config "wired[${wired_device}].key")
|
||||
IP=$(bashio::config "wired[${wired_device}].ip")
|
||||
|
||||
# Update config
|
||||
(
|
||||
echo "[Interface $1]"
|
||||
echo "Type = HMWLGW"
|
||||
echo "Serial Number = $SERIAL"
|
||||
echo "Encryption Key = $KEY"
|
||||
echo "IP Address = $IP"
|
||||
) >> /etc/config/hs485d.conf
|
||||
done
|
||||
|
||||
# Update Firmware
|
||||
firmware_update_wired
|
||||
|
||||
# Run hs485d
|
||||
"$HM_HOME/bin/hs485d" -g -i 0 -f /opt/hm/etc/config/hs485d.conf &
|
||||
WAIT_PIDS+=($!)
|
||||
fi
|
||||
|
||||
# HMIP support
|
||||
if bashio::config.true 'hmip_enable'; then
|
||||
bashio::log.info "Setup HmIP-RF"
|
||||
|
||||
# Restore data
|
||||
if [ -f /data/hmip_address.conf ]; then
|
||||
cp -f /data/hmip_address.conf /etc/config/
|
||||
fi
|
||||
|
||||
# Setup settings
|
||||
for hmip_device in $(bashio::config 'hmip|keys'); do
|
||||
TYPE=$(bashio::config "hmip[${hmip_device}].type")
|
||||
DEVICE=$(bashio::config "hmip[${hmip_device}].device")
|
||||
ADAPTER=$((hmip_device+1))
|
||||
|
||||
# Update Firmware
|
||||
firmware_update_hmip "${DEVICE}"
|
||||
|
||||
# Update config
|
||||
(
|
||||
echo "Adapter.${ADAPTER}.Type=${TYPE}"
|
||||
echo "Adapter.${ADAPTER}.Port=${DEVICE}"
|
||||
) >> /etc/config/crRFD.conf
|
||||
done
|
||||
|
||||
# Run HMIPServer
|
||||
# shellcheck disable=SC2086
|
||||
java -Xmx64m -Dlog4j.configuration=file:///etc/config/log4j.xml -Dfile.encoding=ISO-8859-1 -jar /opt/HMServer/HMIPServer.jar /etc/config/crRFD.conf /etc/config/HMServer.conf &
|
||||
WAIT_PIDS+=($!)
|
||||
|
||||
if [ ! -f /data/hmip_address.conf ]; then
|
||||
bashio::log.info "Wait for HMIPServer"
|
||||
|
||||
bashio::net.wait_for 9292
|
||||
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
|
||||
function stop_homematic() {
|
||||
# Store Regahss
|
||||
echo "load tclrega.so; rega system.Save()" | "${HM_HOME}/bin/tclsh" 2> /dev/null || true
|
||||
sleep 5
|
||||
|
||||
# Forward kill process
|
||||
bashio::log.info "Kill Processes..."
|
||||
kill -15 "${WAIT_PIDS[@]}"
|
||||
wait "${WAIT_PIDS[@]}"
|
||||
bashio::log.info "Done."
|
||||
}
|
||||
trap "stop_homematic" SIGTERM SIGHUP
|
||||
|
||||
# Wait until interfaces are initialized
|
||||
bashio::log.info "Wait until HomeMatic is setup"
|
||||
bashio::net.wait_for 9292
|
||||
|
||||
# Reset Regahss
|
||||
if bashio::config.true "regahss_reset"; then
|
||||
bashio::log.warning "Reset ReGaHss"
|
||||
rm -f /data/homematic.regadom
|
||||
touch /data/homematic.regadom
|
||||
fi
|
||||
|
||||
# Start Regahss
|
||||
bashio::log.info "Start ReGaHss"
|
||||
"$HM_HOME/bin/ReGaHss" -c -f /etc/config/rega.conf &
|
||||
WAIT_PIDS+=($!)
|
||||
|
||||
# Start WebInterface
|
||||
bashio::log.info "Initialize webinterface routing"
|
||||
openssl req -new -x509 -nodes -keyout /etc/config/server.pem -out /etc/config/server.pem -days 3650 -subj "/C=DE/O=HomeMatic/OU=Hass.io/CN=$(hostname)"
|
||||
lighttpd-angel -D -f "${HM_HOME}/etc/lighttpd/lighttpd.conf" &
|
||||
WAIT_PIDS+=($!)
|
||||
|
||||
# Start Ingress
|
||||
bashio::log.info "Starting Nginx"
|
||||
ingress_entry=$(bashio::addon.ingress_entry)
|
||||
sed -i "s#%%INGRESS_ENTRY%%#${ingress_entry}#g" /etc/nginx/nginx.conf
|
||||
nginx &
|
||||
WAIT_PIDS+=($!)
|
||||
|
||||
# Sync time periodically
|
||||
if bashio::config.true 'rf_enable'; then
|
||||
while true
|
||||
do
|
||||
sleep 30m
|
||||
bashio::log.info "$(date '+%Y-%m-%d %H:%M:%S.%3N') Run SetInterfaceClock now."
|
||||
"$HM_HOME/bin/SetInterfaceClock" 127.0.0.1:2001
|
||||
done
|
||||
fi
|
||||
|
||||
# Wait until all is done
|
||||
wait "${WAIT_PIDS[@]}"
|
||||
7
homematic/rootfs/etc/cont-finish.d/hmip.sh
Executable file
7
homematic/rootfs/etc/cont-finish.d/hmip.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Backup hmip_address
|
||||
# ==============================================================================
|
||||
if bashio::config.true 'hmip_enable' && [ -f /data/hmip_address.conf ]; then
|
||||
cp -f /etc/config/hmip_address.conf /data/ || bashio::log.warning "Failed to backup hmip address"
|
||||
fi
|
||||
6
homematic/rootfs/etc/cont-finish.d/regahss.sh
Executable file
6
homematic/rootfs/etc/cont-finish.d/regahss.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Store RegaHss data
|
||||
# ==============================================================================
|
||||
|
||||
echo "load tclrega.so; rega system.Save()" | "/opt/hm/bin/tclsh" 2> /dev/null || true
|
||||
5
homematic/rootfs/etc/cont-init.d/certs.sh
Normal file
5
homematic/rootfs/etc/cont-init.d/certs.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Configure NGINX for use with ReGaHss
|
||||
# ==============================================================================
|
||||
openssl req -new -x509 -nodes -keyout /etc/config/server.pem -out /etc/config/server.pem -days 3650 -subj "/C=DE/O=HomeMatic/OU=Hass.io/CN=$(hostname)"
|
||||
19
homematic/rootfs/etc/cont-init.d/env.sh
Normal file
19
homematic/rootfs/etc/cont-init.d/env.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Initialize file system layout /data
|
||||
# ==============================================================================
|
||||
|
||||
mkdir -p /share/hm-firmware
|
||||
mkdir -p /share/hmip-firmware
|
||||
mkdir -p /data/crRFD
|
||||
mkdir -p /data/rfd
|
||||
mkdir -p /data/hs485d
|
||||
mkdir -p /data/userprofiles
|
||||
|
||||
ln -s /data/userprofiles /etc/config/userprofiles
|
||||
|
||||
# Init files
|
||||
touch /data/hmip_user.conf
|
||||
touch /data/rega_user.conf
|
||||
touch /data/homematic.regadom
|
||||
touch /data/userprofiles/userAckInstallWizard_Admin
|
||||
41
homematic/rootfs/etc/cont-init.d/hm_ip.sh
Executable file
41
homematic/rootfs/etc/cont-init.d/hm_ip.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Update HomeMatic firmware
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC2012
|
||||
declare hmip_index
|
||||
declare hmip_device
|
||||
declare version_to
|
||||
declare version_from
|
||||
|
||||
# HMIP support
|
||||
if bashio::config.false 'hmip_enable'; then
|
||||
bashio::exit.ok
|
||||
fi
|
||||
bashio::log.info "Setup HmIP-RF"
|
||||
|
||||
# Generate config
|
||||
tempio \
|
||||
-conf /data/options.json \
|
||||
-template /usr/share/tempio/crRFD.conf \
|
||||
-out /etc/config/crRFD.conf
|
||||
|
||||
# Restore data
|
||||
if [ -f /data/hmip_address.conf ]; then
|
||||
cp -f /data/hmip_address.conf /etc/config/
|
||||
fi
|
||||
|
||||
# Update Firmware
|
||||
for hmip_index in $(bashio::config 'hmip|keys'); do
|
||||
hmip_device=$(bashio::config "hmip[${hmip_index}].device")
|
||||
version_from="$(java -Xmx64m -jar /opt/HmIP/hmip-copro-update.jar -p "${hmip_device}" -v | grep "Application version =" | cut -d' ' -f5)"
|
||||
version_to="$(ls /firmware/HmIP-RFUSB/hmip_coprocessor_update-*.eq3 | sed 's/.*hmip_coprocessor_update-\(.*\)\.eq3/\1/' | tail -n1)"
|
||||
|
||||
if [ "${version_from}" != "${version_to}" ]; then
|
||||
if java -Xmx64m -jar /opt/HmIP/hmip-copro-update.jar -p "${hmip_device}" -f "/firmware/HmIP-RFUSB/hmip_coprocessor_update-${version_to}.eq3"; then
|
||||
bashio::log.info "HmIP update to ${version_to} was successful"
|
||||
else
|
||||
bashio::log.error "HmIP update ${version_to} fails!"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
36
homematic/rootfs/etc/cont-init.d/hm_rfd.sh
Executable file
36
homematic/rootfs/etc/cont-init.d/hm_rfd.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Update HomeMatic firmware
|
||||
# ==============================================================================
|
||||
|
||||
# RF support
|
||||
if bashio::config.false 'rf_enable'; then
|
||||
bashio::exit.ok
|
||||
fi
|
||||
bashio::log.info "Setup BidCos-RF"
|
||||
|
||||
# Generate config
|
||||
tempio \
|
||||
-conf /data/options.json \
|
||||
-template /usr/share/tempio/rfd.conf \
|
||||
-out /etc/config/rfd.conf
|
||||
|
||||
# Init GPIO
|
||||
if [ ! -d /sys/class/gpio/gpio18 ]; then
|
||||
echo 18 > /sys/class/gpio/export
|
||||
sleep 2
|
||||
fi
|
||||
if [ "$(cat /sys/class/gpio/gpio18/direction)" != "out" ]; then
|
||||
echo out > /sys/class/gpio/gpio18/direction
|
||||
sleep 2
|
||||
fi
|
||||
|
||||
echo 0 > /sys/class/gpio/gpio18/value || echo "Can't set default value!"
|
||||
sleep 0.5
|
||||
|
||||
# Update Firmware
|
||||
if "/opt/hm/bin/eq3configcmd" update-coprocessor -lgw -u -rfdconf /etc/config/rfd.conf -l 1; then
|
||||
bashio::log.info "RFd update was successful"
|
||||
else
|
||||
bashio::log.error "RFd update fails!"
|
||||
fi
|
||||
23
homematic/rootfs/etc/cont-init.d/hm_wired.sh
Executable file
23
homematic/rootfs/etc/cont-init.d/hm_wired.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Update HomeMatic firmware
|
||||
# ==============================================================================
|
||||
|
||||
# Wired support
|
||||
if bashio::config.false 'wired_enable'; then
|
||||
bashio::exit.ok
|
||||
fi
|
||||
bashio::log.info "Setup Hm-Wired"
|
||||
|
||||
# Generate config
|
||||
tempio \
|
||||
-conf /data/options.json \
|
||||
-template /usr/share/tempio/hs485d.conf \
|
||||
-out /etc/config/hs485d.conf
|
||||
|
||||
# Update Firmware
|
||||
if "/opt/hm/bin/eq3configcmd" update-lgw-firmware -m /firmware/fwmap -c /etc/config/hs485d.conf -l 1; then
|
||||
bashio::log.info "Wired update was successful"
|
||||
else
|
||||
bashio::log.error "Wired update fails!"
|
||||
fi
|
||||
8
homematic/rootfs/etc/cont-init.d/interface.sh
Executable file
8
homematic/rootfs/etc/cont-init.d/interface.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Generate InterfacesList.xml
|
||||
# ==============================================================================
|
||||
tempio \
|
||||
-conf /data/options.json \
|
||||
-template /usr/share/tempio/InterfacesList.xml \
|
||||
-out /etc/config/InterfacesList.xml
|
||||
6
homematic/rootfs/etc/cont-init.d/nginx.sh
Normal file
6
homematic/rootfs/etc/cont-init.d/nginx.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# ==============================================================================
|
||||
# Configure NGINX for use with ReGaHss
|
||||
# ==============================================================================
|
||||
ingress_entry=$(bashio::addon.ingress_entry)
|
||||
sed -i "s#%%ingress_entry%%#${ingress_entry}#g" /etc/nginx/nginx.conf
|
||||
8
homematic/rootfs/etc/services.d/hmserver/finish
Normal file
8
homematic/rootfs/etc/services.d/hmserver/finish
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/execlineb -S1
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree based on service exit code
|
||||
# ==============================================================================
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
12
homematic/rootfs/etc/services.d/hmserver/run
Normal file
12
homematic/rootfs/etc/services.d/hmserver/run
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bashio
|
||||
# ==============================================================================
|
||||
# Start HomeMatic HMServer service
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC2086
|
||||
if bashio::config.true 'hmip_enable'; then
|
||||
bashio::log.info "Starting HMIPServer..."
|
||||
exec java -Xmx64m -Dlog4j.configuration=file:///etc/config/log4j.xml -Dfile.encoding=ISO-8859-1 -jar /opt/HMServer/HMIPServer.jar /etc/config/crRFD.conf /etc/config/HMServer.conf
|
||||
else
|
||||
bashio::log.info "Starting HMServer..."
|
||||
exec java -Xmx64m -Dlog4j.configuration=file:///etc/config/log4j.xml -Dfile.encoding=ISO-8859-1 -jar /opt/HMServer/HMServer.jar /etc/config/HMServer.conf
|
||||
fi
|
||||
6
homematic/rootfs/etc/services.d/lighttpd/run
Normal file
6
homematic/rootfs/etc/services.d/lighttpd/run
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bashio
|
||||
# ==============================================================================
|
||||
# Start light httpd service
|
||||
# ==============================================================================
|
||||
bashio::log.info "Initialize webinterface routing..."
|
||||
exec lighttpd-angel -D -f "/opt/hm/etc/lighttpd/lighttpd.conf"
|
||||
8
homematic/rootfs/etc/services.d/nginx/finish
Normal file
8
homematic/rootfs/etc/services.d/nginx/finish
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/execlineb -S1
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree based on service exit code
|
||||
# ==============================================================================
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
9
homematic/rootfs/etc/services.d/nginx/run
Normal file
9
homematic/rootfs/etc/services.d/nginx/run
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bashio
|
||||
# ==============================================================================
|
||||
# Start NGINX service
|
||||
# ==============================================================================
|
||||
# Wait for HomeMatic httpd
|
||||
bashio::net.wait_for 80
|
||||
|
||||
bashio::log.info "Starting Nginx..."
|
||||
exec nginx
|
||||
18
homematic/rootfs/etc/services.d/regahss/run
Normal file
18
homematic/rootfs/etc/services.d/regahss/run
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bashio
|
||||
# ==============================================================================
|
||||
# Start ReGaHss service
|
||||
# ==============================================================================
|
||||
# Wait until interfaces are initialized
|
||||
bashio::log.info "Wait until HMServer is setup"
|
||||
bashio::net.wait_for 9292
|
||||
|
||||
# Reset Regahss
|
||||
if bashio::config.true "regahss_reset"; then
|
||||
bashio::log.warning "Reset ReGaHss"
|
||||
rm -f /data/homematic.regadom
|
||||
touch /data/homematic.regadom
|
||||
fi
|
||||
|
||||
# Start Regahss
|
||||
bashio::log.info "Starting ReGaHss..."
|
||||
exec "/opt/hm/bin/ReGaHss" -c -f /etc/config/rega.conf
|
||||
8
homematic/rootfs/etc/services.d/rfd/finish
Normal file
8
homematic/rootfs/etc/services.d/rfd/finish
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/execlineb -S1
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree based on service exit code
|
||||
# ==============================================================================
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
10
homematic/rootfs/etc/services.d/rfd/run
Normal file
10
homematic/rootfs/etc/services.d/rfd/run
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bashio
|
||||
# ==============================================================================
|
||||
# Start HomeMatic RFD service
|
||||
# ==============================================================================
|
||||
if bashio::config.false 'rf_enable'; then
|
||||
exec sleep infinity
|
||||
fi
|
||||
|
||||
bashio::log.info "Starting rfd..."
|
||||
exec "/opt/hm/bin/rfd" -c -l 0 -f /opt/hm/etc/config/rfd.conf
|
||||
14
homematic/rootfs/etc/services.d/timesync/run
Normal file
14
homematic/rootfs/etc/services.d/timesync/run
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bashio
|
||||
# ==============================================================================
|
||||
# Start HomeMatic RF timesync service
|
||||
# ==============================================================================
|
||||
if bashio::config.false 'rf_enable'; then
|
||||
exec sleep infinity
|
||||
fi
|
||||
|
||||
while true
|
||||
do
|
||||
sleep 30m
|
||||
bashio::log.info "$(date '+%Y-%m-%d %H:%M:%S.%3N') Run SetInterfaceClock now."
|
||||
"/opt/hm/bin/SetInterfaceClock" 127.0.0.1:2001
|
||||
done
|
||||
8
homematic/rootfs/etc/services.d/wired/finish
Normal file
8
homematic/rootfs/etc/services.d/wired/finish
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/execlineb -S1
|
||||
# ==============================================================================
|
||||
# Take down the S6 supervision tree based on service exit code
|
||||
# ==============================================================================
|
||||
if { s6-test ${1} -ne 0 }
|
||||
if { s6-test ${1} -ne 256 }
|
||||
|
||||
s6-svscanctl -t /var/run/s6/services
|
||||
10
homematic/rootfs/etc/services.d/wired/run
Normal file
10
homematic/rootfs/etc/services.d/wired/run
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bashio
|
||||
# ==============================================================================
|
||||
# Start HomeMatic wired service
|
||||
# ==============================================================================
|
||||
if bashio::config.false 'wired_enable'; then
|
||||
exec sleep infinity
|
||||
fi
|
||||
|
||||
bashio::log.info "Starting wired..."
|
||||
exec "/opt/hm/bin/hs485d" -g -i 0 -f /opt/hm/etc/config/hs485d.conf
|
||||
29
homematic/rootfs/usr/share/tempio/InterfacesList.xml
Normal file
29
homematic/rootfs/usr/share/tempio/InterfacesList.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<interfaces v="1.0">
|
||||
{{ if .rf_enable }}
|
||||
<ipc>
|
||||
<name>BidCos-RF</name>
|
||||
<url>xmlrpc_bin://127.0.0.1:2001</url>
|
||||
<info>BidCos-RF</info>
|
||||
</ipc>
|
||||
{{ end }}
|
||||
<ipc>
|
||||
<name>VirtualDevices</name>
|
||||
<url>xmlrpc://127.0.0.1:9292/groups</url>
|
||||
<info>Virtual Devices</info>
|
||||
</ipc>
|
||||
{{ if .hmip_enable }}
|
||||
<ipc>
|
||||
<name>HmIP-RF</name>
|
||||
<url>xmlrpc://127.0.0.1:2010</url>
|
||||
<info>HmIP-RF</info>
|
||||
</ipc>
|
||||
{{ end }}
|
||||
{{ if .wired_enable }}
|
||||
<ipc>
|
||||
<name>Hm-Wired</name>
|
||||
<url>xmlrpc://127.0.0.1:2000</url>
|
||||
<info>Hm-Wired</info>
|
||||
</ipc>
|
||||
{{ end }}
|
||||
</interfaces>
|
||||
@@ -42,3 +42,7 @@ KeyServer.Gateway.URL=secgtw.homematic.com
|
||||
Vertx.WorkerPoolSize=5
|
||||
|
||||
# USB HM/IP TRX Adapter Configuration
|
||||
{{ range $index, $device := .hmip }}
|
||||
Adapter.{{ $index }}.Type={{ $device.type }}
|
||||
Adapter.{{ $index }}.Port={{ $device.device }}
|
||||
{{ end }}
|
||||
@@ -9,3 +9,11 @@ Device Description Dir = /firmware/hs485types
|
||||
Device Files Dir = /data/hs485d
|
||||
Firmware Dir = /firmware
|
||||
User Firmware Dir = /share/hm-firmware
|
||||
|
||||
{{ range $index, $device := .wired }}
|
||||
[Interface {{ $index }}]
|
||||
Type = HMWLGW
|
||||
Serial Number = {{ $device.serial }}
|
||||
Encryption Key = {{ $device.key }}
|
||||
IP Address = {{ $device.ip }}
|
||||
{{ end }}
|
||||
@@ -12,3 +12,11 @@ Address File = /data/ids
|
||||
Firmware Dir = /firmware
|
||||
User Firmware Dir = /share/hm-firmware
|
||||
Replacemap File = /firmware/rftypes/replaceMap/rfReplaceMap.xml
|
||||
|
||||
{{ range $index, $device := .rf }}
|
||||
[Interface {{ $index }}]
|
||||
Type = CCU2
|
||||
ComPortFile = {{ $device.device }}
|
||||
AccessFile = /dev/null
|
||||
ResetFile = /sys/class/gpio/gpio18/value
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user