Sync time of RF Daemon every 30min (#425)

* sync homematic time periodically

* Show "Run SetInterfaceClock" in log file

* signal handler added

* version incremented

* Update CHANGELOG.md
This commit is contained in:
IceOnly
2018-10-16 23:08:04 +02:00
committed by Pascal Vizeli
parent 446dd8d65c
commit 36470854b0
3 changed files with 23 additions and 1 deletions

View File

@@ -1,5 +1,8 @@
# Changelog
## 3
- Add periodically time sync
## 2
- Fix wrong Timezone
- Update OCCU to 3.37.8

View File

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

View File

@@ -75,5 +75,24 @@ if [ "$WIRED_ENABLE" == "true" ]; then
WAIT_PIDS+=($!)
fi
# Register stop
function stop_homematic() {
echo "Kill Processes..."
kill -15 "${WAIT_PIDS[@]}"
wait "${WAIT_PIDS[@]}"
echo "Done."
}
trap "stop_homematic" SIGTERM SIGHUP
# sync time periodically
if [ "$RF_ENABLE" == "true" ]; then
while true
do
sleep 30m
echo "$(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[@]}"