Skip to content

Commit 3de4f99

Browse files
authored
Merge pull request #83 from droans/next
Fix: Use Unique ID instead of URL to connect to Music Assistant
2 parents ba63966 + 27794d9 commit 3de4f99

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

custom_components/mass_queue/utils.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def _get_config_entry(
4141
def get_mass_queue_entry(hass, entity_id):
4242
"""Gets the actions for the selected entity."""
4343
mass_entry = get_mass_entry(hass, entity_id)
44-
mass = mass_entry.runtime_data.mass.connection.ws_server_url
45-
return find_mass_queue_entry(hass, mass)
44+
unique_id = mass_entry.unique_id
45+
return find_mass_queue_entry_from_unique_id(hass, unique_id)
4646

4747

4848
def get_entity_actions_controller(hass, entity_id):
@@ -69,14 +69,13 @@ def _get_mass_entity_config_entry_id(hass, entity_id):
6969
return registry.async_get(entity_id).config_entry_id
7070

7171

72-
def find_mass_queue_entry(hass, mass_url):
72+
def find_mass_queue_entry_from_unique_id(hass: HomeAssistant, unique_id: str):
7373
"""Finds the mass_queue entry for the given MA URL."""
7474
entries = _get_mass_queue_entries(hass)
7575
for entry in entries:
76-
entry_url = entry.runtime_data.mass.connection.ws_server_url
77-
if entry_url == mass_url:
76+
if entry.unique_id == unique_id:
7877
return entry
79-
msg = f"Cannot find entry for Music Assistant at {mass_url}"
78+
msg = f"Cannot find entry for Music Assistant with unique ID {unique_id}"
8079
raise ServiceValidationError(msg)
8180

8281

0 commit comments

Comments
 (0)