core: Error handling WebRTC offer: Nest API error: Error from API: 500: INTERNAL: Internal error encountered.: Internal Server Error
The problem
As reported in https://github.com/home-assistant/core/issues/82528 Nest camera devices are still broken on Homeassistant using Firefox. Tested with both a Nest Video Doorbell (Battery) and a Nest Cam with floodlight (wired) I do not think it is a setup issue with my homeassistant instance, as other browsers display the streams fine, and I am less inclined to think it’s a Firefox issue considering that the camera streams display correctly at https://home.google.com
What version of Home Assistant Core has the issue?
core-2023.11.2
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
Google Nest
Link to integration documentation on our website
https://www.home-assistant.io/integrations/nest
Diagnostics information
config_entry-nest-d853b7634c9fc3f40e86a489f8cd0bbf.json.txt
Example YAML snippet
No response
Anything in the logs that might be useful for us?
I have debug logs containing the POST requests, but I am unsure what secrets are contained within those so will hold off posting those for now.
2023-11-13 15:59:19.350 ERROR (MainThread) [homeassistant.components.camera] Error handling WebRTC offer: Nest API error: Error from API: 500: INTERNAL: Internal error encountered.: Internal Server Error
2023-11-13 15:59:20.028 ERROR (MainThread) [homeassistant.components.camera] Error handling WebRTC offer: Nest API error: Error from API: 500: INTERNAL: Internal error encountered.: Internal Server Error
Additional information
Picture Entity Card is my primary method of displaying the feeds on dashboard, but the error also occurs when viewing the individual devices in the settings menu.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 23 (12 by maintainers)
This is definitely still a problem.
There hasn’t been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Both pull requests have been raised. Hope to see it soon.
@allenporter After some time, I get it done. There are multiple problems in between. 1. Nest: 500: INTERNAL: Internal error The root cause is because firefox may provide ICE candidate with empty string in event.candidate.candidate instead of empty event.candidate object.
Ref: https://stackoverflow.com/questions/67993490/webrtc-empty-string-in-icecandidate
I fixed this one by adding a conditional checking in the iceResolver within ha-web-rtc-player.ts _startWebRtc method
However, it is not the end. Then, googleapi is able to provide answer sdp. and then there is error from Firefox
2. Firefox: Answer tried to set recv when offer did not set send In both audio and video, recvonly is set in the request sdp. However, the answer sdp is having sendrecv which is incorrect. (it should be sendonly) It may be the googleapi bug, but in order to workaround, I have updated the code camera_traits.py generate_web_rtc_stream method
It is still not the end, even the answer sdp was processed by Firefox, there is still the error in about:webrtc page e.g.
3. Firefox: Error parsing attribute after comparing the answer sdp from home.google.com which works fine in firefox I found that, the ice candidate attribute is missing the foundation field Ref: https://developer.mozilla.org/en-US/docs/Web/API/RTCIceCandidate/foundation
Google Home’s answer ice candidate:
Home Assistant’s answer ice candidate:
Obviously, right after “candidate:” it is missing the foundation field Again, it may be the googleapi bug, but in order to workaround, I have updated the code camera_traits.py generate_web_rtc_stream method
P.S. after I added the foundation, then chrome will fail… I have no idea why, so, I just add the “mozilla” checking
Side track a bit I am using Docker to run the Home Assistant in Synology NAS. If we want to do some development work, but unable to setup devcontainer (like me using windows) then, it is quite easy to do some tricks to run the modified code.
@allenporter Please comment if these changes are valid If you or anyone could raise the pull requests for below, it would be great. camera_traits.py in https://github.com/allenporter/python-google-nest-sdm.git ha-web-rtc-player.ts in https://github.com/home-assistant/frontend.git
Thank you @jonnynch for your awesome contributions 👍🏼 very much appreciated, will work with you to get these merged and released for the next home assistant releases (maybe we can sneak into a patch)
I spent a week or two working on this when building the initial integration with WebRTC and wasn’t able to figure it out. I personally don’t use firefox, so I stopped spending time on it and it has not been a priority for me personally since then.
I am not sure what the issue is, and what part of the firefox SDP offer is causing a problem. I also reached out to the nest sdm folks and they didn’t have any new insights.
Contributions are welcome to fix this, but i currently am not prioritizing it in full disclosure given then time I already spent on it.