#!/bin/sh
exec 2>&1
sleep 5
if ! /usr/bin/pgrep zipgateway >/dev/null
then
  echo "Zipgateway is not running. Waiting"
  sleep 4
fi

while ! /usr/bin/pgrep zipgateway >/dev/null; do sleep 7; done

python3 /usr/share/futurehome/zwave-ad/scripts/start_with_delay.py

exec fh-drop zwave-ad /usr/bin/zwave-ad -c /etc/futurehome/zwave-ad/zwave-ad.json
