SOLVED: HA automation to show Unifi protect stream on Google Hub

Is there anybody who succeed to show a stream on a Google Nest Hub from a Unifi Protect G4 Pro doorbell?

The automation I have is not able to stream to Google Hub.
The hub does react to the automation but the stream isn’t showed.

Try the webrtc.dash_cast action. The link is to a custom integration but It should be part of HA now that webrtc is baked in.

Thank you for your reply.
After looking into it further I got it fixed.

For others who want this to work:

To stream Unifi G4 Pro doorbell to Google Nest Hub via automation in HA it is necessary to have the following Integrations:
Google Cast
Unifi Network
Unifi Protect
WebRTC Camera

And these add-ons:
DuckDNS
NGinx Proxy manager
Let’s Encrypt

Make sure you created a domain.
Make sure Let’s Encrypt has created the certificates (in /ssl/ directory)

Make sure to have portforward configured (external port to internal port of HA, and also a forward for port 443).

Make sure all integrations and add-ons are running correctly without errors in the logs.

Add the following lines in configuration.yaml:

homeassistant:
  external_url: "https://DOMAIN.duckdns.org:PORT/"
  internal_url: "https://INTERNAL_IP_HA:INTERNAL_PORT_HA"

and:

http:
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem
  use_x_forwarded_for: true
  trusted_proxies:
    - 192.168.0.0/24
  ssl_profile: intermediate

Test if HA is reachable from internal address AND external domain/DNS-address.

If all is setup correctly HA should be reachable on external address.

Make sure the Google Nest Hub is added in HA.
Check if entity “camera.g4_doorbell_pro_high_resolution_channel_insecure” exists (Settings–> Devices & Services → Entities).

Now create the automation:
Below my YAML code config:

alias: On doorbell stream Unifi Protect camera to Google Hub
description: >-
  On doorbell press the stream of the Unifi Protect camera is beingstreamed to the Google Nest Hub and closes the stream after 30 seconds.
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.g4_doorbell_pro_deurbel
    attribute: event_type
    to: ring
actions:
  - action: camera.play_stream
    data:
      format: hls
      media_player: media_player.nesthubNAME
    target:
      entity_id: camera.g4_doorbell_pro_high_resolution_channel_insecure
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - action: media_player.turn_off
    data: {}
    target:
      device_id: ##change to your ID##
    enabled: true
mode: single

Without DuckDNS, Let’s Encrypt and NGinx the stream will not be able to be displayed.

The use of WebRTC and Google Cast is needed because Unifi streams are in RTPS format which can’t be handled by Google Nest Hub.