Skip to content

Commit 26e165d

Browse files
authored
Merge pull request #71 from droans/next
2025.12 Fix: `device_id` removed from `homeassistant.helpers.template`
2 parents 42f2b5c + ab26245 commit 26e165d

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

custom_components/mass_queue/controller.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,6 @@ async def player_queue(
192192
except IndexError:
193193
offset = 0
194194
offset = max(offset, 0)
195-
LOGGER.debug(
196-
f"Returning queue (len {len(queue)}) with offset {offset}, limit {limit}",
197-
)
198195
return queue[offset : offset + limit] if queue else []
199196

200197
async def update_queue_items(self, queue_id: str):
@@ -216,11 +213,19 @@ async def get_queue(
216213
except IndexError:
217214
offset = 0
218215
offset = max(offset, 0)
219-
return await self._client.player_queues.get_queue_items(
220-
queue_id=queue_id,
221-
limit=limit,
222-
offset=offset,
223-
)
216+
# HA 2025.12 Fix: `get_player_queue_items` replaced with `get_queue_items`
217+
try:
218+
return await self._client.player_queues.get_queue_items(
219+
queue_id=queue_id,
220+
limit=limit,
221+
offset=offset,
222+
)
223+
except AttributeError:
224+
return await self._client.player_queues.get_player_queue_items(
225+
queue_id=queue_id,
226+
limit=limit,
227+
offset=offset,
228+
)
224229

225230
async def get_active_queue(self, queue_id: str):
226231
"""Get the active queue for a single queue."""

custom_components/mass_queue/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from homeassistant.helpers import aiohttp_client
1313
from homeassistant.helpers import device_registry as dr
1414
from homeassistant.helpers import entity_registry as er
15-
from homeassistant.helpers.template import device_id
1615

1716
if TYPE_CHECKING:
1817
from homeassistant.core import HomeAssistant
@@ -299,9 +298,10 @@ def get_entity_info(hass: HomeAssistant, entity_id: str):
299298
"""Gets the server and client info for a given player."""
300299
client = get_mass_client(hass, entity_id)
301300
state = hass.states.get(entity_id)
302-
registry = dr.async_get(hass)
303-
dev_id = device_id(hass, entity_id)
304-
dev = registry.async_get(dev_id)
301+
device_registry = dr.async_get(hass)
302+
entity_registry = er.async_get(hass)
303+
dev_id = entity_registry.async_get(entity_id).device_id
304+
dev = device_registry.async_get(dev_id)
305305
identifiers = dev.identifiers
306306

307307
player_id = [_id[1] for _id in identifiers if _id[0] == "music_assistant"][0]

0 commit comments

Comments
 (0)