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

Device URLs not helpful when using the addon #257

Open
felipecrs opened this issue May 15, 2022 · 10 comments
Open

Device URLs not helpful when using the addon #257

felipecrs opened this issue May 15, 2022 · 10 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@felipecrs
Copy link
Contributor

felipecrs commented May 15, 2022

Version of the custom_component

v2.3

Configuration

image

Describe the bug

The newly added Device URLs aren't helpful when the Frigate server is an addon. See:

chrome_N4jyCmKhwx.mp4

IMO: Taking the HA internal URL + the right port is better than using the configured Frigate URL (which will never be accessible from a browser).

Ideally, the HA ingress should allow custom paths instead of only the /dashboard home. That would be better to redirect to, as it would work both internally and externally.

Debug log

N/A

@dermotduffy
Copy link
Collaborator

IMO: Taking the HA internal URL + the right port is better than using the configured Frigate URL (which will never be accessible from a browser).

... but that wouldn't work when it's NOT an addon (e.g. just another docker container, or a separate machine entirely). Given the choice between the two, I think as implemented may be a better default as it is at least behaving correct network wise (even if it's not that useful).

Ideally, the HA ingress should allow custom paths instead of only the /dashboard home. That would be better to redirect to, as it would work both internally and externally.

Yes, something like that is the real fix I suspect. This would be an issue with any addon and any use of device URL, might be something to take/discuss upstream.

@felipecrs
Copy link
Contributor Author

There is another option, a new configuration (as the RTMP URL template seem below):

image

That would allow the user to set some kind of "browsable base URL". I would set as http://192.168.1.10:5000.

Although I still believe the integration is able to detect whether the Frigate is running under the addon (by comparing it to the known addon hostnames for example), and then automatically set the "browsable base URL" as http://${ha-internal-ip}:5000.

@dermotduffy dermotduffy added the bug Something isn't working label Jun 10, 2022
@felipecrs
Copy link
Contributor Author

Here is some extra information:

  • List of installed addons can be fetched with the Supervisor API: https://developers.home-assistant.io/docs/api/supervisor/endpoints#addons
  • The integration can fetch the list of installed addons, and check if any slug matches the hostname of the Frigate URL (search must replace _ to - in slugs).
  • If a match is found, replace the hostname in the Frigate URL with Home Assistant internal IP.

This should cover most cases, as with the default settings of the addon, it would work.


Later improvements can be made:

  • If an addon match is found, first check if the Frigate UI port is forwarded (Supervisor API) since user can explicitly disable it.

  • If the port is not forwarded, make the URL be <home-assistant-external-url>/<addon-slug> (no direct paths to camera can be given here, unless we implement a function in the Frigate to handle HTTP args to convert them to paths).

  • If the forward is enabled, check which port is the one used in host. Use that port when substituting the hostname with the Home Assistant internal IP.

@felipecrs
Copy link
Contributor Author

felipecrs commented Jul 14, 2022

Ideally, the HA ingress should allow custom paths instead of only the /dashboard home. That would be better to redirect to, as it would work both internally and externally.

Yes, something like that is the real fix I suspect. This would be an issue with any addon and any use of device URL, might be something to take/discuss upstream.

I think the ingress will transfer any http parameter (I haven't confirmed) like <ha-external-url>/ccab4aaf_frigate?goto=cameras/garden. But Frigate would need to handle them.

Perhaps they can be handled in nginx itself?

@renarena
Copy link

renarena commented Aug 6, 2022

if it stays with the addon address, please add 4601ec1a-frigate-fa to the info text for the frigate full access version, so we can add it without looking up while adding the integration.

@felipecrs
Copy link
Contributor Author

It seems to be possible to have URLs to specific contexts in Hass addons, see the go2rtc example:

https:///api/hassio_ingress/gDSoAWDx1fTcipX0ive4x2xaXHOGlB4COSf-ebdB0PA/webrtc.html?src=camera.rua

@felipecrs
Copy link
Contributor Author

I found another "official" example, the AdGuard integration, which when configured with the Adguard Home addon makes the device url open the addon page in the HA ingress:

https://github.com/home-assistant/core/blob/8d3de5359275352ce13a38c28e49d3f5ccb04787/homeassistant/components/adguard/entity.py#L52

@spacebares
Copy link

It seems to be possible to have URLs to specific contexts in Hass addons, see the go2rtc example:

https:///api/hassio_ingress/gDSoAWDx1fTcipX0ive4x2xaXHOGlB4COSf-ebdB0PA/webrtc.html?src=camera.rua

anyway to get this into frigate? messed around with the frigate & addon nginx options couldn't get it working.

@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

Would it be possible to reopen this issue? It's still an issue and maybe someday someone works on it.

@dermotduffy dermotduffy added help wanted Extra attention is needed and removed Stale labels Jun 19, 2023
@dermotduffy dermotduffy reopened this Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants