Open borgqueenx opened 9 months ago
Show how you call service
This is how:
service: media_player.play_media
metadata:
title: wolf-howl.mp3
thumbnail: null
media_class: music
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
- media_content_type: ""
media_content_id: media-source://media_source/local/sounds
data:
media_content_id: media-source://media_source/local/sounds/dog_barking.mp3
media_content_type: audio/mpeg
target:
entity_id:
- media_player.poolpole_cam
- media_player.bedroom_top
- media_player.living_room
Show how you setup media_player. Are you sure it support two way audio and you choose right audio codec?
Show how you setup media_player. Are you sure it support two way audio and you choose right audio codec?
do you have suggestions what codec to use? they are added using frigate, most of them using the tapo protocol. I also notice on all my camera's that the sound crackles/lags the first time playing something after a while. if i then repeat the same command immediately after, it's usually playing fine. perhaps i should first play a empty sound and then play the actual sound, it might improve it. Two-way audio definitely works, i can use home assistant to talk to the tapo cameras.
Here is the YAML to execute playing a sound on a tapo camera:
service: media_player.play_media metadata: title: carlock.mp3 thumbnail: null media_class: music children_media_class: null navigateIds:
- {}
- media_content_type: app media_content_id: media-source://media_source
- media_content_type: "" media_content_id: media-source://media_source/local/sounds data: media_content_id: media-source://media_source/local/sounds/carlock.mp3 media_content_type: audio/mpeg target: entity_id: media_player.house_corner_garden_view
And this is how the cameras are added in frigate:
go2rtc: streams: kitchen-cam:
- tapo://Tomaat66-@192.168.1.182
- ffmpeg:kitchen-cam#audio=aac
(the aac is needed or else recordings will not have sound)
And finally, this is the part from the home assistant configuration.yaml how the media players are added. All tapo camera's are pcma. The camera's all the way below are not tapo cameras but annke cameras.
media_player:
- platform: webrtc
name: living-room
stream: living-room
audio: pcma
- platform: webrtc
name: naelis-place
stream: naelis-place
audio: pcma
- platform: webrtc
name: bedroom-top
stream: bedroom-top
audio: pcma
- platform: webrtc
name: bedroom-floor
stream: bedroom-floor
audio: pcma
- platform: webrtc
name: outdoor-arch
stream: outdoor-arch
audio: pcma
- platform: webrtc
name: kitchen-cam
stream: kitchen-cam
audio: pcma
- platform: webrtc
name: hallway-cam
stream: hallway-cam
audio: pcma
- platform: webrtc
name: billiard-room
stream: billiard-room
audio: pcma
- platform: webrtc
name: house-corner-garden-view
stream: house-corner-garden-view
audio: pcmu/8000
- platform: webrtc
name: poolpole-cam
stream: poolpole-cam
audio: pcmu/8000
- platform: webrtc
name: garage-door
stream: garage-door
audio: pcmu/8000
Tapo cameras uses audio: pcma
This issue still remains. The following works:
service: media_player.play_media
metadata:
title: carlock2.mp3
thumbnail: null
media_class: music
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
- media_content_type: ""
media_content_id: media-source://media_source/local/sounds
data:
media_content_id: media-source://media_source/local/sounds/carlock2.mp3
media_content_type: audio/mpeg
target:
entity_id: media_player.garage_door
And the following does not work. only one camera plays a sound and then i get "unknown error" reported by home assistant.
service: media_player.play_media
metadata:
title: carlock2.mp3
thumbnail: null
media_class: music
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
- media_content_type: ""
media_content_id: media-source://media_source/local/sounds
data:
media_content_id: media-source://media_source/local/sounds/carlock2.mp3
media_content_type: audio/mpeg
target:
entity_id:
- media_player.backyard_tree
- media_player.garage_door
- media_player.kitchen_cam
- media_player.house_corner
- media_player.living_room
- media_player.outdoor_arch
- media_player.poolpole_cam
Note the only difference is multiple targets/media players.
If i make it a single media player, everything plays on every camera, but with delays so that is not optimal..
Well. I don't know what is happening in your case. I have tested similar situation without any problem:
action: media_player.play_media
target:
entity_id:
- media_player.dahua_camera
- media_player.tapo_camera
data:
media_content_id: media-source://media_source/local/pooh.mp3
media_content_type: audio/mpeg
I have around 8 camera's that i use as media_player in configuration.yaml and i can send audio files to all of them. However when i try to send a audio file to 2 media players at the same time, it plays it on just 1 camera and the other is ignored. after waiting a bit i get a "error", without it saying what the error exactly is.
In the home assistant core logs, i find the following that could be related:
If i try to make multiple actions, each with the same sound to just 1 mediaplayer entity, it works, but with delays of course, so its not ideal.