blakeblackshear / frigate-hass-integration

Frigate integration for Home Assistant
MIT License
657 stars 110 forks source link

"failed to connect" to successful docker frigate instance, can be accessed by web UI but won't integrate #663

Closed sluflyer06 closed 2 months ago

sluflyer06 commented 2 months ago

Hi,

So I successfully have Frigate up and running with a portainer stack, I can access it from 10.10.10.60:5001. It is running on a Ubuntu server VM at that IP running well with front door camera and tensor acceleration.

I have Home assistant running on it's on VM at 10.10.10.47, MQTT is setup properly and confirmed with log to be connected to Frigate and working with other services.

I installed the frigate integration in HACS (v 5.1) and when I go to add the integration and use URL of http://10.10.10.60:5001/ (or without slash) I get a failed to connect...I've spent the entire night reinstalling things, trying various permutations of the URL, and searched tirelessly and have not been able to fix this. Help please! :)

2024-04-12 22:11:00.591 ERROR (MainThread) [custom_components.frigate.api] Error fetching information from http://10.10.10.60:5000/api/stats: 500, message='INTERNAL SERVER ERROR', url=URL('http://10.10.10.60:5000/api/stats')

This is form Frigate docker log

2024-04-13 03:19:57.571037614 10.10.10.47 - - [13/Apr/2024:03:19:57 +0000] "\x16\x03\x01\x02\x00\x01\x00\x01\xFC\x03\x03\xD8\x16\xF7!9\xBF \x1F\xDDMh)\x18ef\xC6\xF9\x8A(U\x136\xB1\x1D\xA7\xD3\x84\x98T$\xB0\xEA \x91\xA5\xB2Yi!\xC7\xFE&\x18#v\xCC\xE3\xEDt\xD6\xA3\x09h\xD2J\xFC\x8F\x01\x00\xF8\x9AK\x99)\xD9\x00$\x13\x02\x13\x03\x13\x01\xC0,\xC00\xC0+\xC0/\xCC\xA9\xCC\xA8\xC0$\xC0(\xC0#\xC0'\x00\x9F\x00\x9E\x00k\x00g\x00\xFF\x01\x00\x01\x8F\x00\x0B\x00\x04\x03\x00\x01\x02\x00" 400 157 "-" "-" "-"

NickM-27 commented 2 months ago

looks like it is connecting to port 5000, not 5001

sluflyer06 commented 2 months ago

looks like it is connecting to port 5000, not 5001

I changed it around just to eliminate variables

sluflyer06 commented 2 months ago

Just for clarification, after eliminating possibilities of port conflict from Belkin wemo and other add-ons for 5000, frigate set back to use 5000 again, verify can get to http://10.10.10.60:5000 to the web interface.

Also went to http://10.10.10.60:5000/api and got a alive and healthy, I don't know if you're supposed to be able to get to /api/stats and get a response, that one returns server error.

NickM-27 commented 2 months ago

if it returns server error then you should check frigate logs and see why it is failing

sluflyer06 commented 2 months ago

This might be the right block? Doesn't mean anything to me, but hopefully to someone good or bad. Do we even know if you should be able to navigate to that URL? It was a question.

2024-04-13 14:35:25.358887421 [2024-04-13 14:35:25] frigate.http ERROR : Exception on /stats [GET] 2024-04-13 14:35:25.358893873 Traceback (most recent call last): 2024-04-13 14:35:25.358896534 File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 2190, in wsgi_app 2024-04-13 14:35:25.358899052 response = self.full_dispatch_request() 2024-04-13 14:35:25.358904058 File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1486, in full_dispatch_request 2024-04-13 14:35:25.358904168 rv = self.handle_user_exception(e) 2024-04-13 14:35:25.358908609 File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1484, in full_dispatch_request 2024-04-13 14:35:25.358909029 rv = self.dispatch_request() 2024-04-13 14:35:25.358911457 File "/usr/local/lib/python3.9/dist-packages/flask/app.py", line 1469, in dispatch_request 2024-04-13 14:35:25.358913787 return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) 2024-04-13 14:35:25.358916034 File "/opt/frigate/frigate/http.py", line 1386, in stats 2024-04-13 14:35:25.358918129 stats = stats_snapshot( 2024-04-13 14:35:25.358920429 File "/opt/frigate/frigate/stats.py", line 303, in stats_snapshot 2024-04-13 14:35:25.358922584 storage_stats = shutil.disk_usage(path) 2024-04-13 14:35:25.358924854 File "/usr/lib/python3.9/shutil.py", line 1262, in disk_usage 2024-04-13 14:35:25.358926986 st = os.statvfs(path)

sluflyer06 commented 2 months ago

So...in linux kernel 5.15-102 they introduced a bug that triggers the issue with disk stats being unavailable, which in turn brings down Frigate entire stats service. The bug is being fixed at the end of the month in -104. If you're on 5.15-102 and run a df -h you will see all your remote mounts don't give disk space it says temporarily unavailable. So this issue is being driven by the underlying OS.