Commit ·
b78364c
1
Parent(s): cb0faf1
feat: add automated installation scripts and model checking
Browse files- Add install.sh for automated installation on Linux/Mac
- Add install.ps1 for automated installation on Windows
- Scripts automatically:
- Check Python version
- Create virtual environment
- Install dependencies
- Download wake word models and sound effects
- Create .env configuration file
- Check Reachy Mini SDK installation
- Check audio devices
- Add model file checking in __init__.py
- Warn users if required files are missing
- Provide clear instructions for downloading missing files
- Users can now install with a single command
- install.ps1 +100 -0
- install.sh +95 -0
- src/reachy_mini_ha_voice/__init__.py +63 -4
install.ps1
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Automated installation script for Reachy Mini Home Assistant Voice Assistant
|
| 2 |
+
|
| 3 |
+
$ErrorActionPreference = "Stop"
|
| 4 |
+
|
| 5 |
+
Write-Host "==========================================" -ForegroundColor Cyan
|
| 6 |
+
Write-Host "Reachy Mini Home Assistant Voice Assistant" -ForegroundColor Cyan
|
| 7 |
+
Write-Host "Automated Installation Script" -ForegroundColor Cyan
|
| 8 |
+
Write-Host "==========================================" -ForegroundColor Cyan
|
| 9 |
+
Write-Host ""
|
| 10 |
+
|
| 11 |
+
# Check Python version
|
| 12 |
+
Write-Host "Checking Python version..." -ForegroundColor Yellow
|
| 13 |
+
try {
|
| 14 |
+
$pythonVersion = python --version 2>&1
|
| 15 |
+
Write-Host "✓ Python version: $pythonVersion" -ForegroundColor Green
|
| 16 |
+
} catch {
|
| 17 |
+
Write-Host "✗ Python not found. Please install Python 3.8 or higher." -ForegroundColor Red
|
| 18 |
+
exit 1
|
| 19 |
+
}
|
| 20 |
+
Write-Host ""
|
| 21 |
+
|
| 22 |
+
# Create virtual environment
|
| 23 |
+
Write-Host "Creating virtual environment..." -ForegroundColor Yellow
|
| 24 |
+
python -m venv .venv
|
| 25 |
+
Write-Host "✓ Virtual environment created" -ForegroundColor Green
|
| 26 |
+
Write-Host ""
|
| 27 |
+
|
| 28 |
+
# Activate virtual environment
|
| 29 |
+
Write-Host "Activating virtual environment..." -ForegroundColor Yellow
|
| 30 |
+
& .\.venv\Scripts\Activate.ps1
|
| 31 |
+
Write-Host "✓ Virtual environment activated" -ForegroundColor Green
|
| 32 |
+
Write-Host ""
|
| 33 |
+
|
| 34 |
+
# Upgrade pip
|
| 35 |
+
Write-Host "Upgrading pip..." -ForegroundColor Yellow
|
| 36 |
+
python -m pip install --upgrade pip
|
| 37 |
+
Write-Host "✓ Pip upgraded" -ForegroundColor Green
|
| 38 |
+
Write-Host ""
|
| 39 |
+
|
| 40 |
+
# Install dependencies
|
| 41 |
+
Write-Host "Installing dependencies..." -ForegroundColor Yellow
|
| 42 |
+
pip install -e .
|
| 43 |
+
Write-Host "✓ Dependencies installed" -ForegroundColor Green
|
| 44 |
+
Write-Host ""
|
| 45 |
+
|
| 46 |
+
# Download wake word models and sound effects
|
| 47 |
+
Write-Host "Downloading wake word models and sound effects..." -ForegroundColor Yellow
|
| 48 |
+
powershell -ExecutionPolicy Bypass -File download_models.ps1
|
| 49 |
+
Write-Host "✓ Models and sound effects downloaded" -ForegroundColor Green
|
| 50 |
+
Write-Host ""
|
| 51 |
+
|
| 52 |
+
# Copy environment template
|
| 53 |
+
Write-Host "Creating environment configuration..." -ForegroundColor Yellow
|
| 54 |
+
if (-not (Test-Path ".env")) {
|
| 55 |
+
Copy-Item .env.example .env
|
| 56 |
+
Write-Host "✓ Created .env file from template" -ForegroundColor Green
|
| 57 |
+
} else {
|
| 58 |
+
Write-Host "⚠ .env file already exists, skipping..." -ForegroundColor Yellow
|
| 59 |
+
}
|
| 60 |
+
Write-Host ""
|
| 61 |
+
|
| 62 |
+
# Check if Reachy Mini SDK is installed
|
| 63 |
+
Write-Host "Checking Reachy Mini SDK..." -ForegroundColor Yellow
|
| 64 |
+
try {
|
| 65 |
+
python -c "import reachy_mini" 2>$null
|
| 66 |
+
Write-Host "✓ Reachy Mini SDK is installed" -ForegroundColor Green
|
| 67 |
+
} catch {
|
| 68 |
+
Write-Host "⚠ Reachy Mini SDK is not installed" -ForegroundColor Yellow
|
| 69 |
+
Write-Host " Please install it with: pip install reachy-mini" -ForegroundColor Gray
|
| 70 |
+
Write-Host " Or for wireless version: pip install reachy-mini[wireless]" -ForegroundColor Gray
|
| 71 |
+
}
|
| 72 |
+
Write-Host ""
|
| 73 |
+
|
| 74 |
+
# Check audio devices
|
| 75 |
+
Write-Host "Checking audio devices..." -ForegroundColor Yellow
|
| 76 |
+
try {
|
| 77 |
+
python -m reachy_mini_ha_voice --list-input-devices 2>$null
|
| 78 |
+
} catch {
|
| 79 |
+
Write-Host " (Will check on first run)" -ForegroundColor Gray
|
| 80 |
+
}
|
| 81 |
+
try {
|
| 82 |
+
python -m reachy_mini_ha_voice --list-output-devices 2>$null
|
| 83 |
+
} catch {
|
| 84 |
+
Write-Host " (Will check on first run)" -ForegroundColor Gray
|
| 85 |
+
}
|
| 86 |
+
Write-Host ""
|
| 87 |
+
|
| 88 |
+
# Installation complete
|
| 89 |
+
Write-Host "==========================================" -ForegroundColor Cyan
|
| 90 |
+
Write-Host "✓ Installation complete!" -ForegroundColor Green
|
| 91 |
+
Write-Host "==========================================" -ForegroundColor Cyan
|
| 92 |
+
Write-Host ""
|
| 93 |
+
Write-Host "Next steps:" -ForegroundColor Cyan
|
| 94 |
+
Write-Host "1. Edit .env file to configure your settings" -ForegroundColor White
|
| 95 |
+
Write-Host "2. Run the application:" -ForegroundColor White
|
| 96 |
+
Write-Host " .\.venv\Scripts\Activate.ps1" -ForegroundColor Gray
|
| 97 |
+
Write-Host " python -m reachy_mini_ha_voice" -ForegroundColor Gray
|
| 98 |
+
Write-Host ""
|
| 99 |
+
Write-Host "For more information, see README.md or QUICKSTART.md" -ForegroundColor Gray
|
| 100 |
+
Write-Host ""
|
install.sh
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Automated installation script for Reachy Mini Home Assistant Voice Assistant
|
| 3 |
+
|
| 4 |
+
set -e # Exit on error
|
| 5 |
+
|
| 6 |
+
echo "=========================================="
|
| 7 |
+
echo "Reachy Mini Home Assistant Voice Assistant"
|
| 8 |
+
echo "Automated Installation Script"
|
| 9 |
+
echo "=========================================="
|
| 10 |
+
echo ""
|
| 11 |
+
|
| 12 |
+
# Check Python version
|
| 13 |
+
echo "Checking Python version..."
|
| 14 |
+
PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}')
|
| 15 |
+
PYTHON_MAJOR=$(echo $PYTHON_VERSION | cut -d. -f1)
|
| 16 |
+
PYTHON_MINOR=$(echo $PYTHON_VERSION | cut -d. -f2)
|
| 17 |
+
|
| 18 |
+
if [ "$PYTHON_MAJOR" -lt 3 ] || ([ "$PYTHON_MAJOR" -eq 3 ] && [ "$PYTHON_MINOR" -lt 8 ]); then
|
| 19 |
+
echo "Error: Python 3.8 or higher is required. Found: $PYTHON_VERSION"
|
| 20 |
+
exit 1
|
| 21 |
+
fi
|
| 22 |
+
|
| 23 |
+
echo "✓ Python version: $PYTHON_VERSION"
|
| 24 |
+
echo ""
|
| 25 |
+
|
| 26 |
+
# Create virtual environment
|
| 27 |
+
echo "Creating virtual environment..."
|
| 28 |
+
python3 -m venv .venv
|
| 29 |
+
echo "✓ Virtual environment created"
|
| 30 |
+
echo ""
|
| 31 |
+
|
| 32 |
+
# Activate virtual environment
|
| 33 |
+
echo "Activating virtual environment..."
|
| 34 |
+
source .venv/bin/activate
|
| 35 |
+
echo "✓ Virtual environment activated"
|
| 36 |
+
echo ""
|
| 37 |
+
|
| 38 |
+
# Upgrade pip
|
| 39 |
+
echo "Upgrading pip..."
|
| 40 |
+
pip install --upgrade pip
|
| 41 |
+
echo "✓ Pip upgraded"
|
| 42 |
+
echo ""
|
| 43 |
+
|
| 44 |
+
# Install dependencies
|
| 45 |
+
echo "Installing dependencies..."
|
| 46 |
+
pip install -e .
|
| 47 |
+
echo "✓ Dependencies installed"
|
| 48 |
+
echo ""
|
| 49 |
+
|
| 50 |
+
# Download wake word models and sound effects
|
| 51 |
+
echo "Downloading wake word models and sound effects..."
|
| 52 |
+
./download_models.sh
|
| 53 |
+
echo "✓ Models and sound effects downloaded"
|
| 54 |
+
echo ""
|
| 55 |
+
|
| 56 |
+
# Copy environment template
|
| 57 |
+
echo "Creating environment configuration..."
|
| 58 |
+
if [ ! -f .env ]; then
|
| 59 |
+
cp .env.example .env
|
| 60 |
+
echo "✓ Created .env file from template"
|
| 61 |
+
else
|
| 62 |
+
echo "⚠ .env file already exists, skipping..."
|
| 63 |
+
fi
|
| 64 |
+
echo ""
|
| 65 |
+
|
| 66 |
+
# Check if Reachy Mini SDK is installed
|
| 67 |
+
echo "Checking Reachy Mini SDK..."
|
| 68 |
+
if python -c "import reachy_mini" 2>/dev/null; then
|
| 69 |
+
echo "✓ Reachy Mini SDK is installed"
|
| 70 |
+
else
|
| 71 |
+
echo "⚠ Reachy Mini SDK is not installed"
|
| 72 |
+
echo " Please install it with: pip install reachy-mini"
|
| 73 |
+
echo " Or for wireless version: pip install reachy-mini[wireless]"
|
| 74 |
+
fi
|
| 75 |
+
echo ""
|
| 76 |
+
|
| 77 |
+
# Check audio devices
|
| 78 |
+
echo "Checking audio devices..."
|
| 79 |
+
python -m reachy_mini_ha_voice --list-input-devices 2>/dev/null || echo " (Will check on first run)"
|
| 80 |
+
python -m reachy_mini_ha_voice --list-output-devices 2>/dev/null || echo " (Will check on first run)"
|
| 81 |
+
echo ""
|
| 82 |
+
|
| 83 |
+
# Installation complete
|
| 84 |
+
echo "=========================================="
|
| 85 |
+
echo "✓ Installation complete!"
|
| 86 |
+
echo "=========================================="
|
| 87 |
+
echo ""
|
| 88 |
+
echo "Next steps:"
|
| 89 |
+
echo "1. Edit .env file to configure your settings"
|
| 90 |
+
echo "2. Run the application:"
|
| 91 |
+
echo " source .venv/bin/activate"
|
| 92 |
+
echo " python -m reachy_mini_ha_voice"
|
| 93 |
+
echo ""
|
| 94 |
+
echo "For more information, see README.md or QUICKSTART.md"
|
| 95 |
+
echo ""
|
src/reachy_mini_ha_voice/__init__.py
CHANGED
|
@@ -1,14 +1,73 @@
|
|
| 1 |
"""
|
| 2 |
Reachy Mini Home Assistant Voice Assistant
|
| 3 |
|
| 4 |
-
A voice assistant
|
| 5 |
-
via the ESPHome protocol.
|
| 6 |
"""
|
| 7 |
|
| 8 |
__version__ = "0.1.0"
|
| 9 |
__author__ = "Your Name"
|
| 10 |
__email__ = "your.email@example.com"
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
"""
|
| 2 |
Reachy Mini Home Assistant Voice Assistant
|
| 3 |
|
| 4 |
+
A voice assistant application that runs on Reachy Mini robot and integrates
|
| 5 |
+
with Home Assistant via the ESPHome protocol.
|
| 6 |
"""
|
| 7 |
|
| 8 |
__version__ = "0.1.0"
|
| 9 |
__author__ = "Your Name"
|
| 10 |
__email__ = "your.email@example.com"
|
| 11 |
|
| 12 |
+
# Check for required models on import
|
| 13 |
+
import os
|
| 14 |
+
import sys
|
| 15 |
+
from pathlib import Path
|
| 16 |
|
| 17 |
+
def check_required_files():
|
| 18 |
+
"""Check if required model files exist"""
|
| 19 |
+
wakewords_dir = Path(__file__).parent.parent.parent / "wakewords"
|
| 20 |
+
sounds_dir = Path(__file__).parent.parent.parent / "sounds"
|
| 21 |
+
|
| 22 |
+
missing_files = []
|
| 23 |
+
|
| 24 |
+
# Check wake word models
|
| 25 |
+
required_models = [
|
| 26 |
+
wakewords_dir / "okay_nabu.tflite",
|
| 27 |
+
wakewords_dir / "okay_nabu.json",
|
| 28 |
+
]
|
| 29 |
+
|
| 30 |
+
for model_file in required_models:
|
| 31 |
+
if not model_file.exists():
|
| 32 |
+
missing_files.append(model_file.name)
|
| 33 |
+
|
| 34 |
+
# Check sound effects
|
| 35 |
+
required_sounds = [
|
| 36 |
+
sounds_dir / "wake_word_triggered.flac",
|
| 37 |
+
sounds_dir / "timer_finished.flac",
|
| 38 |
+
]
|
| 39 |
+
|
| 40 |
+
for sound_file in required_sounds:
|
| 41 |
+
if not sound_file.exists():
|
| 42 |
+
missing_files.append(sound_file.name)
|
| 43 |
+
|
| 44 |
+
if missing_files:
|
| 45 |
+
print("\n" + "="*60)
|
| 46 |
+
print("WARNING: Required files are missing!")
|
| 47 |
+
print("="*60)
|
| 48 |
+
print("\nMissing files:")
|
| 49 |
+
for file in missing_files:
|
| 50 |
+
print(f" - {file}")
|
| 51 |
+
|
| 52 |
+
print("\nPlease run the download script:")
|
| 53 |
+
print(" Linux/Mac: ./download_models.sh")
|
| 54 |
+
print(" Windows: powershell -ExecutionPolicy Bypass -File download_models.ps1")
|
| 55 |
+
print("\nOr run the automated installation script:")
|
| 56 |
+
print(" Linux/Mac: ./install.sh")
|
| 57 |
+
print(" Windows: powershell -ExecutionPolicy Bypass -File install.ps1")
|
| 58 |
+
print("="*60 + "\n")
|
| 59 |
+
return False
|
| 60 |
+
|
| 61 |
+
return True
|
| 62 |
+
|
| 63 |
+
# Check on import
|
| 64 |
+
check_required_files()
|
| 65 |
+
|
| 66 |
+
from .app import ReachyMiniVoiceApp
|
| 67 |
+
from .state import ServerState
|
| 68 |
+
|
| 69 |
+
__all__ = [
|
| 70 |
+
"ReachyMiniVoiceApp",
|
| 71 |
+
"ServerState",
|
| 72 |
+
"__version__",
|
| 73 |
+
]
|