Closed slobglob closed 4 years ago
@jeffreydwalter I eventually fixed it with this commit: https://github.com/slobglob/arlo/commit/29e93b4683f85b145fe08337c255627215b798e6 for now. It works fine for me at least with the minimal testing I did so far.
Let me know if it makes sense, I'll create a PR if you want. If you have any idea of how to improve it, let me know.
Hey Shai! If that fixes things I'm happy to have the PR. Thanks!
Sure thing! I'll do some more QA and final fixes then I'll send in a PR.
Why did you have the sse
object within the EventStream
to begin with? Is it a bug? Or I misunderstood the design? @jeffreydwalter
Awesome, thanks!
I embedded the sse client in the EventStream because the sse IS the event stream, so it made sense to me.
I only had a single basestation, so I never had to deal with multiple base stations and wrongly assumed that each basestation had it's own subscription. Are you sure it's the GET /subscribe
that's logging you out and not the Login
call?
If it's true that all the basestations share a single event stream, then there's lots of cleanup that can happen... I made a branch and refactored the code to remove the collection of event_streams
in favor of a single event_stream
.
Give this branch a try: https://github.com/jeffreydwalter/arlo/pull/145
Inconveniently, my base station died, so I can't test it out... :/ Let me know how it goes.
Yeah, I was pretty positive that the sse
stream logged me out, and now with my modifications I'm 100% positive since it doesn't happen anymore.
The main issue here is that I'm using only Arlo Go cameras which is a basestation by itself, so multiple basestations require only one /subscribe
EventStream :)
Right on. The funny thing is that I tested my code with multiple Arlo go cameras and never had that issue. Are you 100% sure there wasn't a second call to Login
?
Give my branch a try and see how it goes. Having an event_stream object for each basestation is definitely not necessary and probably causes a lot of contention for messages from the queue.
Yes, I'm 100% there's only one login call, but I'll double check.
That's the first thing I suspected that happens when I got the logout
event, then after a few hours of debugging I got to the conclusion its the EventStream
that logs me out.
Maybe Arlo changed their API? Does that ever happen?
I'll take a look at your branch soon. Thanks again.
@jeffreydwalter I'm not sure your PR will do the trick.
When having just one EventStream
the heartbeat function will stop and then the stream itself will die as well.
Did you try it? Why do you think the heartbeat will stop? The heartbeat runs in its' own thread.
Yeah I get what you're saying. I'll have to test and see.
I'll keep you posted. Thanks man.
@slobglob did you get a chance to test out the https://github.com/jeffreydwalter/arlo/tree/single-event-stream branch with multiple cameras? I'd really appreciate your feedback since I don't even have a single Arlo camera to test with anymore (my basestation died). :/
@jeffreydwalter hey, unfortunately didn't have the time to check that solution yet. I'll get back to the Arlo soon and will definitely give it a shot. Thanks for the effort and the interest.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Hey @slobglob any update on this? I'd love to merge this in if it fixes the problems. Please let me know asap. Thanks!
Not yet, I'll be getting back to this in the next month or so. I'll keep you updated. Sorry for the delay.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
@slobglob hey man, you still alive? I just merged in the changes to use 1 event stream for multiple basestations. I no longer have any Arlo cameras, so if you're still work with Arlo stuff, I'd appreciate a little feedback about the change.
Hey,
Alive and kicking my friend. How have you been?
I don't have any arlos at the moment but we might work on that sometimes soon. Sorry I couldn't help. :)
What version of Python are you using (
python -V
)?What operating system and processor architecture are you using (
python -c 'import platform; print(platform.uname());'
)?Which Python packages do you have installed (run the
pip freeze
orpip3 freeze
command and paste output)?Which version of ffmpeg are you using (
ffmpeg -version
)?Which Arlo hardware do you have (camera types - [Arlo, Pro, Q, etc.], basestation model, etc.)?
Arlo Go
What did you do?
I'm trying to stream multiple cameras that are linked to the same account I'm using the example script
arlo-streamingvideo.py
to stream 2 (or more) Arlo Go cameras in parallel.The script itself doesn't stream the actual url anywhere, but I check to see if the logs make sense.
What did you expect to see?
What did you see instead?
The issue that I've noticed is related to the
EventStream
design, every Go camera (which is a basestation as well) initiates its ownEventStream
object on/subscribe
, and from my understanding and digging through the official Arlo site, the/subscribe
EventStream should be per logged in account (i.e. perArlo
object) and not per camera/basestation (correct me if I'm wrong). What happens with the current design is that the first camera (i.e.camera[0]
) is initiated (/startStream
) fine, when the 2nd camera (i.e.camera[1]
) is initiated (/startStream
) with its ownEventStream
i get alogout
action from the event on the firstEventStream
what makes the/notify
requests stop and eventually thertsps
url itself will be invalid thus making only the 2nd stream (camera[1]
) stay alive and streamable.If I'll add a 3rd camera to this flow, it'll do the same and cancel the 2nd camera.
I'm trying to modify library to support multiple cameras at once and hopefully to submit a PR, but still didn't get it right. I'm trying to see if it makes sense to separate the
sseclient
from the basestationEventStream
and have it perArlo
object. And theEventStream
for the basestation itself will take care of the heartbeat and the rest of the camera logic.Right now I'm just worried that I missed something and the original design is fine.
Does any of this makes sense?
Does this issue reproduce with the latest release?
Didn't check, but from the changes between the releases I think there will be no difference.