Rename integration from spotify_search to spotify_voice_assistant
Rename integration for consistent branding: - User-facing name: "Spotify Voice Assistant" - Integration name: "Spotify Voice Assistant Search" - Domain: spotify_voice_assistant Changes: - Rename custom_components/spotify_search/ to spotify_voice_assistant/ - Update domain in manifest.json and __init__.py - Update all service references in examples - Update all documentation references
This commit is contained in:
+30
-30
@@ -13,14 +13,14 @@ For Docker-based Home Assistant installations, use a bind mount to link this rep
|
|||||||
```bash
|
```bash
|
||||||
# Docker run example
|
# Docker run example
|
||||||
docker run ... \
|
docker run ... \
|
||||||
-v /path/to/spotify-voice-assistant/custom_components/spotify_search:/config/custom_components/spotify_search:ro \
|
-v /path/to/spotify-voice-assistant/custom_components/spotify_voice_assistant:/config/custom_components/spotify_voice_assistant:ro \
|
||||||
...
|
...
|
||||||
|
|
||||||
# docker-compose.yml example
|
# docker-compose.yml example
|
||||||
services:
|
services:
|
||||||
homeassistant:
|
homeassistant:
|
||||||
volumes:
|
volumes:
|
||||||
- /path/to/spotify-voice-assistant/custom_components/spotify_search:/config/custom_components/spotify_search:ro
|
- /path/to/spotify-voice-assistant/custom_components/spotify_voice_assistant:/config/custom_components/spotify_voice_assistant:ro
|
||||||
```
|
```
|
||||||
|
|
||||||
**Benefits:**
|
**Benefits:**
|
||||||
@@ -38,11 +38,11 @@ If you have direct filesystem access to your Home Assistant config directory:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Remove existing installation (if using HACS version)
|
# Remove existing installation (if using HACS version)
|
||||||
rm -rf /path/to/homeassistant/config/custom_components/spotify_search
|
rm -rf /path/to/homeassistant/config/custom_components/spotify_voice_assistant
|
||||||
|
|
||||||
# Create symlink to your development repo
|
# Create symlink to your development repo
|
||||||
ln -s /path/to/your/spotify-voice-assistant/custom_components/spotify_search \
|
ln -s /path/to/your/spotify-voice-assistant/custom_components/spotify_voice_assistant \
|
||||||
/path/to/homeassistant/config/custom_components/spotify_search
|
/path/to/homeassistant/config/custom_components/spotify_voice_assistant
|
||||||
```
|
```
|
||||||
|
|
||||||
**Important for Docker:** If using symlinks with Docker, ensure the symlink target path is accessible from inside the container (either mounted or within the config volume).
|
**Important for Docker:** If using symlinks with Docker, ensure the symlink target path is accessible from inside the container (either mounted or within the config volume).
|
||||||
@@ -71,7 +71,7 @@ Understanding when you need to restart Home Assistant vs just reloading the inte
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd /path/to/your/spotify-voice-assistant
|
cd /path/to/your/spotify-voice-assistant
|
||||||
# Edit files in custom_components/spotify_search/
|
# Edit files in custom_components/spotify_voice_assistant/
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Test Changes
|
### 2. Test Changes
|
||||||
@@ -84,7 +84,7 @@ docker restart homeassistant
|
|||||||
# Use Developer Tools > YAML > Core Configuration
|
# Use Developer Tools > YAML > Core Configuration
|
||||||
|
|
||||||
# Watch logs in real-time
|
# Watch logs in real-time
|
||||||
docker logs -f homeassistant 2>&1 | grep spotify_search
|
docker logs -f homeassistant 2>&1 | grep spotify_voice_assistant
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Commit Changes
|
### 3. Commit Changes
|
||||||
@@ -122,7 +122,7 @@ docker restart homeassistant
|
|||||||
**For symlink setup:**
|
**For symlink setup:**
|
||||||
```bash
|
```bash
|
||||||
# Remove symlink
|
# Remove symlink
|
||||||
rm /path/to/homeassistant/config/custom_components/spotify_search
|
rm /path/to/homeassistant/config/custom_components/spotify_voice_assistant
|
||||||
|
|
||||||
# Install via HACS
|
# Install via HACS
|
||||||
# HACS > Integrations > Spotify Voice Assistant > Install
|
# HACS > Integrations > Spotify Voice Assistant > Install
|
||||||
@@ -141,11 +141,11 @@ docker restart homeassistant
|
|||||||
**For symlink setup:**
|
**For symlink setup:**
|
||||||
```bash
|
```bash
|
||||||
# Remove HACS version
|
# Remove HACS version
|
||||||
rm -rf /path/to/homeassistant/config/custom_components/spotify_search
|
rm -rf /path/to/homeassistant/config/custom_components/spotify_voice_assistant
|
||||||
|
|
||||||
# Recreate symlink
|
# Recreate symlink
|
||||||
ln -s /path/to/your/spotify-voice-assistant/custom_components/spotify_search \
|
ln -s /path/to/your/spotify-voice-assistant/custom_components/spotify_voice_assistant \
|
||||||
/path/to/homeassistant/config/custom_components/spotify_search
|
/path/to/homeassistant/config/custom_components/spotify_voice_assistant
|
||||||
|
|
||||||
# Restart Home Assistant
|
# Restart Home Assistant
|
||||||
```
|
```
|
||||||
@@ -174,7 +174,7 @@ Before each release:
|
|||||||
```
|
```
|
||||||
spotify-voice-assistant/
|
spotify-voice-assistant/
|
||||||
├── custom_components/
|
├── custom_components/
|
||||||
│ └── spotify_search/
|
│ └── spotify_voice_assistant/
|
||||||
│ ├── __init__.py # Main integration code
|
│ ├── __init__.py # Main integration code
|
||||||
│ ├── manifest.json # Version and metadata
|
│ ├── manifest.json # Version and metadata
|
||||||
│ └── services.yaml # Service definitions
|
│ └── services.yaml # Service definitions
|
||||||
@@ -195,7 +195,7 @@ In Home Assistant `configuration.yaml`:
|
|||||||
logger:
|
logger:
|
||||||
default: info
|
default: info
|
||||||
logs:
|
logs:
|
||||||
custom_components.spotify_search: debug
|
custom_components.spotify_voice_assistant: debug
|
||||||
```
|
```
|
||||||
|
|
||||||
After adding debug logging, restart Home Assistant to apply.
|
After adding debug logging, restart Home Assistant to apply.
|
||||||
@@ -204,31 +204,31 @@ After adding debug logging, restart Home Assistant to apply.
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Watch integration logs in real-time (Docker example)
|
# Watch integration logs in real-time (Docker example)
|
||||||
docker logs -f homeassistant 2>&1 | grep spotify_search
|
docker logs -f homeassistant 2>&1 | grep spotify_voice_assistant
|
||||||
|
|
||||||
# Check if integration loaded successfully
|
# Check if integration loaded successfully
|
||||||
docker logs homeassistant 2>&1 | grep "Setting up spotify_search"
|
docker logs homeassistant 2>&1 | grep "Setting up spotify_voice_assistant"
|
||||||
|
|
||||||
# Verify bind mount or symlink
|
# Verify bind mount or symlink
|
||||||
# For bind mount:
|
# For bind mount:
|
||||||
docker inspect homeassistant | grep spotify_search
|
docker inspect homeassistant | grep spotify_voice_assistant
|
||||||
|
|
||||||
# For symlink:
|
# For symlink:
|
||||||
ls -la /path/to/homeassistant/config/custom_components/spotify_search
|
ls -la /path/to/homeassistant/config/custom_components/spotify_voice_assistant
|
||||||
|
|
||||||
# Check manifest version
|
# Check manifest version
|
||||||
cat custom_components/spotify_search/manifest.json | grep version
|
cat custom_components/spotify_voice_assistant/manifest.json | grep version
|
||||||
|
|
||||||
# Check Python syntax without running
|
# Check Python syntax without running
|
||||||
python3 -m py_compile custom_components/spotify_search/__init__.py
|
python3 -m py_compile custom_components/spotify_voice_assistant/__init__.py
|
||||||
```
|
```
|
||||||
|
|
||||||
### Debug Logging Output
|
### Debug Logging Output
|
||||||
|
|
||||||
When working correctly, you should see:
|
When working correctly, you should see:
|
||||||
```
|
```
|
||||||
INFO Setting up spotify_search
|
INFO Setting up spotify_voice_assistant
|
||||||
INFO Setup of domain spotify_search took 0.00 seconds
|
INFO Setup of domain spotify_voice_assistant took 0.00 seconds
|
||||||
DEBUG Cache miss, performing Spotify entity lookup
|
DEBUG Cache miss, performing Spotify entity lookup
|
||||||
DEBUG Found Spotify entity: media_player.spotify_xxx
|
DEBUG Found Spotify entity: media_player.spotify_xxx
|
||||||
DEBUG Spotify client type: SpotifyClient
|
DEBUG Spotify client type: SpotifyClient
|
||||||
@@ -246,7 +246,7 @@ DEBUG Using cached Spotify client # <-- Caching is working!
|
|||||||
|
|
||||||
Via Developer Tools > Services:
|
Via Developer Tools > Services:
|
||||||
```yaml
|
```yaml
|
||||||
service: spotify_search.search
|
service: spotify_voice_assistant.search
|
||||||
data:
|
data:
|
||||||
query: "Coldplay"
|
query: "Coldplay"
|
||||||
type: "artist"
|
type: "artist"
|
||||||
@@ -264,7 +264,7 @@ Expected response:
|
|||||||
### Test Clear Cache Service
|
### Test Clear Cache Service
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
service: spotify_search.clear_cache
|
service: spotify_voice_assistant.clear_cache
|
||||||
```
|
```
|
||||||
|
|
||||||
Expected response:
|
Expected response:
|
||||||
@@ -305,7 +305,7 @@ When making improvements:
|
|||||||
**Example:**
|
**Example:**
|
||||||
```bash
|
```bash
|
||||||
# Update manifest.json version to 1.1.0
|
# Update manifest.json version to 1.1.0
|
||||||
git add custom_components/spotify_search/manifest.json
|
git add custom_components/spotify_voice_assistant/manifest.json
|
||||||
git commit -m "Add support for podcast search"
|
git commit -m "Add support for podcast search"
|
||||||
git push
|
git push
|
||||||
|
|
||||||
@@ -332,17 +332,17 @@ cp /path/to/homeassistant/config/configuration.yaml \
|
|||||||
|
|
||||||
### Integration Not Loading
|
### Integration Not Loading
|
||||||
|
|
||||||
**Symptom:** No "Setting up spotify_search" in logs
|
**Symptom:** No "Setting up spotify_voice_assistant" in logs
|
||||||
|
|
||||||
**Check:**
|
**Check:**
|
||||||
1. Verify bind mount or symlink is correct
|
1. Verify bind mount or symlink is correct
|
||||||
2. Check `configuration.yaml` has `spotify_search:` entry
|
2. Check `configuration.yaml` has `spotify_voice_assistant:` entry
|
||||||
3. Ensure files are readable by HA container user
|
3. Ensure files are readable by HA container user
|
||||||
4. Look for Python syntax errors in logs
|
4. Look for Python syntax errors in logs
|
||||||
|
|
||||||
**Docker bind mount check:**
|
**Docker bind mount check:**
|
||||||
```bash
|
```bash
|
||||||
docker inspect homeassistant | grep -A2 spotify_search
|
docker inspect homeassistant | grep -A2 spotify_voice_assistant
|
||||||
```
|
```
|
||||||
|
|
||||||
### Symlink Not Working in Docker
|
### Symlink Not Working in Docker
|
||||||
@@ -367,13 +367,13 @@ docker inspect homeassistant | grep -A2 spotify_search
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Check Python syntax
|
# Check Python syntax
|
||||||
python3 -m py_compile custom_components/spotify_search/__init__.py
|
python3 -m py_compile custom_components/spotify_voice_assistant/__init__.py
|
||||||
|
|
||||||
# Check for common issues
|
# Check for common issues
|
||||||
grep -n "TODO\|FIXME\|XXX" custom_components/spotify_search/*.py
|
grep -n "TODO\|FIXME\|XXX" custom_components/spotify_voice_assistant/*.py
|
||||||
|
|
||||||
# Ensure no debug print statements
|
# Ensure no debug print statements
|
||||||
grep -n "print(" custom_components/spotify_search/*.py
|
grep -n "print(" custom_components/spotify_voice_assistant/*.py
|
||||||
```
|
```
|
||||||
|
|
||||||
### Code Standards
|
### Code Standards
|
||||||
|
|||||||
@@ -92,12 +92,12 @@ Say goodbye to complex configurations. Get voice-controlled music in 3 steps:
|
|||||||
|
|
||||||
**Manual Installation:**
|
**Manual Installation:**
|
||||||
1. Download this repository
|
1. Download this repository
|
||||||
2. Copy `custom_components/spotify_search` to your HA `custom_components` folder
|
2. Copy `custom_components/spotify_voice_assistant` to your HA `custom_components` folder
|
||||||
3. Restart Home Assistant
|
3. Restart Home Assistant
|
||||||
|
|
||||||
Add to `configuration.yaml`:
|
Add to `configuration.yaml`:
|
||||||
```yaml
|
```yaml
|
||||||
spotify_search:
|
spotify_voice_assistant:
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Configure Extended OpenAI Conversation
|
### 3. Configure Extended OpenAI Conversation
|
||||||
@@ -242,7 +242,7 @@ The integration leverages Home Assistant's official Spotify integration:
|
|||||||
|
|
||||||
### Performance Optimization
|
### Performance Optimization
|
||||||
|
|
||||||
The integration uses smart caching to speed up repeated searches. The Spotify client and user playlists are cached automatically. Cache clears on Home Assistant restart or can be cleared manually via the `spotify_search.clear_cache` service.
|
The integration uses smart caching to speed up repeated searches. The Spotify client and user playlists are cached automatically. Cache clears on Home Assistant restart or can be cleared manually via the `spotify_voice_assistant.clear_cache` service.
|
||||||
|
|
||||||
## Advanced Usage
|
## Advanced Usage
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ The integration supports five search types:
|
|||||||
Test the search service directly:
|
Test the search service directly:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
service: spotify_search.search
|
service: spotify_voice_assistant.search
|
||||||
data:
|
data:
|
||||||
query: "Coldplay"
|
query: "Coldplay"
|
||||||
type: "artist"
|
type: "artist"
|
||||||
@@ -285,7 +285,7 @@ Response:
|
|||||||
Test user playlist search:
|
Test user playlist search:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
service: spotify_search.search
|
service: spotify_voice_assistant.search
|
||||||
data:
|
data:
|
||||||
query: "workout"
|
query: "workout"
|
||||||
type: "user_playlist"
|
type: "user_playlist"
|
||||||
@@ -309,7 +309,7 @@ automation:
|
|||||||
- platform: time
|
- platform: time
|
||||||
at: "07:00:00"
|
at: "07:00:00"
|
||||||
action:
|
action:
|
||||||
- service: spotify_search.search
|
- service: spotify_voice_assistant.search
|
||||||
response_variable: artist_result
|
response_variable: artist_result
|
||||||
data:
|
data:
|
||||||
query: "Chillhop Music"
|
query: "Chillhop Music"
|
||||||
@@ -327,7 +327,7 @@ automation:
|
|||||||
If you experience issues or want to refresh cached data (e.g., after adding new playlists to your Spotify library), you can manually clear the cache:
|
If you experience issues or want to refresh cached data (e.g., after adding new playlists to your Spotify library), you can manually clear the cache:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
service: spotify_search.clear_cache
|
service: spotify_voice_assistant.clear_cache
|
||||||
```
|
```
|
||||||
|
|
||||||
This clears:
|
This clears:
|
||||||
@@ -349,7 +349,7 @@ Enable detailed logging in `configuration.yaml`:
|
|||||||
logger:
|
logger:
|
||||||
default: info
|
default: info
|
||||||
logs:
|
logs:
|
||||||
custom_components.spotify_search: debug
|
custom_components.spotify_voice_assistant: debug
|
||||||
```
|
```
|
||||||
|
|
||||||
This shows search queries, match types (exact vs. first result), and any errors.
|
This shows search queries, match types (exact vs. first result), and any errors.
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
"""Spotify Search Integration for Home Assistant."""
|
"""Spotify Voice Assistant Search Integration for Home Assistant."""
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@@ -8,7 +8,7 @@ from homeassistant.helpers.typing import ConfigType
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
DOMAIN = "spotify_search"
|
DOMAIN = "spotify_voice_assistant"
|
||||||
VALID_SEARCH_TYPES = {"artist", "album", "track", "playlist"}
|
VALID_SEARCH_TYPES = {"artist", "album", "track", "playlist"}
|
||||||
|
|
||||||
CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)
|
CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)
|
||||||
@@ -106,7 +106,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
search_type = call.data.get("type", "artist")
|
search_type = call.data.get("type", "artist")
|
||||||
|
|
||||||
if not raw_query:
|
if not raw_query:
|
||||||
_LOGGER.error("No query provided to spotify_search")
|
_LOGGER.error("No query provided to spotify_voice_assistant")
|
||||||
return {"error": "No query provided"}
|
return {"error": "No query provided"}
|
||||||
|
|
||||||
if search_type not in VALID_SEARCH_TYPES:
|
if search_type not in VALID_SEARCH_TYPES:
|
||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"domain": "spotify_search",
|
"domain": "spotify_voice_assistant",
|
||||||
"name": "Spotify Voice Assistant",
|
"name": "Spotify Voice Assistant Search",
|
||||||
"codeowners": ["@cauld"],
|
"codeowners": ["@cauld"],
|
||||||
"config_flow": false,
|
"config_flow": false,
|
||||||
"dependencies": ["spotify"],
|
"dependencies": ["spotify"],
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
# Add to your configuration.yaml
|
# Add to your configuration.yaml
|
||||||
|
|
||||||
# Spotify Voice Assistant Integration
|
# Spotify Voice Assistant Integration
|
||||||
spotify_search:
|
spotify_voice_assistant:
|
||||||
|
|
||||||
# Optional: Enable debug logging as needed
|
# Optional: Enable debug logging as needed
|
||||||
logger:
|
logger:
|
||||||
default: info
|
default: info
|
||||||
logs:
|
logs:
|
||||||
custom_components.spotify_search: debug
|
custom_components.spotify_voice_assistant: debug
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
function:
|
function:
|
||||||
type: script
|
type: script
|
||||||
sequence:
|
sequence:
|
||||||
- service: spotify_search.search
|
- service: spotify_voice_assistant.search
|
||||||
response_variable: _function_result
|
response_variable: _function_result
|
||||||
data:
|
data:
|
||||||
query: "{{ query }}"
|
query: "{{ query }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user