Custom Component: Unifi Protect

Thanks to @briis and everyone else who contributed to this project! Been using it since it was a custom component, and finally got a G4 doorbell (happened to see it in stock for a few hours earlier this week).

Has anyone figured out how to cast a lovelace view to a Google Cast device with the doorbell feed in the view?

I’m replacing a Nest doorbell, which had a nice feature of displaying the camera feed on my Google Hub along with some buttons for canned responses like “No one is able to come to the door right now”. I found that very useful when I’m in a meeting for work and the neighborhood kids come by ringing the doorbell multiple times looking for my kids :slight_smile: I’d like to do that with the UniFi doorbell and HA.

I can get the camera feed to display on my Google Cast devices just fine with the play_media service - something like this:

service: media_player.play_media
target:
  entity_id: media_player.kitchen_display
data:
  media_content_id: media-source://camera/camera.g4_doorbell_high
  media_content_type: image/jpeg
metadata:
  title: Doorbell High
  thumbnail: /api/camera_proxy/camera.g4_doorbell_high
  media_class: video
  children_media_class: null
  navigateIds:
    - {}
    - media_content_type: app
      media_content_id: media-source://camera

but that’s just the camera feed, nothing else.

I made a lovelace dashboard called doorbell-response that has the camera feed and some buttons/toggles/info that would be useful when the doorbell rings.

The camera card in that view is set up like this:

  - type: picture-entity
    show_state: true
    show_name: true
    camera_view: live
    entity: sensor.g4_doorbell_last_motion_detected
    image: https://demo.home-assistant.io/stub_config/bedroom.png
    camera_image: camera.g4_doorbell_high
    name: Last Motion

and the doorbell ring automation calls the cast.show_lovelace_view service like this:

service: cast.show_lovelace_view
data:
  entity_id: media_player.kitchen_display
  dashboard_path: lovelace-main
  view_path: front-doorbell-response

Locally via a web browser on a PC or the iOS app on my phone, the lovelace view displays just fine. However, when it’s cast to a Google Hub, the camera feed doesn’t work - there’s just a stock placeholder image.

I’m guessing it has something to do with the cast service using the external HA URL due to Google’s HTTPS requirements and that perhaps the camera feed isn’t getting sent correctly? I’m using the Nabu Casa setup for HA cloud features, so my external URL is through that service.

Any ideas on how to get the dashboard with a camera feed to work on a Cast device?

1 Like