Closed MadMellow closed 3 years ago
On further review, it appears that there is not a subsequent call to establish the event stream. So, I have not idea what's going on.
Your script is a little too convoluted for me. Have you tried the example scripts in the Wiki? Can you craft a simple script based on one of the example scripts that reproduces your issue?
You should NOT be reading from the underlying event queue of my Arlo library.
def checkEventQueue():
subscribed = True
while subscribed == True:
if arlo.event_stream.queue.empty() == False:
event = arlo.event_stream.queue.get()
repeve('event',str(event))
else:
time.sleep(.5)
You are basically "stealing" the events from the queue, which is why all the library calls are hanging... The Arlo API is async by nature (since it uses EventStream). I wrapped it up in a synchronous API to allow people to interact with it in a more familiar way. When you call one of the methods in my library, a message is POST
'd to the /notify
endpoint. That message includes an id which is included in the response message, which comes back via the EventStream. My library reads from the EventStream and queues all messages it receives. At the same time, in another thread, my code polls the queue looking for the response message with the same id. When it finds that message, it returns it to the caller of the synchronous method.
Hope that helps...
If you want to "subscribe" to some series of events, take a look at: https://github.com/jeffreydwalter/arlo/blob/master/examples/arlo-motiondetect.py
Thanks Jeff,
Yes, I am stealing the replies. It took me some digging to figure that out. I do want to see the replies, so I will disable "stealing" while processing other commands.
I had looked at motion detect as inspiration/example.
Thanks for your help.
Jeff,
I have stopped stealing replies, but I think I've found the root of my problems. In my testing I'm making calls which use NotifyAndGetResponse (NAGR) fairly often. If/when my calls overlap with the Heartbeat Ping it can set up a reentrance condition in NAGR.
I've added debug print statements and have seen NAGR get stuck spinning with the same tid -- which presents as a reentrance problem. I'm still learning Python but I'll see if I can get RLock to help.
You don't need to ping. The library does that for you already.
On Sat, Mar 6, 2021, 7:52 AM MadMellow notifications@github.com wrote:
Jeff,
I have stopped stealing replies, but I think I've found the root of my problems. In my testing I'm making calls which use NotifyAndGetResponse (NAGR) fairly often. If/when my calls overlap with the Heartbeat Ping it can set up a reentrance condition in NAGR.
I've added debug print statements and have seen NAGR get stuck spinning with the same tid -- which presents as a reentrance problem. I'm still learning Python but I'll see if I can get RLock to help.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jeffreydwalter/arlo/issues/165#issuecomment-791949139, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEKOBYNELSRCSCCSKQWGOLTCIXR7ANCNFSM4YRYOBHQ .
I realize that it pings all by itself, but it doesn't query the state of the camera(s), mode, or siren. I realize that events "should" pick that up, but only if all is stable.
You don't query for state change. Those events are pushed to the eventstream as they occur. If you want to trigger actions when those occur, then you need to follow the example in the script I referenced in my previous comment.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Please answer these questions before submitting your issue. Thanks!
Not sure if this is an issue, feature request, or just the way it works.
I'm attempting to use this code as a "helper" program for a HomeSeer plugin -- exposing the mode, siren, camera and motion to HomeSeer. My experience with Python is somewhat limited, but I do OK.
Everything works as expected (although I'm still baffled by RTSPS), except that I cannot use many of the synchronous calls while subscribed to the event stream. I assume this is because the event stream is already established, yet NotifyAndGetResponse attempts to reestablish the event stream. My guess is that this confuses the link.
Any chance of checking the state of the event stream before Subscribing?
What version of Python are you using (
python -V
)? 3.6 and 3.7What operating system and processor architecture are you using (
python -c 'import platform; print(platform.uname());'
)? both windows 10 and macOS CatalinaWhich Python packages do you have installed (run the
pip freeze
orpip3 freeze
command and paste output)?Paste your ouptut here
Which version of ffmpeg are you using (
ffmpeg -version
)?Paste your output here Irrelevent
Which Arlo hardware do you have (camera types - [Arlo, Pro, Q, etc.], basestation model, etc.)?
Old Arlo VMB4000r3
What did you do?
IT Professional until retirement. Home automation hobbiest for 10 years.
If possible, provide the steps you took to reproduce the issue. A complete runnable program is good. (don't include your user/password or any sensitive info)
Paste your output here Synchronous calls (such as getCameraState) hang forever.
What did you expect to see?
Paste your ouptut here
What did you see instead?
Paste your output here
Does this issue reproduce with the latest release?