From 88f2f6ee275cc17b2124cc60a38ad6677e4c044e Mon Sep 17 00:00:00 2001 From: Chad Auld Date: Sat, 22 Nov 2025 11:57:19 -0700 Subject: [PATCH] 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 --- DEVELOPMENT.md | 60 +++++++++---------- README.md | 16 ++--- .../__init__.py | 6 +- .../manifest.json | 4 +- .../services.yaml | 0 examples/configuration.yaml | 4 +- examples/extended_openai_functions.yaml | 2 +- 7 files changed, 46 insertions(+), 46 deletions(-) rename custom_components/{spotify_search => spotify_voice_assistant}/__init__.py (98%) rename custom_components/{spotify_search => spotify_voice_assistant}/manifest.json (80%) rename custom_components/{spotify_search => spotify_voice_assistant}/services.yaml (100%) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 68e5b84..b92beca 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -13,14 +13,14 @@ For Docker-based Home Assistant installations, use a bind mount to link this rep ```bash # Docker run example 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 services: homeassistant: 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:** @@ -38,11 +38,11 @@ If you have direct filesystem access to your Home Assistant config directory: ```bash # 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 -ln -s /path/to/your/spotify-voice-assistant/custom_components/spotify_search \ - /path/to/homeassistant/config/custom_components/spotify_search +ln -s /path/to/your/spotify-voice-assistant/custom_components/spotify_voice_assistant \ + /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). @@ -71,7 +71,7 @@ Understanding when you need to restart Home Assistant vs just reloading the inte ```bash 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 @@ -84,7 +84,7 @@ docker restart homeassistant # Use Developer Tools > YAML > Core Configuration # 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 @@ -122,7 +122,7 @@ docker restart homeassistant **For symlink setup:** ```bash # Remove symlink -rm /path/to/homeassistant/config/custom_components/spotify_search +rm /path/to/homeassistant/config/custom_components/spotify_voice_assistant # Install via HACS # HACS > Integrations > Spotify Voice Assistant > Install @@ -141,11 +141,11 @@ docker restart homeassistant **For symlink setup:** ```bash # 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 -ln -s /path/to/your/spotify-voice-assistant/custom_components/spotify_search \ - /path/to/homeassistant/config/custom_components/spotify_search +ln -s /path/to/your/spotify-voice-assistant/custom_components/spotify_voice_assistant \ + /path/to/homeassistant/config/custom_components/spotify_voice_assistant # Restart Home Assistant ``` @@ -174,7 +174,7 @@ Before each release: ``` spotify-voice-assistant/ ├── custom_components/ -│ └── spotify_search/ +│ └── spotify_voice_assistant/ │ ├── __init__.py # Main integration code │ ├── manifest.json # Version and metadata │ └── services.yaml # Service definitions @@ -195,7 +195,7 @@ In Home Assistant `configuration.yaml`: logger: default: info logs: - custom_components.spotify_search: debug + custom_components.spotify_voice_assistant: debug ``` After adding debug logging, restart Home Assistant to apply. @@ -204,31 +204,31 @@ After adding debug logging, restart Home Assistant to apply. ```bash # 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 -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 # For bind mount: -docker inspect homeassistant | grep spotify_search +docker inspect homeassistant | grep spotify_voice_assistant # 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 -cat custom_components/spotify_search/manifest.json | grep version +cat custom_components/spotify_voice_assistant/manifest.json | grep version # 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 When working correctly, you should see: ``` -INFO Setting up spotify_search -INFO Setup of domain spotify_search took 0.00 seconds +INFO Setting up spotify_voice_assistant +INFO Setup of domain spotify_voice_assistant took 0.00 seconds DEBUG Cache miss, performing Spotify entity lookup DEBUG Found Spotify entity: media_player.spotify_xxx DEBUG Spotify client type: SpotifyClient @@ -246,7 +246,7 @@ DEBUG Using cached Spotify client # <-- Caching is working! Via Developer Tools > Services: ```yaml -service: spotify_search.search +service: spotify_voice_assistant.search data: query: "Coldplay" type: "artist" @@ -264,7 +264,7 @@ Expected response: ### Test Clear Cache Service ```yaml -service: spotify_search.clear_cache +service: spotify_voice_assistant.clear_cache ``` Expected response: @@ -305,7 +305,7 @@ When making improvements: **Example:** ```bash # 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 push @@ -332,17 +332,17 @@ cp /path/to/homeassistant/config/configuration.yaml \ ### Integration Not Loading -**Symptom:** No "Setting up spotify_search" in logs +**Symptom:** No "Setting up spotify_voice_assistant" in logs **Check:** 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 4. Look for Python syntax errors in logs **Docker bind mount check:** ```bash -docker inspect homeassistant | grep -A2 spotify_search +docker inspect homeassistant | grep -A2 spotify_voice_assistant ``` ### Symlink Not Working in Docker @@ -367,13 +367,13 @@ docker inspect homeassistant | grep -A2 spotify_search ```bash # 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 -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 -grep -n "print(" custom_components/spotify_search/*.py +grep -n "print(" custom_components/spotify_voice_assistant/*.py ``` ### Code Standards diff --git a/README.md b/README.md index 76c4c12..a148e73 100644 --- a/README.md +++ b/README.md @@ -92,12 +92,12 @@ Say goodbye to complex configurations. Get voice-controlled music in 3 steps: **Manual Installation:** 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 Add to `configuration.yaml`: ```yaml -spotify_search: +spotify_voice_assistant: ``` ### 3. Configure Extended OpenAI Conversation @@ -242,7 +242,7 @@ The integration leverages Home Assistant's official Spotify integration: ### 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 @@ -267,7 +267,7 @@ The integration supports five search types: Test the search service directly: ```yaml -service: spotify_search.search +service: spotify_voice_assistant.search data: query: "Coldplay" type: "artist" @@ -285,7 +285,7 @@ Response: Test user playlist search: ```yaml -service: spotify_search.search +service: spotify_voice_assistant.search data: query: "workout" type: "user_playlist" @@ -309,7 +309,7 @@ automation: - platform: time at: "07:00:00" action: - - service: spotify_search.search + - service: spotify_voice_assistant.search response_variable: artist_result data: 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: ```yaml -service: spotify_search.clear_cache +service: spotify_voice_assistant.clear_cache ``` This clears: @@ -349,7 +349,7 @@ Enable detailed logging in `configuration.yaml`: logger: default: info 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. diff --git a/custom_components/spotify_search/__init__.py b/custom_components/spotify_voice_assistant/__init__.py similarity index 98% rename from custom_components/spotify_search/__init__.py rename to custom_components/spotify_voice_assistant/__init__.py index bcc3f23..ee854e6 100644 --- a/custom_components/spotify_search/__init__.py +++ b/custom_components/spotify_voice_assistant/__init__.py @@ -1,4 +1,4 @@ -"""Spotify Search Integration for Home Assistant.""" +"""Spotify Voice Assistant Search Integration for Home Assistant.""" import logging import re import voluptuous as vol @@ -8,7 +8,7 @@ from homeassistant.helpers.typing import ConfigType _LOGGER = logging.getLogger(__name__) -DOMAIN = "spotify_search" +DOMAIN = "spotify_voice_assistant" VALID_SEARCH_TYPES = {"artist", "album", "track", "playlist"} 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") 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"} if search_type not in VALID_SEARCH_TYPES: diff --git a/custom_components/spotify_search/manifest.json b/custom_components/spotify_voice_assistant/manifest.json similarity index 80% rename from custom_components/spotify_search/manifest.json rename to custom_components/spotify_voice_assistant/manifest.json index 2660a71..6abc167 100644 --- a/custom_components/spotify_search/manifest.json +++ b/custom_components/spotify_voice_assistant/manifest.json @@ -1,6 +1,6 @@ { - "domain": "spotify_search", - "name": "Spotify Voice Assistant", + "domain": "spotify_voice_assistant", + "name": "Spotify Voice Assistant Search", "codeowners": ["@cauld"], "config_flow": false, "dependencies": ["spotify"], diff --git a/custom_components/spotify_search/services.yaml b/custom_components/spotify_voice_assistant/services.yaml similarity index 100% rename from custom_components/spotify_search/services.yaml rename to custom_components/spotify_voice_assistant/services.yaml diff --git a/examples/configuration.yaml b/examples/configuration.yaml index 70652bf..d5f2efb 100644 --- a/examples/configuration.yaml +++ b/examples/configuration.yaml @@ -2,10 +2,10 @@ # Add to your configuration.yaml # Spotify Voice Assistant Integration -spotify_search: +spotify_voice_assistant: # Optional: Enable debug logging as needed logger: default: info logs: - custom_components.spotify_search: debug + custom_components.spotify_voice_assistant: debug diff --git a/examples/extended_openai_functions.yaml b/examples/extended_openai_functions.yaml index 93c4c68..9569145 100644 --- a/examples/extended_openai_functions.yaml +++ b/examples/extended_openai_functions.yaml @@ -59,7 +59,7 @@ function: type: script sequence: - - service: spotify_search.search + - service: spotify_voice_assistant.search response_variable: _function_result data: query: "{{ query }}"