bushvin / hass-integrations

My custom Home Assistant integrations
Apache License 2.0
64 stars 11 forks source link

'MopidySpeaker' object has no attribute 'media' #57

Closed regan-a closed 1 year ago

regan-a commented 1 year ago

Hello, thanks for putting together this project, it is getting me much closer to my goal of running a multi-room audio system. I just came across this project yesterday and installed the latest and greatest, v.2.2.0.

The problem I'm having is when I call the mopidy.snapshot service, it fails with the following error:

'MopidySpeaker' object has no attribute 'media'

The related configuration in my automation is:

service: mopidy.snapshot
data: {}
target:
  entity_id: media_player.mopidy

And the traceback from home-assistant.log:

2023-11-12 13:48:20.364 ERROR (MainThread) [homeassistant.components.automation.test_music_tts_snapshot] While executing automation automation.test_music_tts_snapshot
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 655, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1578, in async_run
return await asyncio.shield(run.async_run())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 420, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 470, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 493, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 468, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 704, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 666, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2035, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2072, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 830, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call
response_data = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/mopidy/media_player.py", line 311, in service_snapshot
self.speaker.take_snapshot()
File "/config/custom_components/mopidy/speaker.py", line 933, in take_snapshot
"mediaposition": self.media.position,
^^^^^^^^^^
AttributeError: 'MopidySpeaker' object has no attribute 'media'
bushvin commented 1 year ago

Hi, thank you for using my integration. I believe I know what the issue is and I will fix it ASAP.

bushvin commented 1 year ago

I've released v2.2.1 which should fix this issue.

regan-a commented 1 year ago

That did the trick! Thank you!!!

bushvin commented 1 year ago

You are very welcome!

Have a great day!