- Add openclaw-http-bridge.py: HTTP server translating POST requests to OpenClaw CLI calls - Add launchd plist for HTTP bridge (port 8081, auto-start) - Add install-to-docker-ha.sh: deploy custom component to Docker HA via SSH - Add package-for-ha.sh: create distributable tarball of custom component - Add test-services.sh: comprehensive voice pipeline service checker Fixes from code review: - Use OpenClawAgent (HTTP) in async_setup_entry instead of OpenClawCLIAgent (CLI agent fails inside Docker HA where openclaw binary doesn't exist) - Update all port references from 8080 to 8081 (HTTP bridge port) - Remove overly permissive CORS headers from HTTP bridge - Fix zombie process leak: kill child process on CLI timeout - Remove unused subprocess import in conversation.py - Add version field to Kokoro TTS Wyoming info - Update TODO.md with voice pipeline progress
67 lines
1.9 KiB
Bash
Executable File
67 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Install OpenClaw Conversation custom component to Home Assistant
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
COMPONENT_NAME="openclaw_conversation"
|
|
|
|
# Detect Home Assistant config directory
|
|
if [[ -d "/config" ]]; then
|
|
HA_CONFIG="/config"
|
|
elif [[ -d "$HOME/.homeassistant" ]]; then
|
|
HA_CONFIG="$HOME/.homeassistant"
|
|
elif [[ -d "$HOME/homeassistant" ]]; then
|
|
HA_CONFIG="$HOME/homeassistant"
|
|
else
|
|
echo "Error: Could not find Home Assistant config directory"
|
|
echo "Please specify manually: ./install.sh /path/to/config"
|
|
exit 1
|
|
fi
|
|
|
|
# Allow override via command line
|
|
if [[ $# -ge 1 ]]; then
|
|
HA_CONFIG="$1"
|
|
fi
|
|
|
|
CUSTOM_COMPONENTS_DIR="$HA_CONFIG/custom_components"
|
|
TARGET_DIR="$CUSTOM_COMPONENTS_DIR/$COMPONENT_NAME"
|
|
|
|
echo "Installing OpenClaw Conversation custom component..."
|
|
echo " Source: $SCRIPT_DIR/$COMPONENT_NAME"
|
|
echo " Target: $TARGET_DIR"
|
|
echo ""
|
|
|
|
# Create custom_components directory if it doesn't exist
|
|
mkdir -p "$CUSTOM_COMPONENTS_DIR"
|
|
|
|
# Remove old installation if exists
|
|
if [[ -d "$TARGET_DIR" ]]; then
|
|
echo "Removing old installation..."
|
|
rm -rf "$TARGET_DIR"
|
|
fi
|
|
|
|
# Copy component files
|
|
cp -r "$SCRIPT_DIR/$COMPONENT_NAME" "$TARGET_DIR"
|
|
|
|
# Verify installation
|
|
if [[ -d "$TARGET_DIR" && -f "$TARGET_DIR/manifest.json" ]]; then
|
|
echo "✓ Installation successful!"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo " 1. Restart Home Assistant"
|
|
echo " 2. Go to Settings → Devices & Services → Add Integration"
|
|
echo " 3. Search for 'OpenClaw Conversation'"
|
|
echo " 4. Configure the settings (host: localhost, port: 8081)"
|
|
echo ""
|
|
echo " Or add to configuration.yaml:"
|
|
echo " openclaw_conversation:"
|
|
echo " openclaw_host: localhost"
|
|
echo " openclaw_port: 8081"
|
|
echo " agent_name: main"
|
|
echo " timeout: 30"
|
|
else
|
|
echo "✗ Installation failed"
|
|
exit 1
|
|
fi
|