Cast Doorbell video to Google HUB?

Hi All

I know you can cast the HA to the Google Nest Hub
But have anyone found a way to do a automation that cast the video from the Unifi integration to a Nest google hub display?

When I set it up, I just get a player on the Nest hub that cannot start the stream?

- id: '1649063968211'
  alias: Doorbell - Cast video feed to Google Nest Hub
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.doorbell_g4_doorbell
    from: 'off'
    to: 'on'
  condition: []
  action:
  - service: camera.play_stream
    data:
      media_player: media_player.kitchen_googlecast_nest_hub_max
      format: hls
    target:
      device_id: 794841cfcda92c71660e068a2431d86f
  mode: single
1 Like

I’m casting a UVC-G4-BULLET camera feed to two Nest displays (one 10’’, one 7’’) using this service call (from HA Container v2022.3.8 and Unifi Protect v1.21.4)

            - service: camera.play_stream
              data:
                entity_id: camera.doorbell
                media_player:
                  - media_player.bedroom_display
                  - media_player.kitchen_display

However, please note that there is an orientation issue on the Hubs with high-resolution feeds, per Camera Stream to Google Hub has wrong orentation · Issue #36290 · home-assistant/core · GitHub.
To workaround this, my ‘camera.doorbell’ entity is actually the Medium Secure feed from the Unifi Protect integration - the High Secure feed is rotated on the hubs.

Thanks!

How can I select the medium quality stream from the Unifi camera in the Home assistant?

I tried your automation and I dont get any media player on my Nest HUB
But after defining the format as “hls” it does open a media player but shows nothing?

Have you enabled this, to get less delay?:

By enabling the relevant entity within the integration accessed through the front end via Configuration > Devices and Services.

I have streams enabled in my configuration

Hi TazUk

Thanks…

I ended up creating a camera defined by the rstp stream (It seems faster)

camera:
  - platform: ffmpeg
    name: Doorbell_720p
    input: rtsp://192.168.0.67:7447/pyVkmtAfwwwD1gg

And automation

  alias: Doorbell - Cast video feed to Google Nest Hub
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.doorbell_g4_doorbell
    from: 'off'
    to: 'on'
  condition: []
  action:
  - service: camera.play_stream
    data:
      format: hls
      media_player: media_player.kitchen_googlecast_nest_hub_max
    target:
      entity_id: camera.doorbell_720p
  mode: single

This actually works pretty fast!
The sound is pretty loud, have you found a way to disable sound and only cast the picture?

Also @TazUk do you run any automation to stop the stream? (I just noticed it doesn’t stop! :slight_smile: )
This is so cool person detection could be the trigger to cast video from any camera!

That can be done by calling media_stop after a suitable interval - I use a 30 seconds delay.

It’s probably easiest to post my full automation - handles display on up to two hubs, mobile app notification with image and resuming existing media playback on the hubs.

I drop the volume level down to 25% but don’t bother to revert it after the stream finishes - I’m not sure if that’s possible tbh but I’ve seen discussions in the community about reading volume levels).

Note that my doorbell is a frankenstein model - cheap wireless doorbell linked via z-wave; the associated zwave sensors prevents multiple presses triggering multiple runs of the automation. You may need to throttle that differently depending on how the G4 doorbell integrates.

# when the doorbell binary sensor reacts to the input_boolean
# decide whether to send a notification and take a photo based on conditions.
# restrict to runs 20 seconds apart.
- id: doorbell_pushed
  alias: "Doorbell Pushed"
  mode: single
  max_exceeded: silent
  trigger:
    platform: state
    entity_id: binary_sensor.doorbell_sensor
    from: "off"
    to: "on"
  condition:
    - condition: and
      conditions:
        - condition: state
          entity_id: 
           - input_boolean.holiday_mode
           - input_boolean.notify_via_sms
          state: "off"
        - condition: template
          value_template: "{{ (now() - (state_attr('automation.doorbell_pushed', 'last_triggered'))).seconds >= 20 }}"
  action:
    - variables: 
        bed_play: "{{ is_state('media_player.bedroom_display', 'playing') }}"
        kit_play: "{{ is_state('media_player.kitchen_display', 'playing') }}"
    # always record the push
    - service: input_datetime.set_datetime
      data:
        entity_id: input_datetime.last_doorbell
        time: "{{ now().time().strftime('%H:%M:%S') }}"
        date: "{{ now().date().strftime('%Y-%m-%d') }}"
    # push to mobile if not on holiday and sms notifications are off.
    - choose:
        - conditions:
            - condition: state
              entity_id:
                - input_boolean.holiday_mode
                - input_boolean.notify_via_sms
              state: "off"
          sequence: 
            - service: notify.all_mobile
              data:
                title: "Doorbell Alert"
                message: "The doorbell was rung at {{ now().strftime('%H:%M') }}."
                data:
                  image: "/api/camera_proxy/camera.driveway"
                  clickAction: "/lovelace/camera_driveway"
                  ttl: 0
                  priority: high
                  channel: Doorbell
                  group: Driveway
    - choose:
        # stream to kitchen display and announce on mini upstairs if home, awake and suitable hours
        - conditions:
            - condition: and 
              conditions:
                - condition: state
                  entity_id: input_boolean.house_asleep
                  state: "off"
                - condition: state 
                  entity_id: group.family
                  state: "home"
                - condition: time
                  after: "08:00"
                  before: "21:00"
          sequence: 
            # handle resuming media_players based on states using scenes
            - choose:
                # bedroom display scene create
                - conditions:
                    - condition: template
                      value_template: "{{ (bed_play == true) }}"
                  sequence:
                    - service: scene.create
                      data:
                        scene_id: scene_bedroom_display_resume
                        snapshot_entities:
                          media_player.bedroom_display
            - choose:
                # kitchen display scene create
                - conditions:
                    - condition: template
                      value_template: "{{ (kit_play == true) }}"
                  sequence:
                    - service: scene.create
                      data:
                        scene_id: scene_kitchen_display_resume
                        snapshot_entities:
                          media_player.kitchen_display
            # common media player actions
            - service: camera.play_stream
              data:
                entity_id: camera.doorbell
                media_player:
                  - media_player.bedroom_display
                  - media_player.kitchen_display
            - delay: "00:00:30"
            - service: media_player.media_stop
              data: 
                entity_id: 
                  - media_player.bedroom_display
                  - media_player.kitchen_display
            - choose:
                # bedroom display resume
                - conditions:
                    - condition: template
                      value_template: "{{ (bed_play == true) }}"
                  sequence:
                    - service: scene.turn_on
                      data:
                        entity_id: scene_bedroom_display_resume
              default:
                - service: media_player.turn_off
                  data:
                    entity_id: media_player.bedroom_display
            - choose:
                # kitchen display resume
                - conditions:
                    - condition: template
                      value_template: "{{ (kit_play == true) }}"
                  sequence:
                    - service: scene.turn_on
                      data:
                        entity_id: scene_kitchen_display_resume
              default:
                - service: media_player.turn_off
                  data:
                    entity_id: media_player.kitchen_display
        # announce on display upstairs if home and asleep
        - conditions:
            - condition: and
              conditions:
                - condition: state
                  entity_id: input_boolean.house_asleep
                  state: "on"
                - condition: state
                  entity_id: group.family
                  state: "home"
          sequence:
            - choose:
                # bedroom display scene
                - conditions:
                    - condition: template
                      value_template: "{{ (bed_play == true) }}"
                  sequence:
                    - service: scene.create
                      data:
                        scene_id: scene_bedroom_display_resume
                        snapshot_entities:
                          media_player.bedroom_display
            # common media player actions
            - service: media_player.volume_set
              data:
                entity_id: media_player.bedroom_display
                volume_level: 0.25
            - service: camera.play_stream
              data:
                entity_id: camera.doorbell
                media_player: media_player.bedroom_display
            - delay: "00:00:30"
            - service: media_player.media_stop
              data:
                entity_id: media_player.bedroom_display
            - choose:
                # bedroom display resume
                - conditions:
                    - condition: template
                      value_template: "{{ (bed_play == true) }}"
                  sequence:
                    - service: scene.turn_on
                      data:
                        entity_id: scene_bedroom_display_resume
              default:
                - service: media_player.turn_off
                  data:
                    entity_id: media_player.bedroom_display
1 Like

Thanks! (Seems like this is quiet a big automation!)

I can see that you write them manually, I did that before but now I try to use the UI - my hope is that updates dosen’t break them as easily
media_player.media_stop - didn’t really work but
media_player.turn_off

And I also found that
media_player.volume_mute

Did the trick - here you can set unmute also afterwards

worked :slight_smile:

This is so weird after a reboot I now have all cast devices as Unavailable?

So far I have not been able to get the service up again?
Any idea on what could be causing this?
I have disabled all my new automations but no matter what the cast stays unavailable?

Finally it works and then it dosent :frowning:

It’s very difficult to say without knowing anything about:

  • network architecture
  • HA install type
  • Google Cast integration configuration (manual, automatic discovery, DHCP / static IPs assigned to cast devices, etc)
  • whether the HA logs show any errors
  • what you’ve specifically tried to get the service running (apart from disabling the new automation(s) and rebooting (or do you mean restarting) HA

Yes I found that after a very long time (I did a backup) the cast devices worked again!
So for some reason after a reboot it takes a very long time for them to be found again

I have static IP’s for everything helps when doing automations :slight_smile:
But I have not created a Manuel mapping for cast devices in the yaml file, not even sure its possible LOL

I still think that it loads the camera cast to the HUB very slow, I can run from the door and see myself ringing the doorbell 20 sec after it happened?

I am now trying the:

stream:
  ll_hls: true
  part_duration: 0.75
  segment_duration: 6

And I have enabled “preload stream” but then you get picture at once! But its a stream before me ringing the doorbell and then you wait for the stream to catch up to “real time”
I jave a clock on the video feed and its 15s + 2 for loading so 17s delay

Is your experience the same?

I use reserved IPS for the hubs (and any non-portable network device) and don’t use automatic discovery.
My G4 streams are around 7 to 10 seconds behind on the live views in the HA dashboard and probably 2 to 3 seconds slower on the hubs.

Would like to use this , but its some years old. Are there some better ways to use this function: when pressed open video on home hub
Also because of the delay between pressing and showing the stream

I’m trying to stream my Eufy doorbell to my Nest Hub gen2 but it doesn’t really work.

I managed to do this via a nice explanation here via Browser Mod on my laptop and phone but I can’t use this on the Nest Hub because it can’t be provided with the HA software.

I can set up the Stream camera option but it’s not supported by Eufy.

If anyone has a good option to stream my doorbell camera to my Nest Hub then I’m very curious about it.

Thanks in advance.