#!/usr/bin/env bash # Test all voice pipeline services are running and accessible set -euo pipefail echo "Testing Voice Pipeline Services..." echo "==================================" echo "" # Colors for output GREEN='\033[0;32m' RED='\033[0;31m' YELLOW='\033[1;33m' NC='\033[0m' # No Color # Test function test_service() { local name=$1 local host=$2 local port=$3 if nc -z -w 2 "$host" "$port" 2>/dev/null; then echo -e "${GREEN}✓${NC} $name ($host:$port)" return 0 else echo -e "${RED}✗${NC} $name ($host:$port) - NOT ACCESSIBLE" return 1 fi } # Test launchd service test_launchd() { local name=$1 local service=$2 if launchctl list | grep -q "$service"; then echo -e "${GREEN}✓${NC} $name (launchd: $service)" return 0 else echo -e "${RED}✗${NC} $name (launchd: $service) - NOT RUNNING" return 1 fi } # Test command availability test_command() { local name=$1 local cmd=$2 if command -v "$cmd" &> /dev/null; then echo -e "${GREEN}✓${NC} $name command available" return 0 else echo -e "${RED}✗${NC} $name command NOT FOUND" return 1 fi } echo "1. Network Services" echo "-------------------" test_service "Wyoming STT" "localhost" "10300" test_service "Wyoming TTS" "localhost" "10301" test_service "Wyoming Satellite" "localhost" "10700" test_service "OpenClaw Gateway" "localhost" "8080" test_service "Ollama" "localhost" "11434" test_service "Home Assistant" "10.0.0.199" "8123" echo "" echo "2. Launchd Services" echo "-------------------" test_launchd "Wyoming STT" "com.homeai.wyoming-stt" test_launchd "Wyoming TTS" "com.homeai.wyoming-tts" test_launchd "Wyoming Satellite" "com.homeai.wyoming-satellite" test_launchd "Wake Word" "com.homeai.wakeword" test_launchd "OpenClaw" "com.homeai.openclaw" test_launchd "Ollama" "com.homeai.ollama" echo "" echo "3. Commands" echo "-----------" test_command "OpenClaw" "openclaw" test_command "Ollama" "ollama" test_command "SoX (play)" "play" test_command "SoX (rec)" "rec" echo "" echo "4. Wyoming Protocol Test" echo "------------------------" if command -v wyoming-client &> /dev/null; then echo -e "${YELLOW}Testing STT...${NC}" # Would need a test audio file echo " (Manual test required with audio file)" echo -e "${YELLOW}Testing TTS...${NC}" # Would need Wyoming client echo " (Manual test required with Wyoming client)" else echo -e "${YELLOW}⚠${NC} wyoming-client not installed (optional)" fi echo "" echo "5. OpenClaw Test" echo "----------------" if command -v openclaw &> /dev/null; then echo -e "${YELLOW}Testing OpenClaw agent...${NC}" if timeout 10 openclaw agent --message "Hello" --agent main &>/dev/null; then echo -e "${GREEN}✓${NC} OpenClaw agent responding" else echo -e "${RED}✗${NC} OpenClaw agent not responding" fi else echo -e "${RED}✗${NC} OpenClaw command not found" fi echo "" echo "6. Audio Devices" echo "----------------" if command -v rec &> /dev/null; then echo "Input devices:" rec -n stat trim 0 0.1 2>&1 | grep -i "input" || echo " (Unable to detect)" echo "Output devices:" if command -v afplay &> /dev/null; then echo -e "${GREEN}✓${NC} afplay available for audio output" else echo -e "${RED}✗${NC} afplay not available" fi else echo -e "${YELLOW}⚠${NC} SoX not installed - audio recording unavailable" fi echo "" echo "==================================" echo "Test complete!" echo "" echo "Next steps:" echo "1. Install OpenClaw conversation component in Home Assistant" echo "2. Configure Wyoming integrations in HA UI" echo "3. Create voice assistant pipeline" echo "4. Test with: 'Hey Jarvis, what time is it?'"