Files
addons/homematic/rootfs/etc/cont-init.d/hm_ip.sh
Pascal Vizeli 9a360be8e0 HomeMatic: s6-overlay & tempio (#1713)
* HomeMatic: s6-overlay & tempio

* Use tempio

* fix line end

* Fix dev version

* Fix bugs
2020-12-16 12:34:51 +01:00

42 lines
1.5 KiB
Bash
Executable File

#!/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