dermotduffy / frigate-hass-card

A Lovelace card for Frigate in Home Assistant
MIT License
542 stars 60 forks source link

Cast Delay #1482

Closed Lockie85 closed 1 week ago

Lockie85 commented 3 months ago

Hey,

I'm trying to understand if this is a "how it is", a bug or perhaps an incorrect setup on my part. But when using the Frigate Card and then casting a camera to a device like a Google Display. The difference between the live view on my PC and the Cast view on my Google is about 20 seconds.

I.E. there is a 20 second delay (for me) when casting a camera.

Is this a known issue or is there a known solution to this? Given everything is local I'd have expected delay to be minimal. I've had a quick search but the issues I've seen don't sound quite the same.

Many Thanks

dermotduffy commented 3 months ago

So with the very same card config, when casted it "lags" by 20s vs when uncasted and just viewed on a PC? Cannot say I have ever noticed this, but I also don't use HA casting regularly (the casting itself is not something the card is doing, it's asking HA to cast, so I would imagine casting anything else from HA would likely also show you 20s delay even without the card being involved).

Lockie85 commented 3 months ago

So with the very same card config, when casted it "lags" by 20s vs when uncasted and just viewed on a PC? Cannot say I have ever noticed this, but I also don't use HA casting regularly (the casting itself is not something the card is doing, it's asking HA to cast, so I would imagine casting anything else from HA would likely also show you 20s delay even without the card being involved).

Yes within the same card. I've modified the buttons which display like so: image

Here's the full card code:

type: custom:frigate-card
cameras:
  - camera_entity: camera.view_a
    live_provider: go2rtc
    icon: mdi:baby-face
  - camera_entity: camera.view_b
    live_provider: go2rtc
    icon: mdi:car
  - camera_entity: camera.view_c
    live_provider: go2rtc
    icon: mdi:cat
  - camera_entity: camera.view_d
    live_provider: go2rtc
    icon: mdi:cat
  - camera_entity: camera.view_e
    live_provider: go2rtc
    icon: mdi:chef-hat
  - camera_entity: camera.view_f
    live_provider: go2rtc
    icon: mdi:sofa
  - camera_entity: camera.view_g
    icon: mdi:door
  - camera_entity: camera.view_h
    live_provider: go2rtc
    icon: mdi:cradle
live:
  auto_unmute: all
  auto_play: all
  draggable: false
  lazy_load: true
  controls:
    next_previous:
      style: none
menu:
  style: outside
  buttons:
    frigate:
      enabled: false
    live:
      enabled: true
      icon: mdi:play
    substreams:
      enabled: false
    snapshots:
      enabled: false
    timeline:
      enabled: false
    download:
      enabled: false
    recordings:
      enabled: true
      icon: mdi:record-rec
    clips: {}
view:
  default: live
  camera_select: live
timeline:
  show_recordings: true
dimensions:
  max_height: 90vh

When selecting the cast button and a device the best I can achieve is a min of 10 seconds different from what's on my PC to what's on my display. It's the same when trying to cast from another device like my phone.

dermotduffy commented 2 weeks ago

@felipecrs I think you cast regularly, if I'm right have you experienced this latency?

felipecrs commented 2 weeks ago

It is expected to have ~10 seconds delay with the Home Assistant native casting approach, which is based on TLS.

It is theoretically possible to do casting through WebRTC, but Home Assistant doesn't support it yet.

What you can do however is to use the alternative casting method "dashboard".

https://card.camera/#/examples?id=cast-a-dashboard

I suggest you give it a try.

felipecrs commented 1 week ago

@dermotduffy, a cast profile would be nice to simplify this setup. Things such profile could have:

dermotduffy commented 1 week ago

@felipecrs Something like this perhaps? https://github.com/dermotduffy/frigate-hass-card/pull/1575

(I didn't combine with low-performance to allow people to choose, but since you can apply multiple profiles, that's trivial to include: added to profiles doc)

felipecrs commented 1 week ago

That's exactly what I meant. I'll try it tomorrow too.

Feel free to merge though, any feedback can also be addressed later.

felipecrs commented 1 week ago

@Lockie85, @dermotduffy, casting the standard way is working fine. And such delay is expected.

However, casting a dashboard seems broken indeed: https://github.com/dermotduffy/frigate-hass-card/pull/1575#issuecomment-2368350505

I'd recommend to close this ticket, and track issues related to casting a dashboard in a different one (here or in HA core/frontend, unsure yet).

dermotduffy commented 1 week ago

Closing this bug, we'll track the separate casting problems with the v6 releases here: https://github.com/dermotduffy/frigate-hass-card/issues/1578