AlexxIT / WebRTC

Home Assistant custom component for real-time viewing of almost any camera stream using WebRTC and other technologies.
https://github.com/AlexxIT/Blog
MIT License
1.43k stars 168 forks source link

Unable to create streams for google nest camera entities - `no entity_id` #635

Open twhittock opened 8 months ago

twhittock commented 8 months ago

Trying to use go2rtc using this integration to create a stream for the my google nest camera so I can use it in more places.

Following the readme to configure it using hass entities (which are working directly in hass) in the go2rtc docs here: https://github.com/AlexxIT/go2rtc?tab=readme-ov-file#source-hass

I create a configuration like this:

streams:
  left_side_camera:
    - hass:entity_id=camera.left_side_camera

No errors on startup, but when I try to preview the stream using http://myhassinstance:1984/stream.html?src=left_side_camera I get the following error:

undefined error=streams: hass: no entity_id caller=github.com/AlexxIT/go2rtc/internal/mjpeg/init.go:166

Looking at go2rtc issues, this was reported before and was due to missing config info, but I can't see any way / need to do that when running as an integration?

twhittock commented 8 months ago

If i should be using the different syntax in the readme in this repo, I'm a bit confused.

If I use hass://supervisor?entity_id=camera.left_side_camera then I get the error undefined error=streams: hass: wrong type: auth_invalid caller=github.com/AlexxIT/go2rtc/internal/mjpeg/init.go:166

If I use hass://myhassinstance?entity_id=camera.left_side_camera then I get undefined error=streams: hass: no token caller=github.com/AlexxIT/go2rtc/internal/mjpeg/init.go:166

If I then provide a token, it tells me undefined error=streams: websocket: bad handshake caller=github.com/AlexxIT/go2rtc/internal/mjpeg/init.go:166

So it's like it needs to treat the request as if it's an external system, even though it's running as an integration? But even with the token it can't seem to negotiate a connection.

Lockie85 commented 8 months ago

I'm also getting this issue with my Nest Doorbell camera. Go2RTC is installed on my Home Assistant as an Addon. The code is as follows:

streams:
  bedroom_2:
    - hass:Camera-Hub-G3-E44E
    - ffmpeg:aqara_g3#audio=aac#audio=opus
  doorbell:
    - hass:doorbell

Worth noting that the bedroom_2 camera works fine.

AlexxIT commented 6 months ago

hass:entity_id=camera.left_side_camera syntax completely wrong. How have you installed Hass? How have you installed go2rtc?

twhittock commented 6 months ago

Yeah, I tried a lot of different variations on the syntax, since nothing I tried worked. The second message lists the variations.

Home Assistant is a simple hassos install, nothing special.

go2rtc is installed via this integration, which I relied on to install go2rtc automatically (which works for other camera types) My configuration is:

api:
  password: <password>
  username: admin
rtsp:
  password: <password>
  username: admin
hass:
  config: "/config"
streams:
  <other cameras which work...>
  nest_camera:
    - hass://supervisor?entity_id=camera.left_side_camera&token=<my token>
AlexxIT commented 6 months ago

Ok. I needs to test if hass://supervisor construction works when go2rtc runs inside hass container

twhittock commented 6 months ago

I'm happy to use it some other way - I also tried the hostname of the actual hass instance...

AlexxIT commented 6 months ago

You need to use hass://supervisor and not use token when go2rtc runs as addon on same server. And use hass://ip and token when hass installed on another server

twhittock commented 6 months ago

ok thank you - here's my updated findings:

  1. hass://supervisor - fails with "auth invalid" error, no matter what I do.
  2. hass://hostname - fails due to resolving to the container-local IP (172....) for the name of the server.
  3. hass://ip - fails due to using port 80
  4. hass://ip:8123 - works if you supply a token!!

So the ip, port and token approach works in the integration with automatically installed go2rtc scenario! Thank you for your help. I guess it's meant to work with the supervisor URI, which would certainly be more convenient, but it's enough for me!

Thanks.