core
core copied to clipboard
Unifi Protect Doorbell TTS Audio
The problem
For some reason, I can't get cloud TTS to work on my G4 Doorbell.
What version of Home Assistant Core has the issue?
core-2025.4.2
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Unifi Protect/Cloud TTS
Link to integration documentation on our website
No response
Diagnostics information
Logger: homeassistant.components.automation.doorbell_ring_notification
Source: components/automation/__init__.py:717
integration: Automation (documentation, issues)
First occurred: 08:54:04 (2 occurrences)
Last logged: 09:23:01
While executing automation automation.doorbell_ring_notification
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 717, in async_trigger
return await self.action_script.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
variables, trigger_context, started_action
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
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 715, in _async_step_choose
await self._async_run_script(script)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 632, in _async_run_script
result = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<6 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/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/components/tts/legacy.py", line 155, in async_say_handle
await 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.115:8123/api/tts_proxy/6EolrCAxtsrHrngwX3NVaw.mp3':
Duration: N/A, start: 0.000000, bitrate: 48 kb/s
Stream #0:0: Audio: mp3, 24000 Hz, mono, fltp, 48 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mp3 (mp3float) -> opus (native))
Press [q] to stop, [?] for help
[opus @ 0x7f55c25d1000] The encoder 'opus' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it.
[opus @ 0x7f55c25d1000] Alternatively use the non experimental encoder 'libopus'.
Error while filtering: Experimental feature
[out#0/adts @ 0x7f55c21e03c0] 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!
Example YAML snippet
alias: Doorbell Ring Notification
description: ""
use_blueprint:
path: fbloemhof/actionable_notifications_for_android_with_cam.yaml
input:
notify_device: notify.mobile_app_alex_phone
trigger_entity: binary_sensor.doorbell_doorbell
doorbell_cam: camera.doorbell_high_resolution_channel
action_1_title: Unlock Door
first_action:
- action: lock.unlock
metadata: {}
data: {}
target:
entity_id: lock.front_door
action_2_title: Notify
second_action:
- action: tts.cloud_say
metadata: {}
data:
entity_id: media_player.doorbell_speaker
message: Please wait, we'll be with you momentarily
Anything in the logs that might be useful for us?
Additional information
No response
Hey there @rahehl, mind taking a look at this issue as it has been labeled with an integration (unifiprotect) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of unifiprotect can trigger bot actions by commenting:
@home-assistant closeCloses the issue.@home-assistant rename Awesome new titleRenames the issue.@home-assistant reopenReopen the issue.@home-assistant unassign unifiprotectRemoves the current integration label and assignees on the issue, add the integration domain after the command.@home-assistant add-label needs-more-informationAdd a label (needs-more-information, problem in dependency, problem in custom component) to the issue.@home-assistant remove-label needs-more-informationRemove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.
(message by CodeOwnersMention)
unifiprotect documentation unifiprotect source (message by IssueLinks)
I'm having the same error when trying to trigger an audio file to play to my doorbell.
[aist#0:0/pcm_s16le @ 0x7f90860480] Guessed Channel Layout: stereo
Input #0, wav, from 'http://192.168.2.25:8123/media/local/STOP%20RIGHT%20THERE%20CRIMINAL%20SCUM.wav?authSig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxY2Y0NTU1ODI0YjA0MTIxODI4MzU3Y2Q3MzhjNDFjOCIsInBhdGgiOiIvbWVkaWEvbG9jYWwvU1RPUCBSSUdIVCBUSEVSRSBDUklNSU5BTCBTQ1VNLndhdiIsInBhcmFtcyI6W10sImlhdCI6MTc0NTk3NzYxMywiZXhwIjoxNzQ2MDY0MDEzfQ.3zvP_OZR6S8D7kEKydUiZehr0wx4n0i5DfPZmajex3g':
Metadata:
encoder : Lavf61.7.100
Duration: 00:00:10.58, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 2 channels, s16, 1536 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le (native) -> opus (native))
Press [q] to stop, [?] for help
[opus @ 0x7f90681000] The encoder 'opus' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it.
[opus @ 0x7f90681000] Alternatively use the non experimental encoder 'libopus'.
Error while filtering: Experimental feature
[out#0/adts @ 0x7f907e0300] 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!
Same error as above where it's trying to use opus to convert the file format, I tried using mp3 and a converted .wav file with the same result.
YAML for automation
alias: Bad fingerprint or nfc
description: ""
triggers:
- trigger: webhook
allowed_methods:
- POST
- PUT
local_only: true
webhook_id: fail_unlock
conditions: []
actions:
- action: media_player.play_media
target:
entity_id: media_player.g4_doorbell_pro_poe_speaker
data:
media_content_id: media-source://media_source/local/STOP RIGHT THERE CRIMINAL SCUM.wav
media_content_type: audio/x-wav
metadata:
title: STOP RIGHT THERE CRIMINAL SCUM.wav
thumbnail: null
media_class: music
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
mode: single
Same issue here. None of my TTS options work on the doorbell pro anymore. They all used to work. All TTS options do still work on my google nest speakers, so it seems like unifi changed something
I'm getting the same error trying to play audio through to the AI Pro camera.
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): [mp3 @ 0x7f85920000] Estimating duration from bitrate, this may be inaccurate Input #0, mp3, from 'http://xxxx:8123/media/local/Hi%20You%20are%20Currently%20Being%20Recorded.mp3?authSig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIxZWQzODA1YWI0YTI0ZDA0YWM3YmI5NmRlMWUxNjQ2OCIsInBhdGgiOiIvbWVkaWEvbG9jYWwvSGkgWW91IGFyZSBDdXJyZW50bHkgQmVpbmcgUmVjb3JkZWQubXAzIiwicGFyYW1zIjpbXSwiaWF0IjoxNzQ2MTMxNzU4LCJleHAiOjE3NDYyMTgxNTh9.TIQ_fhDtgHeDbVT8gJDMKz3yeZJfE_V1v7ki58EliyA': Metadata: date : 2025-04-10 14:40 id3v2_priv.XMP : \x0a<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 9.0-c001 152.deb9585, 2024/02/06-08:36:10 ">\x0a <rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#>\x0a <r Duration: 00:00:03.22, start: 0.000000, bitrate: 152 kb/s Stream #0:0: Audio: mp3, 48000 Hz, stereo, fltp, 128 kb/s Stream mapping: Stream #0:0 -> #0:0 (mp3 (mp3float) -> opus (native)) Press [q] to stop, [?] for help [opus @ 0x7f85791000] The encoder 'opus' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it. [opus @ 0x7f85791000] Alternatively use the non experimental encoder 'libopus'. Error while filtering: Experimental feature [out#0/adts @ 0x7f858f0300] 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!
@RaHehl, have you gotten a chance to take a look at this or perhaps there may have been users that reported this already?
I think this might actually be an upstream problem, I'm not 100% sure how to look if this is a downstream project but here's the issue: https://github.com/uilibs/uiprotect/issues/447
https://github.com/uilibs/uiprotect/blob/main/src/uiprotect/stream.py#L138 looks like a issue at the ffmpeg part or prior, which ffmpeg are u using, and which Homeassistant environment? like HAOS or Docker
https://github.com/uilibs/uiprotect/blob/main/src/uiprotect/stream.py#L138 looks like a issue at the ffmpeg part or prior, which ffmpeg are u using, and which Homeassistant environment? like HAOS or Docker
I'm using HAOS core-2025.4.2, afaik FFMPEG is already installed as part of the OS, but I'm not quite sure which version is included with the latest version.
https://github.com/uilibs/uiprotect/blob/main/src/uiprotect/stream.py#L141
target codec is defined by -acodec {camera.talkback_settings.type_fmt.value}
Please check your bootstrap: https://consoleIP/proxy/protect/api/bootstrap
all my cameras has typeFmt=aac
Known by uiprotect lib is aac vorbis and opus https://github.com/uilibs/uiprotect/blob/3f206973d89cdfb20c865be7e320f2f313153c25/src/uiprotect/data/types.py#L567
selecting opus in ffmpeg is the native experimental encoder "Its quality is usually worse and at best is equal to the libopus encoder." https://ffmpeg.org/ffmpeg-codecs.html#opus which requires to be enabled by https://ffmpeg.org/ffmpeg-formats.html -strict experimental or -strict -2 what's currently not the case in uiprotect lib
the alternative would be mapping it to libopus but for that to work, it has to be included in ffmpeg, which is probably not automatically the case
So the opus options don't sound so great at first
Therefore, I would first like to investigate why I have aac as the talkback codec but you have opus
Can you check this in your bootstrap?
Mine also seems to be set to AAC - so not quite sure why OPUS is being set at all.
The only thing I've done so far is to set the automation as in my first post's YAML snippet, beyond that, no customisations have been set as far as I know.
@modem7 for all cams?
UVC G4 Doorbell Pro
"talkbackSettings": {
"typeFmt": "aac",
"typeIn": "serverudp",
"bindAddr": "0.0.0.0",
"bindPort": 7004,
"filterAddr": "",
"filterPort": 0,
"channels": 1,
"samplingRate": 22050,
"bitsPerSample": 16,
"quality": 100
UVC G5 Turret Ultra 1
"talkbackSettings": {
"typeFmt": "aac",
"typeIn": "serverudp",
"bindAddr": "0.0.0.0",
"bindPort": 7004,
"filterAddr": null,
"filterPort": null,
"channels": 1,
"samplingRate": 22050,
"bitsPerSample": 16,
"quality": 100
UVC G5 Turret Ultra 2
"talkbackSettings": {
"typeFmt": "aac",
"typeIn": "serverudp",
"bindAddr": "0.0.0.0",
"bindPort": 7004,
"filterAddr": null,
"filterPort": null,
"channels": 1,
"samplingRate": 22050,
"bitsPerSample": 16,
"quality": 100
UVC G4 Bullet
"talkbackSettings": {
"typeFmt": "aac",
"typeIn": "serverudp",
"bindAddr": "0.0.0.0",
"bindPort": 7004,
"filterAddr": null,
"filterPort": null,
"channels": 1,
"samplingRate": 22050,
"bitsPerSample": 16,
"quality": 100
can u check what's inside the bootstrap while it fails?
I'm also running HAOS core-2025.4.4. My cameras are also set to AAC:
"talkbackSettings": { "typeFmt": "aac", "typeIn": "serverudp", "bindAddr": "0.0.0.0", "bindPort": 7004, "filterAddr": null, "filterPort": null, "channels": 1, "samplingRate": 22050, "bitsPerSample": 16, "quality": 100 },
I'll try to see what's in the bootstrap after failing....
I ran audio through my AI camera and it failed and I see: "talkbackSettings": { "typeFmt": "opus", "typeIn": "serverudp-rtp", "bindAddr": "0.0.0.0", "bindPort": 7004, "filterAddr": "", "filterPort": 0, "channels": 1, "samplingRate": 24000, "bitsPerSample": 16, "quality": 100 },
Hmm, exciting. A documented API would be cool, of course. So, for some reason, the camera suddenly switches from AAC to Opus, but why? And why don't I get the same effect?
and for the other option it would be good if someone with haos could run ffmpeg -codecs | grep opus in the terminal
especially the encoder part would be exciting e.g.: encoders: opus libopus
A bit more history on my Unifi Protect...About 1 month ago, I had switched to Early Access for my Protect App and UNVR Pro and I noticed that the Early Access broke my streaming so I switch back to "Official" and my streaming audio worked again. Then there was an update to the Official Channel and after an update and now my audio is broken again.
UNVR Pro - 4.2.9 Protect: 5.3.45 AI Pro - 4.75.62
I'm running "Advanced SSH & Web Terminal" with protection mode turned off and I'm not able to find ffmpeg within HAOS. I have looked in /usr/bin/ and /usr/share/ but I can't find it. Still looking...
I finally ran "apk add ffmpeg" within HAOS and now I can run ffmpeg commands.
➜ / ffmpeg -version
ffmpeg version 6.1.2 Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 14.2.0 (Alpine 14.2.0)
configuration: --prefix=/usr --disable-librtmp --disable-lzma --disable-static --disable-stripping --enable-avfilter --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libmp3lame --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librist --enable-libsoxr --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-lto=auto --enable-lv2 --enable-openssl --enable-pic --enable-postproc --enable-pthreads --enable-shared --enable-vaapi --enable-vdpau --enable-version3 --enable-vulkan --optflags=-O3 --enable-libjxl --enable-libsvtav1
libavutil 58. 29.100 / 58. 29.100
libavcodec 60. 31.102 / 60. 31.102
libavformat 60. 16.100 / 60. 16.100
libavdevice 60. 3.100 / 60. 3.100
libavfilter 9. 12.100 / 9. 12.100
libswscale 7. 5.100 / 7. 5.100
libswresample 4. 12.100 / 4. 12.100
libpostproc 57. 3.100 / 57. 3.100
➜ / ffmpeg -codecs | grep opus ffmpeg version 6.1.2 Copyright (c) 2000-2024 the FFmpeg developers built with gcc 14.2.0 (Alpine 14.2.0) configuration: --prefix=/usr --disable-librtmp --disable-lzma --disable-static --disable-stripping --enable-avfilter --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libmp3lame --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librist --enable-libsoxr --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-lto=auto --enable-lv2 --enable-openssl --enable-pic --enable-postproc --enable-pthreads --enable-shared --enable-vaapi --enable-vdpau --enable-version3 --enable-vulkan --optflags=-O3 --enable-libjxl --enable-libsvtav1 libavutil 58. 29.100 / 58. 29.100 libavcodec 60. 31.102 / 60. 31.102 libavformat 60. 16.100 / 60. 16.100 libavdevice 60. 3.100 / 60. 3.100 libavfilter 9. 12.100 / 9. 12.100 libswscale 7. 5.100 / 7. 5.100 libswresample 4. 12.100 / 4. 12.100 libpostproc 57. 3.100 / 57. 3.100 D.VI.S cllc Canopus Lossless Codec D.VIL. hq_hqa Canopus HQ/HQA D.VIL. hqx Canopus HQX DEAIL. opus Opus (Opus Interactive Audio Codec) (decoders: opus libopus) (encoders: opus libopus)
On the trace I still see the following message: The encoder 'opus' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it.
Alternatively use the non experimental encoder 'libopus'.
can u check what's inside the bootstrap while it fails?
Looks like it's exactly the same:
"talkbackSettings": {
"typeFmt": "aac",
"typeIn": "serverudp",
"bindAddr": "0.0.0.0",
"bindPort": 7004,
"filterAddr": "",
"filterPort": 0,
"channels": 1,
"samplingRate": 22050,
"bitsPerSample": 16,
"quality": 100
However - difference now is that it seems to work (maybe since the latest unifi protect update?), but the audio is crackly (which is better than when it was not working at all).
https://www.home-assistant.io/integrations/ffmpeg/ "If you run the Home Assistant Operating System or use the Home Assistant Container, this is already pre-installed for you."
https://www.home-assistant.io/integrations/ffmpeg/ "If you run the Home Assistant Operating System or use the Home Assistant Container, this is already pre-installed for you."
Yep, I understand that but I wasn’t able to run ffmpeg -version, even with protection turned off.
can u check what's inside the bootstrap while it fails?
Looks like it's exactly the same:
"talkbackSettings": { "typeFmt": "aac", "typeIn": "serverudp", "bindAddr": "0.0.0.0", "bindPort": 7004, "filterAddr": "", "filterPort": 0, "channels": 1, "samplingRate": 22050, "bitsPerSample": 16, "quality": 100However - difference now is that it seems to work (maybe since the latest unifi protect update?), but the audio is crackly (which is better than when it was not working at all).
Mine is still the same, despite applying upgrading Unifi Protect. Are you on Early Access or the Official Update channel?
Mine is still the same, despite applying upgrading Unifi Protect. Are you on Early Access or the Official Update channel?
Official channel
UniFi OS 4.2.9 Protect 5.3.45 Camera version 4.75.69
https://www.home-assistant.io/integrations/ffmpeg/ "If you run the Home Assistant Operating System or use the Home Assistant Container, this is already pre-installed for you."
Yep, I understand that but I wasn’t able to run ffmpeg -version, even with protection turned off.
I was also getting the same, not quite sure where FFMPEG is being sourced from.
I tried installing FFMPEG manually via apk add ffmpeg, but it's still quite crackly.
https://github.com/uilibs/uiprotect/pull/469
The patch is included in the HA version that was just released — can you confirm that the issue is now fixed?
I will check in the morning EST when I get home, just applied the update this evening