Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn camera entity (or entities) into unavailable once Frigate hasn't received any frames #406

Closed
felipecrs opened this issue Jan 10, 2023 · 12 comments
Labels
help wanted Extra attention is needed

Comments

@felipecrs
Copy link
Contributor

This issue comes from blakeblackshear/frigate#4998. Frigate already detects when the camera is "unavailable":

image

It would be great if the integration could put the entity into unavailable state as well.

It's also cool because I could then use HA's history to figure out how often my cameras becomes unavailable.

@NickM-27
Copy link
Collaborator

dev notes: we can use the camera_fps as an indicator. In 0.12 we force its value to 0 when the stream stops having frames being decoded.

@ColColonCleaner
Copy link

Implementing this is really important.

I have had multiple instances now where all cameras just stop loading new frames without any way of HA being able to see the cameras are disconnected.

@NickM-27 The camera FPS stays at 15 even though there are no new frames coming in. I don't see any way of determining when the last frame came in so I can automate notifications/warnings for this.

@NickM-27
Copy link
Collaborator

NickM-27 commented Mar 6, 2023

Implementing this is really important.

I have had multiple instances now where all cameras just stop loading new frames without any way of HA being able to see the cameras are disconnected.

@NickM-27 The camera FPS stays at 15 even though there are no new frames coming in. I don't see any way of determining when the last frame came in so I can automate notifications/warnings for this.

This is most likely because you are having a python bus error, please read the docs on that. Otherwise the camera_fps will be set to 0

@ColColonCleaner
Copy link

Thanks, I'll look at that. It's worrying though because an error preventing someone from knowing the cameras are offline is pretty serious.

Is there a way to make a timestamp of when cameras last reported their state so as a last resort people can tell via that variable becoming stale that something has stopped updating, regardless of any errors occurring?

@felipecrs
Copy link
Contributor Author

@ColColonCleaner or you can just wait it to be implemented here (or if you can, PRs are always welcome).

@ColColonCleaner
Copy link

@NickM-27 I see the usual cause of bus issues is the shm size, and mine is already increased from 64MB to cover the 3 4K cameras (no substreams), it's at 256MB (i know only 108MB is needed according to the formula, but I wanted to be safe for adding more cameras).
How do I access logs after the fact when they are inside the docker container? I'm running it on unraid with the logger set to debug mode and I can see the logs when I open the log terminal, but I don't see any way of just downloading the full logs to sift through the history. All I can see is what comes in after I've connected to the log terminal. I've looked through unraid's forums for this and all I find are suggestions for how to stop large log files by using max size parameters on the container, rather than how to actually view and parse existing logs. I have Frigate set up to push its config/media folders to an unraid share but those don't contain the log files. Suggestions on how to access these would be appreciated.

@felipecrs I would wait, but I'd rather not have the wife distrusting the camera displays in the meantime. She's already noticed them frozen once and I tried mitigating it with some automations watching the variables but lo-and-behold the camera fps doesn't change to 0, so I went searching here

@NickM-27
Copy link
Collaborator

NickM-27 commented Mar 6, 2023

@NickM-27 I see the usual cause of bus issues is the shm size, and mine is already increased from 64MB to cover the 3 4K cameras (no substreams), it's at 256MB (i know only 108MB is needed according to the formula, but I wanted to be safe for adding more cameras).
How do I access logs after the fact when they are inside the docker container? I'm running it on unraid with the logger set to debug mode and I can see the logs when I open the log terminal, but I don't see any way of just downloading the full logs to sift through the history. All I can see is what comes in after I've connected to the log terminal. I've looked through unraid's forums for this and all I find are suggestions for how to stop large log files by using max size parameters on the container, rather than how to actually view and parse existing logs. I have Frigate set up to push its config/media folders to an unraid share but those don't contain the log files. Suggestions on how to access these would be appreciated.

Just run docker logs frigate in the terminal. Otherwise, in 0.12 frigate has logs in the webUI

@felipecrs I would wait, but I'd rather not have the wife distrusting the camera displays in the meantime. She's already noticed them frozen once and I tried mitigating it with some automations watching the variables but lo-and-behold the camera fps doesn't change to 0, so I went searching here

I think there may be some confusion. The 0 fps feature is only guaranteed to work in 0.12 where we made changes to ensure it's set when the stream fails

@ColColonCleaner
Copy link

Looks like an update to the beta is in order. Thanks!

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Jun 10, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 14, 2023
@felipecrs
Copy link
Contributor Author

Can this issue be reopened?

@dermotduffy dermotduffy added help wanted Extra attention is needed and removed Stale labels Jun 19, 2023
@dermotduffy dermotduffy reopened this Jun 19, 2023
@cagivacode
Copy link

I am essentially doing this by decoding the "frigate/stats" in a MQTT sensor for each camera. This gives FPS which if below "1" shows "offline" else "online".

I have an HA "alarm panel" which shows the status of various doors / windows / cameras with simple green/red icons.

I also have an automation that can reboot a flakey camera when it locks up.

The "online" status of cameras is a very useful feature.

@felipecrs
Copy link
Contributor Author

felipecrs commented Sep 16, 2023

#526, thanks a ton @NickM-27. Seems to be working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants