Closed huberda closed 7 years ago
There was a race condition between the time I started the thread that manages the EventStream and me storing it in the event_streams dictionary.
Please try my latest commit (https://github.com/jeffreydwalter/arlo/commit/3bc7485b0cddfb8f5b21c2776f8811e8caead694) and let me know if you're still seeing the issue.
Thanks!
Looks like there's still an issue here.
@huberda I made a couple more changes and haven't seen anymore hanging. Please do comment here and let me know if you are still having any issues after my latest commit (5cd45db9dac390267b0f147aee10571ce44b5fb5). Thanks!
Hi Jeffrey,
looks much better now - thank you for your great support! Arlo.py is a really important component for my home-automation.
regards, Daniel
Hi Daniel,
I'm glad to hear it's working better. I basically only use my library for downloading and deleting videos, so I didn't really test that code too deeply. :)
Just out of curiosity, what all are you doing with your home automation?
No problem!
I started with home automation initial for home security, so all our windows/doors have some sensors, if one is opened. For motion detection inside and outside i added 5 internal and one external motion detection sensors. Now the setup has grown up. We added intelligent "smoke detectors" in all important rooms, several "power sockets", water detection sensors, temperature/humidity sensors and light controls. Then i started adding some third-party applications like Arlo.
What i am doing:
So what I needed Arlo.py for: We got two key chains for enabling/disabling the home security, which is working very well. Now I wanted to enable all 4 arlo cameras automatically by activation of the home security.
When I am leaving, the home-automation enables all window/door/motion contacts, shutdowns some power sockets, sometime enables the vacuum cleaner, and then sends an http-request to my apache webserver to turn-on the arlo cameras via your Arlo.py. The same happens the other way around when I am coming home -> turn off Arlo, turn on power sockets. This is great, because I have only to push one button, and not enabling arlo separately or via time schedule / geofence.
My problem was the race condition, because the http-requests where hanging in my apache until the request timeout was reached.This was an issue, because after pressing the button several times I had 5 requests which were hung in the webserver and the cameras keep running. For sure I am also using the download/delete function, at night all pictures/videos are move from the netgear-cloud to my qnap.
So I think this is a small overview...for sure there are several other programs running for home automation, but that's to much to describe ...;-)
Wow! That sounds really awesome. I've been interested in home automation for a while, but haven't really had the time to build out a platform.
I sporadically get issues with arming/disarming Arlo with the simple script below. The script runs in an endless loop during the Subscribe function. Normaly i am calling the script over a apache-webserver, but this doesnt matter, because the script also fails from cmd. Maybe this is realted to my python-env or is there anybody that can reproduce this error? Any suggestions?
Error: ./turn_off.py ^CTraceback (most recent call last): File "./turn_off.py", line 11, in
arlo.Disarm(basestation[0]['deviceId'], basestation[0]['xCloudId'])
File "/var/www/htdocs/netgear/arlo/Arlo.py", line 301, in Disarm
return self.NotifyAndGetResponse(device_id, xcloud_id, {"action":"set","resource":"modes","publishResponse":"true","properties":{"active":"mode0"}})
File "/var/www/htdocs/netgear/arlo/Arlo.py", line 274, in NotifyAndGetResponse
self.Subscribe(device_id, xcloud_id)
File "/var/www/htdocs/netgear/arlo/Arlo.py", line 213, in Subscribe
time.sleep(1)
KeyboardInterrupt
Script:
!/usr/bin/env python
from datetime import timedelta, date from Arlo import Arlo
USERNAME = 'XXXXXX' PASSWORD = 'XXXXXX'
try: arlo = Arlo(USERNAME, PASSWORD) basestation = [ device for device in arlo.GetDevices() if device['deviceType'] == 'basestation' ] arlo.Disarm(basestation[0]['deviceId'], basestation[0]['xCloudId']) print "Content-type: text/html\n\n"; except Exception as e: print e
Python-Version: Python 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118] on linux2 Type "help", "copyright", "credits" or "license" for more information.