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
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)
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?
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! )
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
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
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?
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
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?
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
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