- Перемещена документация в docs/ с четкой структурой: - tutorials/ — пошаговые руководства (2mic-hat, installer) - integration/ — техническая интеграция (vad-wakeword, mqtt-led) - deployment/ — развёртывание (systemd-services) - architecture/ — архитектура проекта (overview) - Обновлён README.md с навигацией по документации - DEPLOY.md сокращён до quick start с ссылками на docs/ - Добавлен docs/README.md — индекс документации - Создан QWEN.md — контекст для ИИ-ассистента - Удалён мусор: - wyoming_satellite.zip (build artifact) - wyoming-led.service, wyoming-satellite.service (дубликаты) - .qwen/settings.json.orig (бэкап) - .lgd-nfy0 (пустой файл) - docker/run (заглушка) - Обновлён .gitignore: - examples/led_brightness_config.json (автогенерируемый конфиг) - *.old, *.bak, *~ (бэкапы) - *.zip (архивы) - .qwen/settings.json.orig - *.lgd-* (пустые файлы) - led_brightness_config.json исключён из отслеживания (assume-unchanged) Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
141 lines
3.4 KiB
Markdown
141 lines
3.4 KiB
Markdown
# systemd Services Configuration
|
|
|
|
Detailed guide for configuring and managing Wyoming Satellite systemd services.
|
|
|
|
## Service Files Location
|
|
|
|
Service files are in the `services/` directory:
|
|
|
|
```
|
|
services/
|
|
├── wyoming-event.service # LED control + MQTT
|
|
├── wyoming-satelite-vosk.service # Main satellite
|
|
└── wyoming-wakeword-vosk.service # Wake word detection
|
|
```
|
|
|
|
## Installation Script
|
|
|
|
The `install_systemd_services.sh` script automatically:
|
|
|
|
1. Detects your virtual environment path
|
|
2. Determines the current user
|
|
3. Substitutes placeholders in service files
|
|
4. Copies services to `/etc/systemd/system/`
|
|
5. Installs the `satellite-python` wrapper to `/usr/local/bin/`
|
|
|
|
### Manual Installation
|
|
|
|
If the script doesn't work, install manually:
|
|
|
|
```bash
|
|
# 1. Edit service files, replacing placeholders:
|
|
# __SAT_BASE_DIR__ → /home/sirmrak/projects/Satellite
|
|
# __SAT_VENV__ → /home/sirmrak/.venv_satellite
|
|
# __CURRENT_USER__ → sirmrak
|
|
|
|
# 2. Copy to systemd directory
|
|
sudo cp services/*.service /etc/systemd/system/
|
|
|
|
# 3. Reload systemd
|
|
sudo systemctl daemon-reload
|
|
|
|
# 4. Enable and start
|
|
sudo systemctl enable --now wyoming-satelite-vosk.service
|
|
```
|
|
|
|
## Service Details
|
|
|
|
### wyoming-satelite-vosk.service
|
|
|
|
Main Wyoming satellite service. Connects to:
|
|
- Microphone (arecord)
|
|
- Speaker (aplay)
|
|
- Wake word service (optional, port 10400)
|
|
- Event service (optional, port 10500)
|
|
|
|
**Ports:** 10700 (Wyoming protocol)
|
|
|
|
**Dependencies:** network.target
|
|
|
|
### wyoming-wakeword-vosk.service
|
|
|
|
Vosk-based wake word detection service. Listens for Russian wake words:
|
|
- "привет дроид"
|
|
- "привет придурок"
|
|
- "привет жопа с ушами"
|
|
|
|
**Ports:** 10400 (Wyoming protocol)
|
|
|
|
**Configuration:** `local/vosk-wake-dev/wyoming_vosk_wake/config.yaml`
|
|
|
|
### wyoming-event.service
|
|
|
|
LED control and MQTT integration for ReSpeaker XVF3800.
|
|
|
|
**Ports:** 10500 (Wyoming event protocol)
|
|
|
|
**MQTT Topics:**
|
|
- `wyoming/led/command` — Commands from Home Assistant
|
|
- `wyoming/led/brightness/set` — Set brightness (0-255)
|
|
- `wyoming/led/brightness/state` — Current brightness state
|
|
- `wyoming/led/state` — LED state
|
|
- `wyoming/led/availability` — Online/offline status
|
|
|
|
## Management Commands
|
|
|
|
```bash
|
|
# Check status
|
|
sudo systemctl status wyoming-satelite-vosk.service
|
|
|
|
# View logs (real-time)
|
|
journalctl -u wyoming-satelite-vosk.service -f
|
|
|
|
# Restart service
|
|
sudo systemctl restart wyoming-satelite-vosk.service
|
|
|
|
# Disable service
|
|
sudo systemctl disable --now wyoming-satelite-vosk.service
|
|
|
|
# Reload systemd after changes
|
|
sudo systemctl daemon-reload
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
### Service won't start
|
|
|
|
```bash
|
|
# Check status and recent errors
|
|
sudo systemctl status wyoming-satelite-vosk.service
|
|
|
|
# View full logs
|
|
journalctl -u wyoming-satelite-vosk.service -n 100
|
|
|
|
# Check Python path
|
|
which satellite-python
|
|
satellite-python --version
|
|
```
|
|
|
|
### Common Issues
|
|
|
|
| Issue | Solution |
|
|
|-------|----------|
|
|
| `ModuleNotFoundError` | Check venv path in service file |
|
|
| `arecord: command not found` | Install `alsa-utils` |
|
|
| Permission denied | Check `User=` directive matches your username |
|
|
| Port already in use | Check if another instance is running |
|
|
|
|
## Wrapper Script
|
|
|
|
The `satellite-python` wrapper allows running Python from venv without full path:
|
|
|
|
```bash
|
|
# Installed to /usr/local/bin/satellite-python
|
|
satellite-python --version # Uses venv Python
|
|
```
|
|
|
|
Used in service files:
|
|
```ini
|
|
ExecStart=satellite-python -m wyoming_satellite ...
|
|
```
|