WebRTC icon indicating copy to clipboard operation
WebRTC copied to clipboard

Reolink Doorbell with two-way audio?! (no issue, just info request)

Open pickonedev opened this issue 9 months ago • 15 comments

Hi!

Anyone have manage to achieve the two-way audio with a reolink doorbell without problems? If yes, can you please share the code of the card.

Thank you!

pickonedev avatar Oct 15 '23 18:10 pickonedev

I would also be very interested... I tried several configs and didn't get it to work. On top I don't have any sound now from the stream -.- using this atm:

type: custom:webrtc-camera
ui: true
streams:
  - url: rtsp://USER:PW@IP:554/h264Preview_01_sub
    name: 😶
    background: false
    muted: false
    mic: false
    mode: webrtc
  - url: rtsp://USER:PW@IP:554/h264Preview_01_sub
    name: 🎙️
    background: false
    muted: false
    mic: true
    ### media: video,audio,microphone ### or do i need this line?
    mode: webrtc

can-I-do avatar Oct 17 '23 07:10 can-I-do

Yeah, i guess i got it.

type: custom:webrtc-camera
server: https://go2rtc.example.com/
streams:
  - url: reolink
    mode: webrtc
    media: video,audio
    name: 🔇
  - url: reolink
    mode: webrtc
    media: video,audio,microphone
    name: 🔈
ui: true
muted: false

go2rtc:

streams:
  reolink:
    - rtsp://admin:[email protected]:554/Preview_01_sub
    - "ffmpeg:reolink#audio=opus#audio=volume#async"

ffmpeg:
  bin: ffmpeg
  volume: "-af \"volume=25dB\""

reverse proxy (ofc don't forget the dns entry):

server {
    server_name go2rtc.example.com;

    listen 80;

    if ($scheme = http) {
        return 301 https://$server_name$request_uri;
    }

    ssl_session_timeout 1d;
    ssl_session_cache shared:MozSSL:10m;
    ssl_session_tickets off;
    ssl_certificate /ssl/fullchain.pem;
    ssl_certificate_key /ssl/privkey.pem;

    ssl_dhparam /data/dhparams.pem;

    listen 443 ssl http2;
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

    proxy_buffering off;

    location / {
        proxy_pass http://homeassistant.local:1984;
        proxy_set_header Host $host;
        proxy_redirect http:// https://;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
    }
}

daxcore avatar Oct 17 '23 19:10 daxcore

@daxcore Hi! Can you please explain what you wrote there, like you would explain it to a noob? :-D I only understand the first code which represents a webrtc-camera card, but what about the next two codes? What are, how, where? :-)

Thank you in advance!

pickonedev avatar Oct 17 '23 20:10 pickonedev

If everything else works for you you just need the first part:

type: custom:webrtc-camera
server: https://go2rtc.example.com/
streams:
  - url: reolink
    mode: webrtc
    media: video,audio
    name: 🔇
  - url: reolink
    mode: webrtc
    media: video,audio,microphone
    name: 🔈
ui: true
muted: false

This part should somehow similar already be in your go2rtc.yaml, but not needed if you add the url directly into the card, like I did in my previous post:

streams:
  reolink:
    - rtsp://admin:[email protected]:554/Preview_01_sub
    - "ffmpeg:reolink#audio=opus#audio=volume#async"

ffmpeg:
  bin: ffmpeg
  volume: "-af \"volume=25dB\""

So the trick seems to be this line media: video,audio,microphone, no need for mic: true. The mic is working, evertheless it seems that I don't have any sound coming back -.-

can-I-do avatar Oct 18 '23 09:10 can-I-do

Thank you, I will try it today <3

pickonedev avatar Oct 18 '23 09:10 pickonedev

Still... I am asking myself... for this Two-Way thing, why you need two streams? Ok, ok, I understand that one is with microphone and the other is not, but would not be easier if you use only one stream, but you have a button to turn on/off the microphone? Like the speaker... click Mute/click UnMute, could not this microphone have a similar usability?

@AlexxIT ? Is this not possible? Sorry if maybe I transform a "question" post into a "feature request", first I just ask to know more.

Thanks

Edit: Two streams are slower to load, this is why I ask... When you click to unmute the mic, the stream should load again and so on...

Edit2: @can-I-do wow, seems that there is no sound for me as well :)) More than that, the stream it is loading as paused, I need to press play to start, but it won't do nothing, the streams shows a static image from the last frame, but that's it...

pickonedev avatar Oct 18 '23 09:10 pickonedev

Two separate streams is good design because you take and release mic not only on browser, but also on camera

AlexxIT avatar Oct 18 '23 10:10 AlexxIT

lets have a look to the readme.md file:

Two-way audio

  • Only for supported sources in go2rtc
  • Only for Hass with HTTPS access, this limitation is from the browsers
  • Only for WebRTC mode
  • HTTPS is also important for Hass Mobile App!

You should add microphone to media param. You can use two streams: one with mic, second without:

type: 'custom:webrtc-camera'
streams:
  - url: go2rtc_stream
  - url: go2rtc_stream
    mode: webrtc
    media: video,audio,microphone

for 2-way audio, https is the key. that's why, i posted my nginx reverse proxy configuration. i guess, if the server: https://go2rtc.example.com/ in your card code will not refer to https url, it will not work!

daxcore avatar Oct 18 '23 10:10 daxcore

This is what I try to use in my card

type: custom:webrtc-camera
ui: true
muted: false
streams:
  - url: rtsp://admin:[email protected]:554/h264Preview_01_sub
    mode: webrtc
    media: video,audio
    name: 🔇
  - url: rtsp://admin:[email protected]:554/h264Preview_01_sub
    mode: webrtc
    media: video,audio,microphone
    name: 🔈

HA it is configured to use HTTPS only from outside, when I access it from local, it is only with HTTP. I don't need the server line because I am using it from HA.

I use "NGINX Home Assistant SSL proxy" but no special config...

pickonedev avatar Oct 18 '23 12:10 pickonedev

after I added this stuff after and before "-->" to my go2rtc.yaml sound seems to work now. Not actually sure if this is related or an accident :D

streams:
  reolink:
    - rtsp://admin:[email protected]:554/Preview_01_sub
    - "ffmpeg:reolink#audio=opus. --> #audio=volume#async" 

ffmpeg:
  bin: ffmpeg
  volume: "-af \"volume=25dB\""
<-- 

can-I-do avatar Oct 18 '23 13:10 can-I-do

Where can I find this file go2rtc.yaml ? I don't have it in my HA

pickonedev avatar Oct 18 '23 13:10 pickonedev

Where can I find this file go2rtc.yaml ? I don't have it in my HA

should be directly in your config folder, there is also your configuration.yaml and automations.yaml.

can-I-do avatar Oct 19 '23 11:10 can-I-do

I search but nothing... There is no file like this

pickonedev avatar Oct 19 '23 15:10 pickonedev

Ok, maybe we missed to ask at the very beginning if you have go2rtc installed in your HomeAssistent. If so, you can also create the file and paste the stuff above

can-I-do avatar Oct 20 '23 06:10 can-I-do

I have just installed the WEBrtc Camera integration from HACS, nothing else. Should I install any ohter addons?

pickonedev avatar Oct 20 '23 09:10 pickonedev