Czesc!
Mam zainstalowanego HA poprzez Home Assistant OS 7.4. Chodzi on w maszynie wirtualnej na Proxmoxie.
Chcialbym móc odtwarzać pliki mp3 z poziomu serwisu media_player, tak zeby audio szło na port jack 3.5 mm - jak to mogę zrobic?
Poki co probowalem szczęscia z MPD, jak i z VLC. Niestety, dzwięk się nie wydobywa z komputera.
Przy MPD mialem problemy z Access Denied, przy VLC - z ingressowego panelu da się kliknąć Play (bez efektu), a z poziomu service media_player.play_media
, dostaje blad “Failed to call service media_player.play_media.”
Jak przekazać VMce z HassOSem władzę nad kartą dzwiękową na hoście proxmoxowym?
Jak poprawnie skonfigurować lokalny odtwarzacz audio w HA?
Edit:
Poki co, udalo mi sie uzyskać mały sukces:
- podpiąłem dodatkową kartę dzwiękową na USB
- przekazałem tą kartę w Proxmoxie do VMki z HA
- w konfiguracji add-ona VLC wybrałem USB Device jako output
I teraz z ingressowego interfejsu VLC jestem w stanie odtworzyc plik i słychać dzwięk, natomiast jak probuje odpalic tak:
service: media_player.play_media
data:
media_content_id: /media/aaa.mp3
media_content_type: music
target:
entity_id: media_player.vlc_telnet
To dostaje Failed to call service media_player.play_media.
W logach Supervisora widze taki wpis:
Error while setting up vlc platform for media_player
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/vlc/media_player.py", line 56, in setup_platform
[VlcDevice(config.get(CONF_NAME, DEFAULT_NAME), config.get(CONF_ARGUMENTS))]
File "/usr/src/homeassistant/homeassistant/components/vlc/media_player.py", line 65, in __init__
self._instance = vlc.Instance(arguments)
File "/usr/local/lib/python3.9/site-packages/vlc.py", line 1551, in __new__
return libvlc_new(len(args), args)
File "/usr/local/lib/python3.9/site-packages/vlc.py", line 3902, in libvlc_new
_Cfunction('libvlc_new', ((1,), (1,),), class_result(Instance),
File "/usr/local/lib/python3.9/site-packages/vlc.py", line 246, in _Cfunction
raise NameError('no function %r' % (name,))
NameError: no function 'libvlc_new'
W configuration.yaml
mam dodane:
media_player:
- platform: vlc
Co moze byc nie-tak?
Edit:
Spróbowałem szczęścia z tą wersją Mopidy - niestety, jest gorzej: nie dziala ani z poziomu Addona, ani z poziomu HA
Logi z Core:
2022-03-13 19:12:52 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: [50@0] {add} directory or file not found
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 367, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 570, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1636, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1673, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 668, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 949, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 705, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/mpd/media_player.py", line 461, in async_play_media
await self._client.add(media_id)
File "/usr/local/lib/python3.9/site-packages/mpd/asyncio.py", line 277, in __run
await result._feed_from(self)
File "/usr/local/lib/python3.9/site-packages/mpd/asyncio.py", line 44, in _feed_from
line = await mpdclient._read_line()
File "/usr/local/lib/python3.9/site-packages/mpd/asyncio.py", line 351, in _read_line
raise CommandError(error)
mpd.base.CommandError: [50@0] {add} directory or file not found
2022-03-13 19:12:52 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140647222003744] Error handling message: Unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 552, in handle_execute_script
await script_obj.async_run(msg.get("variables"), context=context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1243, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 349, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 367, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 570, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1636, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1673, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 668, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 949, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 705, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/mpd/media_player.py", line 461, in async_play_media
await self._client.add(media_id)
File "/usr/local/lib/python3.9/site-packages/mpd/asyncio.py", line 277, in __run
await result._feed_from(self)
File "/usr/local/lib/python3.9/site-packages/mpd/asyncio.py", line 44, in _feed_from
line = await mpdclient._read_line()
File "/usr/local/lib/python3.9/site-packages/mpd/asyncio.py", line 351, in _read_line
raise CommandError(error)
mpd.base.CommandError: [50@0] {add} directory or file not found
Logi przy probie odpalania z addona:
WARNING 2022-03-13 18:54:20,814 [253:FileBackend-3] mopidy.file.library
Failed looking up file:///media/mopidy/media: gst-resource-error-quark: "/media/mopidy/media" is a directory. (5)
Nie moge tego ogarnąc, że tak trywialna rzecz jest tak niezywkle problematyczna w HA