[Integration] Android TV live cam video streams in a Picture in Picture triggered by motion detection. AKA video-doorbell

What happens if you paste this url in a regular browser. I imagine it won’t work. How do you fill the variable?

It works fine both internal and external to my network.

https://xxxxxxxxx/webrtc/embed?url=8653384037128690460903504234864334989821
Loads the video feed instantly (as MSE).

Executed: 18 September 2023 at 18:48:15
Result:

params:
  domain: rest_command
  service: pipup_url_on_tv
  service_data:
    title: Door
    message: Someone is at the front door
    width: 640
    height: 480
    url: >-
      https://xxxxxxxxx/webrtc/embed?url=8653384037128690460903504234864334989821
    duration: 30
  target: {}
running_script: false

I’ve installed the go2rtc docker from alexxit/go2rtc and the WebRTC Camera plugin to HA.

go2rtc automatically picked up my cameras when the plugin connected:

I’ve tried using the front_door entity as well as the rtsp feeds (via “url:” in the webrtc.create_link section)

Weird. I’m just using a static url. Which works for me. Can’t test for you unfortunately since I’m on holiday for another two weeks. Hopefully you get it sorted

Yea, makes no sense - I can’t see anything wrong. I’ll try a static external link and see if that works.

Are HA and android tv on the same subnet? Have you tried a youtube link instead of your internal one? Just so rule things out.

Got everything working (almost). One question:

When PipUp renders on the Nvidia shield and the WebRTC stream starts it pauses any other content currently playing. Anyway to solve this?

(Using UniFi G4 Instant camera)

It’s the same for me. Have you got a solution? Thanks

If you don’t pass through Audio it shouldn’t pause the video

So something like this:
http://ip:port/webrtc.html?src=unify_camera&media=video

Instead of this:
http://ip:port/webrtc.html?src=unify_camera&media=video-audio

1 Like

Do you mean in my Go2rtc config or in the scripts.yaml? Thanks!

You sir… are a legend… :slight_smile:

Thank you for your comment. This helped me to finally understand my problem to get a working link from the rtc service.
Before i got constantly ERR_CONNECTION_REFUSED and nothing worked.

In the script.yaml my last line now looks like

 url: http://192.168.1.5:8123/webrtc/embed?url={{ link_id }}

which really needed the port of my HASS instance here to work.
Maybe it also helps someone else :slight_smile: Used the APK from DesertBlade.
Thank you all for sharing here! Very much appreciated.

I got this working recently as well! I took a LOT of inspiration from Sean’s guide, but made a more “step-by-step guide”. I use Windows instead of Linux, and had to use an alternative APK that allowed for not https:// links.

This means, no port forwarding was necessary.

Hopefully it helps a few of you do the same, because this is one of my favorite setups to date: Display Picture-in-Picture Live Camera Feeds on Nvidea Shield using Home Assistant - Smart Home Sysadmin

1 Like

I’m having trouble setting up a second shield.
What would be the correct way to have two up and running?

First one worked fine, so I set up the second and got the second running. But this also caused a conflict somewhere with the first
Even if I remove the second shield from the rest_command.yaml I can’t push to the first on port 7979 anymore.

When I try through CMD I get
curl: (7) Failed to connect to xxx.xxx.x.xx port 7979 after 2038 ms: Couldn't connect to server

pipup_url_on_tv:
  # Use with Webrtc camera as described here:
  # https://github.com/AlexxIT/WebRTC/wiki/Cast-or-share-camera-stream#html-page
  url: http://xxxxxx:7979/notify
  content_type: 'application/json'
  verify_ssl: false
  method: 'post'
  timeout: 20
  payload: >
    {
      "duration": {{ duration | default(20) }},
      "position": {{ position | default(0) }},
      "title": "{{ title | default('') }}",
      "titleColor": "{{ titleColor | default('#50BFF2') }}",
      "titleSize": {{ titleSize | default(10) }},
      "message": "{{ message }}",
      "messageColor": "{{ messageColor | default('#fbf5f5') }}",
      "messageSize": {{ messageSize | default(14) }},
      "backgroundColor": "{{ backgroundColor | default('#0f0e0e') }}",
      "media": { 
        "web": {
          "uri": "{{ url }}", 
          "width": {{ width | default(640) }},
          "height": {{ height | default(480) }}
        }
      }
    }
pipup_url_on_tv2:
  # Use with Webrtc camera as described here:
  # https://github.com/AlexxIT/WebRTC/wiki/Cast-or-share-camera-stream#html-page
  url: http://xxxxxxxxx:7979/notify
  content_type: 'application/json'
  verify_ssl: false
  method: 'post'
  timeout: 20
  payload: >
    {
      "duration": {{ duration | default(20) }},
      "position": {{ position | default(0) }},
      "title": "{{ title | default('') }}",
      "titleColor": "{{ titleColor | default('#50BFF2') }}",
      "titleSize": {{ titleSize | default(10) }},
      "message": "{{ message }}",
      "messageColor": "{{ messageColor | default('#fbf5f5') }}",
      "messageSize": {{ messageSize | default(14) }},
      "backgroundColor": "{{ backgroundColor | default('#0f0e0e') }}",
      "media": { 
        "web": {
          "uri": "{{ url }}", 
          "width": {{ width | default(640) }},
          "height": {{ height | default(480) }}
        }
      }
    }

Oh my! This works great. I’m using an AT&T/DirecTV Gemini (Osprey) streaming box which, BTW, does not work with Notifications for Android TV. Thank you. :grin:

Excellent work mate. I was really reluctant to expose the stream outside and setup SSL/TLS. Nevertheless, credits to everyone’s efforts here.