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

Unable to restream Nest doorbell from hass #541

Closed
dmascord opened this issue Jul 22, 2023 · 14 comments
Closed

Unable to restream Nest doorbell from hass #541

dmascord opened this issue Jul 22, 2023 · 14 comments
Labels
bug Something isn't working
Milestone

Comments

@dmascord
Copy link

I have attempted to configure the hass url in frigate.yaml, but I am seeing the following error:

2023-07-22 00:21:02.623115510  10:21:02.622 WRN [rtsp] error="unsupported scheme: hass://supervisor?entity_id=camera.front_door_doorbell" stream=doorbell

The frigate.yaml looks like:

mqtt:
  host: homeassistant.local
ffmpeg:
  hwaccel_args: preset-nvidia-h264
cameras:
  doorbell:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/doorbell
go2rtc:
  streams:
    doorbell: hass://supervisor?entity_id=camera.front_door_doorbell

Frigate 0.12.1 is installed via the HACS Add-on, is the Full Access version, and has protection has been lifted. go2rtc executable version 1.6.2 has been placed in the /config directory and is corrected detected and used by Frigate.

The camera stream works fine, with audio, via the Lovelace card through the Google Nest integration.

@Anon666333
Copy link

Having the same issue.
Check out this thread (although not for Nest cameras) may follow a similar ideology.

I'm assuming you're using Go2rtc via frigate and utilizing Hass.io not Docker? What doorbell do you have?

@buxtronix
Copy link

I got the "unsupported scheme" error also from the release build (1.6.2).

I think it's not got the new hass:// scheme changes in that build. I just cloned the repo and built my own copy and it now recognises it.

@Anon666333
Copy link

I got the "unsupported scheme" error also from the release build (1.6.2).

I think it's not got the new hass:// scheme changes in that build. I just cloned the repo and built my own copy and it now recognises it.

Can you please clarify what you mean by cloned the repo and built your own copy?
Sorry for the noob question...

@AlexxIT
Copy link
Owner

AlexxIT commented Aug 11, 2023

Hass scheme may be unsupported if go2rtc can't find Hass config

@buxtronix
Copy link

buxtronix commented Aug 11, 2023

I got a video feed from it, but had to do the following:

  • set SUPERVISOR_TOKEN env variable to a Hass API token.
  • modify internal/hass/hass.go:importConfig to return nil error on ErrNotExist.

still struggling a bit from within Hass Frigate addon, but direct on the host it's working.

Edit: I got it working from Hass Frigate addon, as follows.

  • Downloaded the source.
  • Edited hass.go per above.
  • Built and put the binary into /config dir
  • Added the stream in the frigate config (no token required):

nestcam: hass://supervisor?entity_id=camera.driveway_camera

@Anon666333
Copy link

Anon666333 commented Aug 11, 2023

@buxtonix, could you possibly share your hass.go config here?
I believe I'm adjusting as per your recommendation, but I'm unsure.

I'm noticing for this line is not returning nil on err, but I'm not sure if this is exactly where you are referring to (line 39-47):

// load static entries from Hass config
if err := importConfig(conf.Mod.Config); err != nil {
	log.Debug().Msgf("[hass] can't import config: %s", err)

	api.HandleFunc("api/hass", func(w http.ResponseWriter, _ *http.Request) {
		http.Error(w, "no hass config", http.StatusNotFound)
	})
	return
}
}

and here (186-190):

func importWebRTC(token string) error {
hassAPI, err := hass.NewAPI("ws://supervisor/core/websocket", token)
if err != nil {
return err
}

@buxtronix
Copy link

The relevant diff (plus add appropriate imports):

@@ -97,6 +100,9 @@ func importConfig(config string) error {
        filename := path.Join(config, ".storage/core.config_entries")
        b, err := os.ReadFile(filename)
        if err != nil {
+               if errors.Is(err, fs.ErrNotExist) {
+                       return nil
+               }
                return err
        }

Although I now ended up using the direct nest module after extracting the relevant tokens, etc which is much more reliable that the HA restream. Seems much cleaner to have all cams read from go2rtc directly instead of a mish-mash of clients.

@AlexxIT
Copy link
Owner

AlexxIT commented Aug 12, 2023

Disabled hass source without config file - it's my bad. Will fix it in next version.

@Anon666333
Copy link

Anon666333 commented Aug 14, 2023

The relevant diff (plus add appropriate imports):

@@ -97,6 +100,9 @@ func importConfig(config string) error {
        filename := path.Join(config, ".storage/core.config_entries")
        b, err := os.ReadFile(filename)
        if err != nil {
+               if errors.Is(err, fs.ErrNotExist) {
+                       return nil
+               }
                return err
        }

Although I now ended up using the direct nest module after extracting the relevant tokens, etc which is much more reliable that the HA restream. Seems much cleaner to have all cams read from go2rtc directly instead of a mish-mash of clients.

Thank you for this!
Would you mind sharing where you extracted the relevant tokens from? Specifically the refresh token....

@buxtronix
Copy link

I followed this: https://developers.google.com/nest/device-access/get-started

It guides you through all the steps using curl to fetch the relevant info and tokens.

@AlexxIT AlexxIT added the bug Something isn't working label Aug 21, 2023
@AlexxIT
Copy link
Owner

AlexxIT commented Aug 22, 2023

@NickM-27 can you add this for default go2rtc.yaml in the Frigate:

hass:
  config: /config

So go2rtc will be able autofind hass cameras.

This is because cwd in the Frigate not /config

@NickM-27
Copy link
Contributor

Sure, it will be added for frigate 0.13 release

@AlexxIT
Copy link
Owner

AlexxIT commented Sep 2, 2023

hass source should be supported without hass config
https://github.com/AlexxIT/go2rtc/releases/tag/v1.7.0

@AlexxIT AlexxIT closed this as completed Sep 2, 2023
felipecrs pushed a commit to felipecrs/go2rtc that referenced this issue Oct 20, 2023
@Inrego
Copy link
Contributor

Inrego commented Dec 29, 2023

@buxtronix is this still running fine for you?
I've also added my nest camera using the nest integration, but I'm having issues with the stream expiring after 5 minutes, because the extend function is never called. When the stream expires, frigate seems to go bonkers for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants