Hm update (#880)

* Update HomeMatic 3.47.22-3

*  homematic add-on to use Bashio #725 (#743)

*  homematic add-on to use Bashio #725

* uppercase to lowercase correction

* Update change log and version

* Updated logging to bashio

* Bump version

* Fix install issue
This commit is contained in:
Pascal Vizeli
2019-12-11 18:13:56 +01:00
committed by GitHub
8 changed files with 52 additions and 40 deletions

View File

@@ -1,5 +1,11 @@
# Changelog
## 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

View File

@@ -6,6 +6,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install packages
RUN apt-get update \
&& mkdir -p /usr/share/man/man1 \
&& apt-get install -y --no-install-recommends \
curl \
libusb-1.0 \
@@ -28,6 +29,7 @@ RUN curl -SL https://github.com/jens-maus/occu/archive/${OCCU_VERSION}.tar.gz |
&& mkdir -p /boot \
\
&& echo "VERSION=${OCCU_VERSION}" > /boot/VERSION \
&& cp /boot/VERSION /VERSION \
&& ln -s /opt/hm/etc/config /etc/config \
\
&& if [ "${BUILD_ARCH}" = "armv7" ]; \

View File

@@ -1,7 +1,7 @@
{
"build_from": {
"armv7": "homeassistant/armv7-base-ubuntu:18.04",
"i386": "homeassistant/i386-base-ubuntu:18.04"
"armv7": "homeassistant/armv7-base-debian:buster",
"i386": "homeassistant/i386-base-debian:buster"
},
"args": {
"OCCU_VERSION": "3.47.22-3"

View File

@@ -1,6 +1,6 @@
{
"name": "HomeMatic CCU",
"version": "9.2",
"version": "9.3",
"slug": "homematic",
"description": "HomeMatic central based on OCCU",
"url": "https://home-assistant.io/addons/homematic/",

View File

@@ -19,6 +19,16 @@ Legacy.SwitchTypeAndSubtype=true
Legacy.HandlersFilename=/var/LegacyService.handlers
Legacy.DiscardDutyCycleEvents=true
Legacy.SendUDPServiceMessages=true
Legacy.Port=2010
Legacy.VirtualRemoteControl.Enabled=true
Legacy.CallDeleteDevicesForChangedDevices=false
Legacy.Client.Connection.Timeout=300000
Legacy.Client.Socket.Timeout=300000
# HmIP-Routing
Adapter.Remote.Enabled=true
AccessPoint.WebSocket.Port=9293
IPServices.Firmware.Update.URL=http://drap-update.homematic.com:80/firmware/hap/
# Miscellaneous Configuration
CyclicTimeout.TimerStartMaxDelay=90

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bashio
# shellcheck disable=SC2012
@@ -11,9 +11,9 @@ function firmware_update_hmip() {
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
echo "[INFO] HmIP update to ${TO_VERSION} was successful"
bashio::log.info "HmIP update to ${TO_VERSION} was successful"
else
echo "[ERROR] HmIP update ${TO_VERSION} fails!"
bashio::log.error "HmIP update ${TO_VERSION} fails!"
fi
fi
}
@@ -21,17 +21,17 @@ function firmware_update_hmip() {
function firmware_update_rfd() {
if "${HM_HOME}/bin/eq3configcmd" update-coprocessor -lgw -u -rfdconf /etc/config/rfd.conf -l 1; then
echo "[INFO] RFd update was successful"
bashio::log.info "RFd update was successful"
else
echo "[ERROR] RFd update fails!"
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
echo "[INFO] Wired update was successful"
bashio::log.info "Wired update was successful"
else
echo "[ERROR] Wired update fails!"
bashio::log.error "Wired update fails!"
fi
}

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bashio
function enable_interface(){

View File

@@ -1,15 +1,7 @@
#!/bin/bash
#!/usr/bin/env bashio
# shellcheck disable=SC1091
set -e
CONFIG_PATH=/data/options.json
RF_ENABLE=$(jq --raw-output '.rf_enable' $CONFIG_PATH)
RF_DEVICES=$(jq --raw-output '.rf | length' $CONFIG_PATH)
WIRED_ENABLE=$(jq --raw-output '.wired_enable' $CONFIG_PATH)
WIRED_DEVICES=$(jq --raw-output '.wired | length' $CONFIG_PATH)
HMIP_ENABLE=$(jq --raw-output '.hmip_enable' $CONFIG_PATH)
HMIP_DEVICES=$(jq --raw-output '.hmip | length' $CONFIG_PATH)
WAIT_PIDS=()
# Init folder
@@ -32,16 +24,18 @@ touch /data/homematic.regadom
. /usr/lib/hm-interface.sh
# Setup Interfaces
init_interface_list "$RF_ENABLE" "$HMIP_ENABLE" "$WIRED_ENABLE"
init_interface_list "$(bashio::config 'rf_enable')" \
"$(bashio::config 'hmip_enable')" \
"$(bashio::config 'wired_enable')"
# RF support
if [ "$RF_ENABLE" == "true" ]; then
for (( i=0; i < "$RF_DEVICES"; i++ )); do
TYPE=$(jq --raw-output ".rf[$i].type" $CONFIG_PATH)
if bashio::config.true 'rf_enable'; then
for rf_device in $(bashio::config 'rf|keys'); do
TYPE=$(bashio::config "rf[${rf_device}].type")
# Update config
if [ "$TYPE" == "CCU2" ]; then
DEVICE=$(jq --raw-output ".rf[$i].device" $CONFIG_PATH)
DEVICE=$(bashio::config "rf[${rf_device}].device")
(
echo "[Interface $1]"
echo "Type = CCU2"
@@ -74,11 +68,11 @@ if [ "$RF_ENABLE" == "true" ]; then
fi
# Wired support
if [ "$WIRED_ENABLE" == "true" ]; then
for (( i=0; i < "$WIRED_DEVICES"; i++ )); do
SERIAL=$(jq --raw-output ".wired[$i].serial" $CONFIG_PATH)
KEY=$(jq --raw-output ".wired[$i].key" $CONFIG_PATH)
IP=$(jq --raw-output ".wired[$i].ip" $CONFIG_PATH)
if bashio::config.true 'wired_enable'; then
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
(
@@ -99,17 +93,17 @@ if [ "$WIRED_ENABLE" == "true" ]; then
fi
# HMIP support
if [ "$HMIP_ENABLE" == "true" ]; then
if bashio::config.true 'hmip_enable'; then
# Restore data
if [ -f /data/hmip_address.conf ]; then
cp -f /data/hmip_address.conf /etc/config/
fi
# Setup settings
for (( i=0; i < "$HMIP_DEVICES"; i++ )); do
TYPE=$(jq --raw-output ".hmip[$i].type" $CONFIG_PATH)
DEVICE=$(jq --raw-output ".hmip[$i].device" $CONFIG_PATH)
ADAPTER=$((i+1))
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}"
@@ -123,7 +117,7 @@ if [ "$HMIP_ENABLE" == "true" ]; then
# 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 &
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
@@ -137,10 +131,10 @@ fi
# Register stop
function stop_homematic() {
echo "Kill Processes..."
bashio::log.info "Kill Processes..."
kill -15 "${WAIT_PIDS[@]}"
wait "${WAIT_PIDS[@]}"
echo "Done."
bashio::log.info "Done."
}
trap "stop_homematic" SIGTERM SIGHUP
@@ -156,11 +150,11 @@ lighttpd-angel -D -f /opt/hm/etc/lighttpd/lighttpd.conf &
WAIT_PIDS+=($!)
# Sync time periodically
if [ "$RF_ENABLE" == "true" ]; then
if bashio::config.true 'rf_enable'; then
while true
do
sleep 30m
echo "$(date '+%Y-%m-%d %H:%M:%S.%3N') Run SetInterfaceClock now."
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