From d0b51842703c1726efd5871bff75de9ced28109d Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Mon, 17 Nov 2025 10:23:42 +0100 Subject: [PATCH] start script --- apps/homekit/start_bridge.sh | 59 ++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 apps/homekit/start_bridge.sh diff --git a/apps/homekit/start_bridge.sh b/apps/homekit/start_bridge.sh new file mode 100755 index 0000000..291b556 --- /dev/null +++ b/apps/homekit/start_bridge.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# HomeKit Bridge Startup Script +# This script sets up the virtual environment, installs dependencies, and starts the bridge + +set -e # Exit on error + +# Change to script directory +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "$SCRIPT_DIR" + +echo "🏠 HomeKit Bridge Startup" +echo "=========================" + +# Virtual environment path +VENV_DIR="$SCRIPT_DIR/venv" + +# Check if virtual environment exists +if [ ! -d "$VENV_DIR" ]; then + echo "📦 Virtual environment not found. Creating..." + python3 -m venv "$VENV_DIR" + echo "✅ Virtual environment created at $VENV_DIR" +fi + +# Activate virtual environment +echo "🔧 Activating virtual environment..." +source "$VENV_DIR/bin/activate" + +# Install/update dependencies +echo "📥 Installing dependencies from requirements.txt..." +pip install --upgrade pip -q +pip install -r requirements.txt -q +echo "✅ Dependencies installed" + +# Set environment variables (with defaults) +export HOMEKIT_NAME="${HOMEKIT_NAME:-Home Automation Bridge}" +export HOMEKIT_PIN="${HOMEKIT_PIN:-031-45-154}" +export HOMEKIT_PORT="${HOMEKIT_PORT:-51826}" +export API_BASE="${API_BASE:-http://172.19.1.11:8001}" +export HOMEKIT_API_TOKEN="${HOMEKIT_API_TOKEN:-}" +export HOMEKIT_PERSIST_FILE="${HOMEKIT_PERSIST_FILE:-$SCRIPT_DIR/homekit.state}" + +# Display configuration +echo "" +echo "⚙️ Configuration:" +echo " Bridge Name: $HOMEKIT_NAME" +echo " Bridge PIN: $HOMEKIT_PIN" +echo " Bridge Port: $HOMEKIT_PORT" +echo " API Base URL: $API_BASE" +echo " Persist File: $HOMEKIT_PERSIST_FILE" +echo "" + +# Start the bridge +echo "🚀 Starting HomeKit Bridge..." +echo " (Press Ctrl+C to stop)" +echo "" + +# Run the bridge using Python module syntax +python -m apps.homekit.main