Unifi Protect camera: failing to get Media Player working

Dear community,

So the Unifi Protect integration adds a Media Player entity for each camera, but I’ve been completely unable the get any sounds out of them (TTS, wav file, Music Assistant, …).

My cameras are AI Pro, some with Vision Enhancer. Speakers works fine when sending audio through mic.

Does anyone have this working and can share tips? Thanks!!

Logs?

There’s nothing showing in my logs (core or audio logs)… speaker just stays silent. Would you have any other troubleshooting tips?

Thanks!

Not sure how you are trying to do it but this works for me to play an mp3 when the G4 doorbell is pushed

alias: Notify if Front Doorbell pushed Halloween
description: ""
triggers:
  - entity_id:
      - binary_sensor.doorbell_doorbell
    from: "off"
    to: "on"
    trigger: state
conditions: []
actions:
  - action: media_player.play_media
    data:
      media_content_type: music
      media_content_id: http://192.168.1.40:8123/local/sounds/halloween_doorbell_sound2.mp3
    target:
      entity_id:
        - media_player.doorbell_speaker

and this script for TTS

sequence:
  - data:
      entity_id: media_player.doorbell_speaker
      message: Hello
    action: tts.cloud_say
alias: Doorbell Say Hello
mode: single
1 Like

Thanks; I’ve tried wrapping it into an automation, with this action:

action: media_player.play_media
metadata:
  title: 9000g.wav
  thumbnail: null
  media_class: music
  children_media_class: null
  navigateIds:
    - {}
    - media_content_type: app
      media_content_id: media-source://media_source
data:
  media_content_id: media-source://media_source/local/9000g.wav
  media_content_type: audio/x-wav
target:
  entity_id: media_player.ai_pro_speaker

but to no avail… silence throughout :frowning:

The automation will have trace data after it has been triggered. That may give some clues.

Here is my log. Fails with ai pro, works with g5 dome…

Blockquote
Logger: homeassistant.components.websocket_api.http.connection
Source: components/unifiprotect/media_player.py:137
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 22:40:44 (5 occurrences)
Last logged: 22:46:49

[140298676725232] Error handling message: Unknown error (unknown_error) Roberto from 192.168.0.9 (Mozilla/5.0 (Linux; Android 14; SM-S916B Build/UP1A.231005.007; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/135.0.7049.37 Mobile Safari/537.36 Home Assistant/2025.1.2-14946 (Android 14; SM-S916B))
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py”, line 28, in _handle_async_response
await func(hass, connection, msg)
File “/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py”, line 816, in handle_execute_script
script_result = await script_obj.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
msg.get(“variables”), context=context
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 1827, in async_run
return await asyncio.shield(create_eager_task(run.async_run()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 460, in async_run
await self._async_step(log_exceptions=False)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 526, in _async_step
self._handle_exception(
~~~~~~~~~~~~~~~~~~~~~~^
ex, continue_on_error, self._log_exceptions or log_exceptions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 556, in _handle_exception
raise exception
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 524, in _async_step
await getattr(self, handler)()
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 1008, in _async_step_call_service
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
…<9 lines>…
)
^
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 624, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/core.py”, line 2794, in async_call
response_data = await coro
^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/core.py”, line 2837, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 1007, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
hass, entity, func, data, call.context
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 1079, in _handle_entity_call
result = await task
^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/tts/entity.py”, line 129, in async_speak
await self.hass.services.async_call(
…<17 lines>…
)
File “/usr/src/homeassistant/homeassistant/core.py”, line 2794, in async_call
response_data = await coro
^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/core.py”, line 2837, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 1007, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
hass, entity, func, data, call.context
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 1079, in _handle_entity_call
result = await task
^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/unifiprotect/media_player.py”, line 137, in async_play_media
await self.device.wait_until_audio_completes()
File “/usr/local/lib/python3.13/site-packages/uiprotect/data/devices.py”, line 2575, in wait_until_audio_completes
raise StreamError(“Error while playing audio (ffmpeg): \n” + error)
uiprotect.exceptions.StreamError: Error while playing audio (ffmpeg):
Input #0, mp3, from ‘http://192.168.0.238:8123/api/tts_proxy/Uh57qTkd8JTa3m0KL-3j7A.mp3’:
Duration: N/A, start: 0.000000, bitrate: 64 kb/s
Stream #0:0: Audio: mp3, 24000 Hz, mono, fltp, 64 kb/s
Stream mapping:
Stream #0:0#0:0 (mp3 (mp3float) → opus (native))
Press [q] to stop, [?] for help
[opus @ 0x7fe618fd1000] The encoder ‘opus’ is experimental but experimental codecs are not enabled, add ‘-strict -2’ if you want to use it.
[opus @ 0x7fe618fd1000] Alternatively use the non experimental encoder ‘libopus’.
Error while filtering: Experimental feature
[out#0/adts @ 0x7fe618be03c0] Nothing was written into output file, because at least one of its streams received no packets.
size= 0kB time=N/A bitrate=N/A speed=N/A
Conversion failed!

Blockquote

A bit late, but it helps to tell us which camera model you have. If it’s the g5 dome the fix is simple. Via the ui console unadopt the camera then refresh protect integration in home assistant then adopt the camera back in ui interface.

Had the same issue.