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

CAMERAS GETTING "No Response" NEARLY EVERY TIME. #930

Closed
MoTechnicalities opened this issue May 10, 2022 · 28 comments
Closed

CAMERAS GETTING "No Response" NEARLY EVERY TIME. #930

MoTechnicalities opened this issue May 10, 2022 · 28 comments
Labels
bug Something isn't working

Comments

@MoTechnicalities
Copy link

image
image

Bug Report

Describe the Bug

A clear and concise description of the problem...

To Reproduce

Steps to reproduce the behavior:

  • Start Homebridge
  • Attempt to ...
  • See error

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots/Logs

If applicable, add screenshots and log output to help explain your problem.

Additional context

Add any other context about the problem here.

Homebridge Ring Config

Post homebridge-ring platform config without sensitive information


HIGHLIGHT THIS TEXT AND POST CONFIG HERE
DO NOT INCLUDE YOUR REFRESH TOKEN OR EMAIL/PASSWORD (replace them with xxx)

Environment

  • OS: [e.g. Raspbian]
  • Node.js: [e.g. 12.14.1]
  • NPM: [e.g 6.13.4]
  • homebridge-ring: [e.g 6.0.3]
  • homebridge: [e.g. 0.4.50 or N/A]
  • hoobs: [e.g. 0.4.50 or N/A]
@MoTechnicalities MoTechnicalities added the bug Something isn't working label May 10, 2022
@bkarakashev
Copy link

I am having the same issue.

@dgreif
Copy link
Owner

dgreif commented May 10, 2022

The new streaming setup is using WebRTC instead of SIP, and may run into new issues that you were not facing before. If it is unable to connect, it's likely due to network complications between your homebridge server and the Ring servers (or local camera if you are using Ring Edge). Do you have a complicated network setup? Is it possible your network is blocking these new connections?

@bkarakashev
Copy link

I do have a kind of complicated network. how can I check if it is getting blocked? should I open some port or something?

@dgreif
Copy link
Owner

dgreif commented May 10, 2022

WebRTC uses random ports, so it will be completely dependent on your network. One easy thing to try is to see if the Ring App (ios/android) can access the live stream from the same point on the network as your homebridge server

@bkarakashev
Copy link

yeah, the Ring app works with no problem from my laptop and from my phone without issues. just homebridge is having issues. and it used to work without any issues.

@bkarakashev
Copy link

I am not sure if this helps but, when I start the stream from the Home app it is loading for a bit and then gives up but it did update the thumbnail in the app.

@dgreif
Copy link
Owner

dgreif commented May 10, 2022

K, I don't have any immediate solutions other than downgrading to v9 for now. This is likely something in werift-webrtc, but I haven't been able to reproduce these issues and likely won't have any time soon to dig into it further

@bkarakashev
Copy link

Thanks, @dgreif downgrading to homebridge-ring v9.24.0 fixed the issue for me.

@MoTechnicalities
Copy link
Author

All the exact same issues as bkarakashev reported under v11.0.0.

Reverted to homebridge-ring v9.24.0 and all cameras working again.

... When two steps back is a giant leap forward.

@League2EB
Copy link

This method can make the HomeAPP stream, but after 15 seconds there is no response....
Are you too?
@MoTechnicalities
@bkarakashev

@Dima-Kal
Copy link

Facing same issues, unable to get homebridge video but ring app works just fine.
using Docker Homebridge latest

@shinyoshiaki
Copy link

shinyoshiaki commented May 17, 2022

In my environment, WebSocket disconnects a short time (8~40 seconds) after the WebRTC connection is established.

https://github.com/dgreif/ring/blob/master/api/streaming/streaming-connection-base.ts#L65

And then the WebRTC connection is also disconnected

https://github.com/dgreif/ring/blob/master/api/streaming/streaming-connection-base.ts#L136

@dgreif
Copy link
Owner

dgreif commented May 17, 2022

@shinyoshiaki I didn't realize you used the ring client, that's wonderful news 😁 . I'm hoping that some of the PRs from @koush will fix these issues but I can't say for certain. Any chance you can publish a release of werift soon to get those changes out? I don't have much free time right now, so any debugging help you can provide would be very much appreciated!

As far as the WebSocket disconnecting, I haven't run into that issue at all yet. Ultimately I plan to handle disconnects by starting a new stream and keeping the single ffmpeg instance going, but I haven't gotten around to implementing that piece yet. Theoretically we can keep streaming past the 10 minute max with that approach 😄.

@shinyoshiaki
Copy link

I don't think koush's PR has much to do with this case.

From the second picture in the bug report, it looks like the connection is destroyed by homebridge's StopStreamRequest 8 seconds after the successful connection of ice. DTLS negotiation after the Ice connection may have failed.

This is the first time that werift has been used for anything other than experimental purposes, so it is not surprising that negotiation issues arising from this kind of network environment may arise.

May need to increase the amount of logs first to determine the cause.

@koush
Copy link
Contributor

koush commented May 17, 2022

This is the first time that werift has been used for anything other than experimental purposes, so it is not surprising that negotiation issues arising from this kind of network environment may arise.

I'm using werift quite extensively in Scrypted. It recently replaced node-webrtc (which is a node binding of chromium libwebrtc) completely within the project. It provides a webrtc gateway, in for both video sources and video sinks. The current webrtc sources are webcams, google gen 2 cameras, and ring. The current webrtc sinks are chromecast, nest hubs, Alexa hub, and all manner of browsers. Everything works great, I have not had any issues and users haven't reported anything like this. Additionally, werift has replaced the srtp sender throughout the project (homekit/rtsp, where it was previously using ffmpeg). Incidentally you may want to take a look at the h264 repacketizer, was considering submitting that to werift proper. https://github.com/koush/scrypted/blob/main/plugins/homekit/src/types/camera/h264-packetizer.ts

As a data point: on my fork of ring-client-api, haven't had any issues with webrtc. But SIP is still the default for my users. The adventurous users on WebRTC have not seen any issues. The recommended network environment for docker is host networking. This may be a potential reason.

My other guess is that the code I added to determine connection state when there are multiple ice transports (in the non bundle case) is possibly buggy.
I think the 2nd screenshot above is not the HomeKit StopStreamRequest ending the webrtc connection. Rather, it's timing out (No Response), then everything including the hung werift connection gets torn down.

dgreif added a commit that referenced this issue May 17, 2022
@dgreif
Copy link
Owner

dgreif commented May 17, 2022

@shinyoshiaki, thanks for the quick release of werift! Totally understand that it's experimental at this point, but even as an experiment it's a great leap forward from the SIP code I had before.

I've updated to the latest werift in v11.0.1. @MoTechnicalities could you give it a try and see if things are any better? From my initial testing, streams seem to be loading a little faster!

@dgreif
Copy link
Owner

dgreif commented May 18, 2022

Just confirmed with @donavanbecker that one of his cameras is still failing to connect after the update. @shinyoshiaki is this something you would be willing to dig into further? If so, I think the easiest thing would be to chat via the Homebridge discord server, and I can set up a private channel between you, me and @donavanbecker to talk further.

@Dima-Kal
Copy link

11.0.1 did not resolve the issue for me

@shinyoshiaki
Copy link

shinyoshiaki commented May 18, 2022

Just confirmed with @donavanbecker that one of his cameras is still failing to connect after the update. @shinyoshiaki is this something you would be willing to dig into further? If so, I think the easiest thing would be to chat via the Homebridge discord server, and I can set up a private channel between you, me and @donavanbecker to talk further.

I don't have much time during the week, maybe I can do it on the weekend. (and I can't speak english. so I can only text chat.)

@donavanbecker
Copy link
Contributor

I don't have much time during the week, maybe I can do it on the weekend. (and I can't speak english. so I can only text chat.)

That's fine. Just let us know once you get on to discord and we can get a private chat setup with @dgreif and myself

dgreif added a commit that referenced this issue May 21, 2022
@dgreif
Copy link
Owner

dgreif commented May 21, 2022

Huge thank you to @shinyoshiaki for going way out of your way to help us debug this! Looks like Ring sometimes requires PCMU instead of OPUS.

@MoTechnicalities @donavanbecker I've released 11.0.2-beta.0 which should hopefully fix streaming from the few cameras that are currently failing 🤞 . Let me know if it works for you!

Note, I've only implemented the incoming audio fixes. 2-way audio will not currently work for the cameras that use PCMU. If this fix looks good, I'll figure out that piece next.

@Dima-Kal
Copy link

Huge thank you to @shinyoshiaki for going way out of your way to help us debug this! Looks like Ring sometimes requires PCMU instead of OPUS.

@MoTechnicalities @donavanbecker I've released 11.0.2-beta.0 which should hopefully fix streaming from the few cameras that are currently failing 🤞 . Let me know if it works for you!

Note, I've only implemented the incoming audio fixes. 2-way audio will not currently work for the cameras that use PCMU. If this fix looks good, I'll figure out that piece next.

I can confirm that 11.0.2-beta.0 has fixed the issue for me (ring peephole camera)
Thanks!

@donavanbecker
Copy link
Contributor

Same for me.

@MoTechnicalities
Copy link
Author

@dgreif
All 7 Cameras are working under the new beta and it looks like you can move forward. Thanks!

Still hoping to get that fake motion sensor removed from Ring bulbs some day too. That issue was closed without a fix.

dgreif added a commit that referenced this issue May 21, 2022
@dgreif
Copy link
Owner

dgreif commented May 21, 2022

Return audio should be fixed in 11.0.2-beta.1. @Dima-Kal or @MoTechnicalities, mind giving it a try? Should be able to talk through homekit and hear it out of the cameras that weren't streaming before beta.0

@MoTechnicalities
Copy link
Author

@dgreif

Re: 11.0.2-beta.1
Working ok.

@mav2010
Copy link

mav2010 commented May 22, 2022

I have a similar or even the same issue on all versions >9.24.0 (including the new beta). For me the following error appears. With version 9.24.0 everything works fine.

[5/22/2022, 11:47:19 AM] [Ring] Preparing Live Stream for Haustür
[5/22/2022, 11:47:20 AM] [Ring] Stream Prepared for Haustür (0.681s)
[5/22/2022, 11:47:20 AM] [Ring] Activating stream for Haustür (0.73s)
[5/22/2022, 11:47:21 AM] [Ring] iceConnectionStateChange: completed
[5/22/2022, 11:47:21 AM] Error: Cannot get schema for 'Array' target
    at AsnSchemaStorage.get (/homebridge/node_modules/homebridge-ring/node_modules/@peculiar/asn1-schema/build/cjs/schema.js:18:19)
    at Function.toASN (/homebridge/node_modules/homebridge-ring/node_modules/@peculiar/asn1-
schema/build/cjs/serializer.js:21:48)
    at Function.toAsnItem (/homebridge/node_modules/homebridge-ring/node_modules/@peculiar/asn1-schema/build/cjs/serializer.js:140:33)
    at Function.toASN (/homebridge/node_modules/homebridge-ring/node_modules/@peculiar/asn1-schema/build/cjs/serializer.js:46:46)
    at Function.serialize (/homebridge/node_modules/homebridge-ring/node_modules/@peculiar/asn1-schema/build/cjs/serializer.js:14:21)
    at Function.serialize (/homebridge/node_modules/homebridge-ring/node_modules/@peculiar/asn1-schema/build/cjs/convert.js:10:43)
    at Function.create (/homebridge/node_modules/homebridge-ring/node_modules/@peculiar/x509/build/x509.cjs.js:1740:43)
    at Function.CipherContext.createSelfSignedCertificateWithKey (/homebridge/node_modules/homebridge-ring/node_modules/dtls/src/context/cipher.ts:111:18)
    at RTCDtlsTransport.setupCertificate (/homebridge/node_modules/homebridge-ring/node_modules/werift/src/transport/dtls.ts:71:9)
    at ensureCert (/homebridge/node_modules/homebridge-ring/node_modules/werift/src/peerConnection.ts:1065:34)
[5/22/2022, 11:47:21 AM] Got SIGTERM, shutting down Homebridge...
[5/22/2022, 11:47:21 AM] [Ring] Stopped Live Stream for Haustür
[5/22/2022, 11:47:21 AM] [Ring] connectionStateChange: closed
[5/22/2022, 11:47:21 AM] [Ring] iceConnectionStateChange: closed

@dgreif dgreif closed this as completed in 7b86182 May 22, 2022
@dgreif
Copy link
Owner

dgreif commented May 22, 2022

11.0.2 released 🚀

Anyone still having issues, you are likely not on v16 of node (instructions for updating). Locking this thread to prevent more chatter, please open a new issue with full details if you are experiencing streaming issues.

Repository owner locked as resolved and limited conversation to collaborators May 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants