-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·37 lines (30 loc) · 1007 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·37 lines (30 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
set -e
STATE_DB="/data/tado-local.db"
if [ -z "$TADO_BRIDGE_IP" ] && [ ! -f "$STATE_DB" ]; then
echo "No TADO_BRIDGE_IP set and no existing pairing DB found at $STATE_DB."
echo "Set TADO_BRIDGE_IP (and TADO_BRIDGE_PIN for first pairing) then restart."
echo "Sleeping to keep container alive for debugging..."
exec sleep infinity
fi
ARGS="--state $STATE_DB --port ${TADO_PORT:-4407}"
if [ -n "$TADO_BRIDGE_IP" ]; then
ARGS="$ARGS --bridge-ip $TADO_BRIDGE_IP"
fi
if [ -n "$TADO_BRIDGE_PIN" ]; then
ARGS="$ARGS --pin $TADO_BRIDGE_PIN"
fi
# Forward-compatible: PR #40 accessory support (comma-separated IPs and PINs)
if [ -n "$TADO_ACCESSORY_IP" ]; then
IFS=','
set -- $TADO_ACCESSORY_IP
idx=0
for ip in "$@"; do
pin=$(echo "$TADO_ACCESSORY_PIN" | cut -d',' -f$((idx + 1)))
ARGS="$ARGS --accessory-ip $ip"
[ -n "$pin" ] && ARGS="$ARGS --accessory-pin $pin"
idx=$((idx + 1))
done
unset IFS
fi
exec tado-local $ARGS