dermotduffy / frigate-hass-card

A Lovelace card for Frigate in Home Assistant
MIT License
551 stars 58 forks source link

Camera Preview Stops #1630

Closed awptechnologies closed 1 week ago

awptechnologies commented 2 weeks ago

After a few seconds the camera preview stops. If i refresh homeassistant it comes back up and then goes away again. This is only happening with the card. If i go to my frigate instance everything seems to work fine. I would be happy to provide logs and stuff but i have no idea where to get them from.

dermotduffy commented 2 weeks ago

The instructions to provide logs are in the Github issue template:

On the card, hold down the Frigate menu button for a few seconds then paste the diagnostics below:

Would you mind following the template and it will provide more information?

awptechnologies commented 2 weeks ago

{ "ha_version": "2024.11.0.dev202410090229", "card_version": "5.2.0", "browser": "Mozilla/5.0 (X11; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0", "date": "2024-10-10T04:32:15.941Z", "frigate_version": { "e9ee31cff7f74c6639c4e876e7bab6e2": "5.4.0/0.14.1-f4f3cfa" }, "lang": "en", "timezone": "America/New_York", "git": { "build_version": "5.2.0-HEAD+g69249b6", "build_date": "Fri, 23 Jun 2023 15:26:26 GMT", "commit_date": "Thu, 22 Jun 2023 09:21:26 -0600" }, "config": { "type": "custom:frigate-card", "cameras": [ { "camera_entity": "camera.living_room", "live_provider": "jsmpeg" }, { "camera_entity": "camera.alice_room", "live_provider": "jsmpeg" } ], "view": { "default": "live", "camera_select": "live", "dark_mode": "auto" }, "image": { "mode": "camera", "layout": { "position": { "x": 50, "y": 50 }, "fit": "fill" } }, "live": { "preload": true, "layout": { "fit": "fill" } }, "menu": { "buttons": { "recordings": { "enabled": true }, "download": { "enabled": false }, "expand": { "enabled": false }, "play": { "enabled": true }, "screenshot": { "enabled": false } } }, "dimensions": { "aspect_ratio_mode": "static", "aspect_ratio": "16:9", "max_height": "500", "min_height": "300" }, "performance": { "style": { "border_radius": true, "box_shadow": true } }, "media_viewer": { "layout": { "position": { "x": 50, "y": 50 }, "fit": "fill" } } } }

awptechnologies commented 2 weeks ago

I don't know if it helps but i also use the frigate integration from hacs since my homeassistant is in docker. If i go to this integration the cameras work fine i can watch the previews indefinitely. The only thing that is having issues keeping live view up is the frigate card.

dermotduffy commented 2 weeks ago

Try one of the new betas instead: https://github.com/dermotduffy/frigate-hass-card/releases/tag/v6.0.0-beta.7

Recommend using go2rtc as your live provider instead of jsmpeg:

cameras:
  - camera_entity: camera.living_room
    live_provider: go2rtc
awptechnologies commented 2 weeks ago

where do i put that?

awptechnologies commented 2 weeks ago

if figured it out what is the difference? is there a reason it defaulted to that?

dermotduffy commented 2 weeks ago

It does not default to jsmpeg. You would have had to set it explicitly.

awptechnologies commented 2 weeks ago

well it is still going out

"ha_version": "2024.11.0.dev202410090229", "card_version": "5.2.0", "browser": "Mozilla/5.0 (X11; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0", "date": "2024-10-10T04:49:24.741Z", "frigate_version": { "e9ee31cff7f74c6639c4e876e7bab6e2": "5.4.0/0.14.1-f4f3cfa" }, "lang": "en", "timezone": "America/New_York", "git": { "build_version": "5.2.0-HEAD+g69249b6", "build_date": "Fri, 23 Jun 2023 15:26:26 GMT", "commit_date": "Thu, 22 Jun 2023 09:21:26 -0600" }, "config": { "type": "custom:frigate-card", "cameras": [ { "camera_entity": "camera.living_room", "live_provider": "go2rtc" }, { "camera_entity": "camera.alice_room", "live_provider": "go2rtc" } ], "view": { "default": "live", "camera_select": "live", "dark_mode": "auto" }, "image": { "mode": "camera", "layout": { "position": { "x": 50, "y": 50 }, "fit": "fill" } }, "live": { "preload": true, "layout": { "fit": "fill" } }, "menu": { "buttons": { "recordings": { "enabled": true }, "download": { "enabled": false }, "expand": { "enabled": false }, "play": { "enabled": true }, "screenshot": { "enabled": false } } }, "dimensions": { "aspect_ratio_mode": "static", "aspect_ratio": "16:9", "max_height": "500", "min_height": "300" }, "performance": { "style": { "border_radius": true, "box_shadow": true } }, "media_viewer": { "layout": { "position": { "x": 50, "y": 50 }, "fit": "fill" } } } }

dermotduffy commented 2 weeks ago

That is still the old card version, please try the beta I linked to.

awptechnologies commented 2 weeks ago

how do i install the beta?

awptechnologies commented 2 weeks ago

saw it in the hacs store lol. I will let you know how it does

dermotduffy commented 2 weeks ago

If it's still an issue, would appreciate a screen capture so I can see exactly what you're experiencing.

awptechnologies commented 2 weeks ago

okay i still had issue so im gonna delete everything and uninstall and try to do fresh install.

awptechnologies commented 2 weeks ago

Screenshot From 2024-10-10 00-58-42

awptechnologies commented 2 weeks ago

After reinstall issue still present.

dermotduffy commented 2 weeks ago

Home Assistant is failing to return the list of events for the camera. You'll have an exception in your home assistant log.

awptechnologies commented 2 weeks ago

For some reason enabling webrtc in go2rtc modes seems to have fixed it?

awptechnologies commented 2 weeks ago

This error originated from a custom integration.

Logger: custom_components.frigate.api Source: custom_components/frigate/api.py:244 integration: Frigate (documentation, issues) First occurred: 1:12:31 AM (42 occurrences) Last logged: 1:22:58 AM

Timeout error fetching information from http://10.1.1.23:5000/api/events?cameras=living-room&limit=50&include_thumbnails=0:

Still doing it...

dermotduffy commented 2 weeks ago

Your Frigate backend is timing out when Home Assistant tries to talk to it. This could be for any number of reasons (e.g. networking, CPU load). If you have a very large number of events, you could try setting these flags for the card:

performance:
  features:
    media_chunk_size: 10
    max_simultaneous_engine_requests: 1

You can play around with those values, but this example would only make one request at a time, and only return 10 events at a time (default is 50 events a time, any number of concurrent requests, so the above should reduce the load on your Frigate backend).

Docs: https://card.camera/#/configuration/performance

awptechnologies commented 2 weeks ago

It is still doing it. The issue started randomly after a homeassistant update. I have been using this for at least a year or 2 and no problems until now.

dermotduffy commented 2 weeks ago

Out of ideas!

awptechnologies commented 2 weeks ago

because my homeassistant install is very complex do you think the sqlite database could have anything to do with it. I had thought about redoing everything to use a dedicated mysql database. Do you think that would help?

awptechnologies commented 2 weeks ago

Im just confused because when i view the cameras in the frigate integration inside homeassistant the cameras work flawless

dermotduffy commented 2 weeks ago

because my homeassistant install is very complex do you think the sqlite database could have anything to do with it. I had thought about redoing everything to use a dedicated mysql database. Do you think that would help?

Highly unlikely. The issue is that Frigate is taking too long to reply to Home Assistant, or Home Assistant is under too much load. Nothing to do with your Home Assistant database.

Im just confused because when i view the cameras in the frigate integration inside homeassistant the cameras work flawless

The integration is not fetching events / thumbnails / PTZ, etc. You could always disable events and it would probably work:

type: custom:frigate-card
cameras:
  - camera_entity: camera.office
    live_provider: go2rtc
live:
  controls:
    thumbnails:
      mode: none

... but you'll have no thumbnails/events obviously.

awptechnologies commented 2 weeks ago

Maybe a library issue on docker host that has frigate. I did an apt update and upgrade and it seems to be holding up. Is that possible?

TheDuffman85 commented 2 weeks ago

Same problem for me even with v6 beta 7. Only thing that solves this issue for me is to switch the provider to JSMPEG.

dermotduffy commented 2 weeks ago

@awptechnologies Maybe a library issue on docker host that has frigate. I did an apt update and upgrade and it seems to be holding up. Is that possible?

Maybe? This is a really general problem where your two devices are struggling to talk to one another for some reason, but it's really hard to say.

Did you try disabling thumbnails as I suggested here?

Another idea is to turn on debug logging in the card:

debug:
  logging: true

... then refresh your dashboard and paste all the logs generated in your javascript console (F12 in Chrome). This would help rule out a malfunction in the card (e.g. sending large numbers of requests that is causing the overload).

@TheDuffman85 Same problem for me even with v6 beta 7. Only thing that solves this issue for me is to switch the provider to JSMPEG.

I don't understand how changing to JSMPEG fixes this problem. If you'd like support, I think it'd be best to open a new issue (please follow the template) so we don't get the two reports mixed up. Please also include a screenshot of the error you are receiving.

awptechnologies commented 2 weeks ago

so far so good after that update weird

dermotduffy commented 1 week ago

Considering this closed. Thanks!