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

TriggerFullFrameSnapshot POST timeout #93

Open
jsm174 opened this issue Oct 29, 2018 · 30 comments
Open

TriggerFullFrameSnapshot POST timeout #93

jsm174 opened this issue Oct 29, 2018 · 30 comments

Comments

@jsm174
Copy link

jsm174 commented Oct 29, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Python are you using (python -V)?

Python 2.7.13

What operating system and processor architecture are you using (python -c 'import platform; print(platform.uname());')?

('Linux', 'raspberrypi', '4.14.71-v7+', '#1145 SMP Fri Sep 21 15:38:35 BST 2018', 'armv7l', '')

Which Python packages do you have installed (run the pip freeze or pip3 freeze command and paste output)?

arlo==1.1.8
certifi==2018.10.15
chardet==3.0.4
cryptography==1.7.1
enum34==1.1.6
gyp==0.1
idna==2.7
ipaddress==1.0.17
keyring==10.1
keyrings.alt==1.3
monotonic==1.5
pyasn1==0.1.9
pycrypto==2.6.1
pygobject==3.22.0
PySocks==1.6.8
pyxdg==0.25
requests==2.20.0
RPi.GPIO==0.6.3
SecretStorage==2.3.1
six==1.11.0
sseclient==0.0.19
urllib3==1.24

Which Arlo hardware do you have (camera types - [Arlo, Pro, Q, etc.], basestation model, etc.)?

VMC4030

What did you do?

I wrote a script to fetch my active cameras, take snapshots, and then send rich notifications via IFTTT.

I've noticed, that sometimes TriggerFullFrameSnapshot hangs and sits forever. Since TriggerAndHandleEvent has a 120 second timeout, I'm guessing, it's stuck in the POST?

    def TriggerFullFrameSnapshot(self, basestation, camera):

        def trigger(self):
            self.request.post("https://arlo.netgear.com/hmsweb/users/devices/fullFrameSnapshot", {"to":camera.get("parentId"),"from":self.user_id+"_web","resource":"cameras/"+camera.get("deviceId"),"action":"set","publishResponse":True,"transId":self.genTransId(),"properties":{"activityState":"fullFrameSnapshot"}}, headers={"xcloudId":camera.get("xCloudId")})

Looking at the requests module at http://docs.python-requests.org/en/master/user/advanced/#timeouts:

By default, requests do not time out unless a timeout value is set explicitly. Without a timeout, your code may hang for minutes or more.

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)

#!/usr/bin/python

#
#run every day at 10:30am, 6:30pm
#
#crontab -e
#
#30 10,18 * * * /home/pi/scripts/arlo.py
#

from Arlo import Arlo
from datetime import datetime

import json
import requests
import time

IFTTT_WEBHOOK_URL = "https://maker.ifttt.com/trigger/{{event_name}}/with/key/{{user_key}}"
IFTTT_EVENT_NAME = "arlo_snapshot"
IFTTT_USER_KEY = "<USER_KEY>"

ARLO_USERNAME = "<ARLO_USERNAME>"
ARLO_PASSWORD = "<ARLO_PASSWORD>"

def pp(data):
    print(json.dumps(data, indent=4, sort_keys=True))

try:
    arlo = Arlo(ARLO_USERNAME, ARLO_PASSWORD)

    basestation = arlo.GetDevices('basestation')[0]

    activeCameras = {};

    for camera in arlo.GetCameraState(basestation)['properties']:
       if camera['connectionState'] == 'available':
          activeCameras[camera['serialNumber']] = camera

    for camera in arlo.GetDevices('camera'):
       deviceId = camera['deviceId']

       if deviceId in activeCameras:
           camera['batteryLevel'] = str(activeCameras[deviceId]['batteryLevel']) + "%"

           print "Fetching snapshot for " + camera['deviceName'] + "..."

           try:
               snapshotUrl = arlo.TriggerFullFrameSnapshot(basestation, camera)

               print "Sending notification via IFTTT..."

               webhookUrl = IFTTT_WEBHOOK_URL.replace("{{event_name}}", IFTTT_EVENT_NAME).replace( "{{user_key}}", IFTTT_USER_KEY);

               currentTime = datetime.now().strftime("%Y-%m-%d %-I:%M:%S %p")

               payload = {
                   "value1": "Arlo Snapshot: " + camera['deviceName'],
                   "value2": "Time: " + currentTime + "\nBattery: " + camera['batteryLevel']  + "\nModel: " + camera['modelId'],
                   "value3": snapshotUrl
               }

               pp(payload)

               requests.post(webhookUrl, data = payload)

               print ""

           except Exception:
               print "Failed to fetch snapshot."

except Exception as e:
    print(e)

What did you expect to see?

What did you see instead?

Does this issue reproduce with the latest release?

@jeffreydwalter
Copy link
Owner

Hello @jsm174, thanks for raising this issue. I suspect what's happening is that the response message is either not getting sent to the EventStream, or it's being consumed somewhere.

If you don't mind, it would be helpful to put some logging in to see where we're hung.

I suspect that if you log something here, just before the continue, you'll see it's stuck in a loop in this case.

@jsm174
Copy link
Author

jsm174 commented Oct 31, 2018

@jeffreydwalter Thank you. I put a print where you specified but didn't see anything.

I turned on debug logging:

pi@raspberrypi ~/scripts % ./arlo.py
2018-10-30 21:21:48,760 [DEBUG] (MainThread) Starting new HTTPS connection (1): arlo.netgear.com:443
2018-10-30 21:21:49,402 [DEBUG] (MainThread) https://arlo.netgear.com:443 "POST /hmsweb/login/v2 HTTP/1.1" 200 None
2018-10-30 21:21:49,567 [DEBUG] (MainThread) https://arlo.netgear.com:443 "GET /hmsweb/users/devices HTTP/1.1" 200 None
Fetching camera state...
2018-10-30 21:21:49,969 [DEBUG] (MainThread) https://arlo.netgear.com:443 "GET /hmsweb/client/subscribe?token=TOKEN HTTP/1.1" 200 None
2018-10-30 21:21:49,990 [DEBUG] (MainThread) Starting new HTTPS connection (2): arlo.netgear.com:443
2018-10-30 21:21:50,731 [DEBUG] (MainThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/BASESTATION_SERIAL HTTP/1.1" 200 None
2018-10-30 21:21:51,524 [DEBUG] (MainThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/BASESTATION_SERIAL HTTP/1.1" 200 None
Fetching cameras...
2018-10-30 21:21:52,505 [DEBUG] (MainThread) https://arlo.netgear.com:443 "GET /hmsweb/users/devices HTTP/1.1" 200 None
Fetching snapshot for 151 SR - Driveway 1...
2018-10-30 21:21:52,794 [DEBUG] (MainThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/fullFrameSnapshot HTTP/1.1" 200 None
2018-10-30 21:22:21,532 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/BASESTATION_SERIAL HTTP/1.1" 200 None
2018-10-30 21:22:52,227 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/BASESTATION_SERIAL HTTP/1.1" 200 None
2018-10-30 21:23:23,022 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/BASESTATION_SERIAL HTTP/1.1" 200 16
2018-10-30 21:23:53,716 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/BASESTATION_SERIAL HTTP/1.1" 200 None
2018-10-30 21:24:24,528 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/BASESTATION_SERIAL HTTP/1.1" 200 None
2018-10-30 21:24:55,220 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/BASESTATION_SERIAL HTTP/1.1" 200 None
2018-10-30 21:25:26,027 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/BASESTATION_SERIAL HTTP/1.1" 200 None
2018-10-30 21:25:56,774 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/BASESTATION_SERIAL HTTP/1.1" 200 None
2018-10-30 21:26:27,539 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/BASESTATION_SERIAL HTTP/1.1" 200 None
2018-10-30 21:26:58,239 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/BASESTATION_SERIAL HTTP/1.1" 200 None
.
.
.

I have one camera that is pretty far from the basestation, so sometimes it becomes unavailable. I wonder if that is the cause.

@jeffreydwalter
Copy link
Owner

@jsm174 thanks for that feedback. It looks like the http request to trigger the snapshot succeeded. I'm pretty sure what's happening is that the EventStream message is either not being sent or is being grabbed by something else.

@jsm174
Copy link
Author

jsm174 commented Nov 6, 2018

Not sure this helps but... I have this running as a cron job that fires at 10:30am and 5:30pm.

If it gets stuck during the 10:30am run, when the 5:30pm run kicks off, the 10:30am will then finally fail for all remaining cameras.

I'm guessing, since it's a new process, it's re-logging in, which is closing the previous login.

@jeffreydwalter
Copy link
Owner

Yes, that is correct. Arlo only allows a single session at a time. This is because they use a publisher/subscriber model and it doesn't support broadcast messaging. i.e., if one consumer consumes the message none of the others will, so they don't allow it.

@jsm174
Copy link
Author

jsm174 commented Nov 6, 2018

Makes sense. I am seeing this consistently, with my furthest away camera. That's why in the script I was looking for cameras with 'available' connectionStates.

Maybe I should try to thread the TriggerFullFrameSnapshot calls.

@jeffreydwalter
Copy link
Owner

@jsm174 can you replace the HandleEvents function with this code:

    def HandleEvents(self, basestation, callback, timeout=120):
        if not callable(callback):
            raise Exception('The callback(self, event) should be a callable function!')

        basestation_id = basestation.get('deviceId')

        print("subscribing "+basestation_id)
        self.Subscribe(basestation)
        print("subscribed "+basestation_id)
        if basestation_id in self.event_streams and self.event_streams[basestation_id].connected and self.event_streams[basestation_id].registered:
            print("basestation found: "+basestation_id)
            while basestation_id in self.event_streams and self.event_streams[basestation_id].connected:
                print("while basestation connected: "+basestation_id)
                event = self.event_streams[basestation_id].Get(timeout=timeout)
                print(event)
                if event is None and not self.event_streams[basestation_id].event_stream_stop_event.is_set():
                    print("basestation is None: "+basestation_id)
                    return
                elif event is None:
                    print("basestation is stopped: "+basestation_id)
                    continue;

                # If this event has is of resource type "subscriptions", then it's a ping reply event.
                # For now, these types of events will be requeued, since they are generated in response to and expected as a reply by the Ping() method.
                # HACK: Take a quick nap here to give the Ping() method's thread a chance to get the queued event.
                if event.get('resource', '').startswith('subscriptions'):
                    print("subscribe (ping) event for basestation: "+basestation_id)
                    self.event_streams[basestation_id].queue.put(event)
                    time.sleep(0.05)
                else:
                    print("calling callback(event): "+basestation_id)
                    response = callback(self, event)
                    print("called callback(event): "+basestation_id)
                    # NOTE: Not ideal, but this allows you to look for a specific event and break if you want to return it.
                    if response is not None:
                        print("callback(event) returned response: "+basestation_id)
                        print(response)
                        return response
                    else:
                        print("callback(event) returned empty response: "+basestation_id)

@jsm174
Copy link
Author

jsm174 commented Nov 7, 2018

Thanks! I updated, and it's printing more logs.

I will let it run a bit and keep you posted.

2018-11-06 23:03:59,459 [INFO] (MainThread) Fetching snapshot for 151 SR - Driveway 1...
2018-11-06 23:03:59,785 [DEBUG] (MainThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/fullFrameSnapshot HTTP/1.1" 200 None
subscribing BASE_SERIAL
subscribed BASE_SERIAL
basestation found: BASE_SERIAL
while basestation connected: BASE_SERIAL
{u'resource': u'cameras/CAMERIA_SERIAL', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'BASE_SERIAL', u'transId': u'web!9c956d5d.c1bf8!1541563439460', u'properties': {u'activityState': u'fullFrameSnapshot'}}
calling callback(event): BASE_SERIAL
called callback(event): BASE_SERIAL
callback(event) returned empty response: BASE_SERIAL
while basestation connected: BASE_SERIAL
{u'action': u'is', u'resource': u'cameras/CAMERIA_SERIAL', u'transId': u'BASE_SERIAL!b2c66a36!1541563439719', u'from': u'BASE_SERIAL', u'properties': {u'dateStarted': -329819549, u'activityState': u'fullFrameSnapshot'}}
calling callback(event): BASE_SERIAL
called callback(event): BASE_SERIAL
callback(event) returned empty response: BASE_SERIAL
while basestation connected: BASE_SERIAL
{u'action': u'is', u'resource': u'cameras/CAMERIA_SERIAL', u'transId': u'BASE_SERIAL!5fd63227!1541563446940', u'from': u'BASE_SERIAL', u'properties': {u'dateStarted': -329812325, u'activityState': u'idle'}}
calling callback(event): BASE_SERIAL
called callback(event): BASE_SERIAL
callback(event) returned empty response: BASE_SERIAL
while basestation connected: BASE_SERIAL
{u'action': u'fullFrameSnapshotAvailable', u'resource': u'cameras/CAMERIA_SERIAL', u'transId': u'BASE_SERIAL!7b0f9621!1541563448770', u'from': u'BASE_SERIAL', u'properties': {u'presignedFullFrameSnapshotUrl': u'https://arlos3-prod-z2.s3.us-west-2.amazonaws.com/223544c7_9027_4dc8_9e56_0fae761c93b4/Q4UK-336-6678285/CAMERIA_SERIAL/fullFrameSnapshot.jpg?...'}}
calling callback(event): BASE_SERIAL
called callback(event): BASE_SERIAL
callback(event) returned response: BASE_SERIAL
https://arlos3-prod-z2.s3.us-west-2.amazonaws.com/223544c7_9027_4dc8_9e56_0fae761c93b4/Q4UK-336-6678285/CAMERIA_SERIAL/fullFrameSnapshot.jpg?...

@jeffreydwalter
Copy link
Owner

Awesome! Looks like the snapshot worked in the case you pasted. I'm definitely interested to see what it does in the failure case.

Thanks for your help!

@jsm174
Copy link
Author

jsm174 commented Nov 16, 2018

Sorry for the long delay, but it took a while for this to happen again.

On 11-14 at 5:30 pm the script kicked off. It got stuck on the first camera.

2018-11-14 18:30:03,214 [INFO] (MainThread) Fetching camera state...
2018-11-14 18:30:03,350 [DEBUG] (MainThread) https://arlo.netgear.com:443 "GET /hmsweb/client/subscribe?token={{TOKEN}} HTTP/1.1" 200 None
2018-11-14 18:30:03,361 [DEBUG] (MainThread) Starting new HTTPS connection (2): arlo.netgear.com:443
2018-11-14 18:30:04,163 [DEBUG] (MainThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:30:05,209 [DEBUG] (MainThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 16
2018-11-14 18:30:05,930 [INFO] (MainThread) Fetching cameras...
2018-11-14 18:30:06,077 [DEBUG] (MainThread) https://arlo.netgear.com:443 "GET /hmsweb/users/devices HTTP/1.1" 200 None
2018-11-14 18:30:06,082 [INFO] (MainThread) Fetching snapshot for 151 SR - Driveway 1...
2018-11-14 18:30:06,357 [DEBUG] (MainThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/fullFrameSnapshot HTTP/1.1" 200 None
2018-11-14 18:30:35,214 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:31:05,858 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 16
2018-11-14 18:31:36,657 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 16
2018-11-14 18:32:07,307 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:32:38,153 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:33:08,852 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 16
2018-11-14 18:33:39,711 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:34:10,407 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
subscribing {{BASE_STATION}}
subscribed {{BASE_STATION}}
basestation found: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'action': u'is', u'resource': u'cameras/4PY16977AB19F', u'transId': u'{{BASE_STATION}}!7cd32d31!1542238206473', u'from': u'{{BASE_STATION}}', u'properties': {u'batteryLevel': 49}}
calling callback(event): {{BASE_STATION}}
called callback(event): {{BASE_STATION}}
callback(event) returned empty response: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'cameras/4PY16977AB19F', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!61f61f9.442778!1542238206082', u'properties': {u'activityState': u'fullFrameSnapshot'}}
calling callback(event): {{BASE_STATION}}
called callback(event): {{BASE_STATION}}
callback(event) returned empty response: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'action': u'is', u'resource': u'cameras/4PY16977AB19F', u'transId': u'{{BASE_STATION}}!529a0a60!1542238207167', u'from': u'{{BASE_STATION}}', u'properties': {u'dateStarted': 344947877, u'activityState': u'fullFrameSnapshot'}}
calling callback(event): {{BASE_STATION}}
called callback(event): {{BASE_STATION}}
callback(event) returned empty response: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!f9b121e6.f2075!1542238234933', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/1d66ab7b-7be0-4db1-a76b-396aa4ecc88d', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!733966f0.0be758!1542238265586', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/b97ef970-ab3d-4dff-bf6d-a71cf9a0c63e', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'action': u'is', u'resource': u'cameras/4PY16977AB19F', u'transId': u'{{BASE_STATION}}!b993dd57!1542238267769', u'from': u'{{BASE_STATION}}', u'properties': {u'dateStarted': 345008504, u'activityState': u'idle'}}
calling callback(event): {{BASE_STATION}}
called callback(event): {{BASE_STATION}}
callback(event) returned empty response: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!24caa2c6.efb37!1542238357878', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/608a6fd4-338b-4443-a13a-8e9808a0bc73', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!1cc2fc63.d45a3!1542238388574', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/e4236555-f386-4e8f-8fbc-fc4d39a7cfa2', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!d665605e.4772f8!1542238419423', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/acee80ea-6145-4771-b2cc-51866dcde0b4', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'2018-11-14 18:34:41,202 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:35:11,899 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 16
2018-11-14 18:35:42,742 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:36:13,440 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:36:44,283 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:37:14,927 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:37:45,725 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:38:16,424 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 16
2018-11-14 18:38:47,169 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
from': u'{{BASE_STATION}}', u'transId': u'web!a15ca20e.12f1d!1542238450132', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/32eb5698-09e1-4411-8fd9-9224b4eabb1c', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!87aadf53.005848!1542238480929', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/a7f97350-29c9-4981-9eef-04bd483bc81c', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!adabc85.e0691!1542238511625', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/cb4164c9-5270-47e4-9c7d-6e90756bd243', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!8cec204b.39ae9!1542238542470', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/983cb5fd-fcc9-467f-97d2-88e7809546ef', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!aa36804c.5b0308!1542238573164', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/24cbbd13-b6bc-443c-a66d-bf529272ec67', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!72d80257.3d8ab8!1542238604012', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/c579b0aa-a317-4334-ba6b-59b0ac78df91', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!96dc03f3.d28c4!1542238634654', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/f84d31e4-d39b-45c9-9413-e95178747455', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!72c827f1.dd2b08!1542238665449', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/932ddf0e-7689-4fcb-8bff-0dea2ddddba9', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!9ca18eb0.9b164!1542238696147', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/3895cc46-406e-4480-97a2-8419b2a7c9ef', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/2018-11-14 18:39:17,863 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:39:48,708 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:40:19,362 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 16
2018-11-14 18:40:50,155 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:41:20,850 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 16
2018-11-14 18:41:51,744 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:42:22,439 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 16
2018-11-14 18:42:53,288 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!aa9ae58f.40a1e8!1542238726895', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/da4a10f8-0298-43d1-83c9-04ee34ed744c', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!d7b40bc7.7c9858!1542238757591', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/94ac5d0f-0893-4340-b624-10f13e03f7b9', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!4deb23fc.7f6bc8!1542238788435', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/11314c84-3d5d-4173-a8b6-e5a73566ac17', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!8fbca549.761488!1542238819079', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/492176a0-dc3d-4541-abd6-ce424a4b223e', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!8b9ead76.b814f!1542238849883', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/d938e699-e4ab-4a50-806f-71e95221033b', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!c980e8a8.50bb18!1542238880576', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/f9971833-3263-4171-8289-06b088148d02', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!fe23b031.09183!1542238911471', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/f0bdbfe0-547b-4007-8bf6-0c63200fcbb0', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!2cf531cd.3ba63!1542238942167', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/474390c3-4553-49d7-9c5e-d34285157296', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!18e68b57.bbe228!1542238973010', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/3469a2eb-3feb-4506-b8ca-c21cf94fc0b2', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: 42018-11-14 18:43:23,982 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:43:54,878 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:44:25,524 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:44:56,325 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:45:27,025 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:45:57,831 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:46:28,539 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:46:59,388 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-14 18:47:30,083 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None

This block repeated over and over until 5:01 am the next morning:

2018-11-15 05:01:16,699 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!e3e09c8.384418!1542275830487', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/a24f87c6-331f-46d9-825a-aca1cb1da7e3', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!29c73a50.e70fe8!1542275861127', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/4a73569e-fe4d-4881-925d-b58533d4c050', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!ac978aed.8b658!1542275891920', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/16060b80-85bc-4cd6-8a8d-a40413467b5f', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!75359c5a.601a1!1542275922569', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/41c9e980-273c-4125-836a-93e92841cbd1', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!8cd5193b.a8e8e8!1542275953365', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/a95c835f-7acb-400a-9629-9db8e7488b44', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!b5d82cc2.ec2568!1542275984059', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/12a44d10-971a-4411-9f8b-de535b2def00', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!d40a549e.8fdfc8!1542276015007', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/a79bcf3c-2324-4104-baae-ad434269a809', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!744c7ecc.dc8ec!1542276045642', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/016a8d1d-76e5-46c8-b15c-4ff21e79e3d6', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation connected: {{BASE_STATION}}
{u'resource': u'subscriptions/A65NNSM-336-38735975_web', u'to': u'A65NNSM-336-38735975_web', u'action': u'is', u'from': u'{{BASE_STATION}}', u'transId': u'web!df1505c4.67e49!1542276076427', u'properties': {u'url': u'https://vzweb21-prod.vz.netgear.com/hmsweb/publish/{{BASE_STATION}}/Q4UK-336-6678285/e941935e-9b10-4f68-8bb9-f1cfa43a343b', u'devices': [u'{{BASE_STATION}}']}}
subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation conne2018-11-15 05:01:46,072 [DEBUG] (EventStream) Resetting dropped connection: arlo.netgear.com
2018-11-15 05:01:47,392 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None
2018-11-15 05:01:48,173 [DEBUG] (EventStream) https://arlo.netgear.com:443 "GET /hmsweb/client/subscribe?token={{TOKEN}} HTTP/1.1" 200 None
2018-11-15 05:03:17,130 [INFO] (MainThread) Sending notification via IFTTT...
2018-11-15 05:03:17,132 [INFO] (MainThread) {
    "value1": "Arlo Snapshot: 151 SR - Driveway 1", 
    "value2": "Time: 2018-11-15 5:03:17 AM\nBattery: 50%\nModel: VMC4030", 
    "value3": null
}
2018-11-15 05:03:17,144 [DEBUG] (MainThread) Starting new HTTPS connection (1): maker.ifttt.com:443
2018-11-15 05:03:17,437 [DEBUG] (MainThread) https://maker.ifttt.com:443 "POST /trigger/arlo_snapshot/with/key/{{IFTTT_KEY}} HTTP/1.1" 200 53
2018-11-15 05:03:17,444 [INFO] (MainThread) 
2018-11-15 05:03:17,446 [INFO] (MainThread) Fetching snapshot for 151 SR - Driveway 2...
2018-11-15 05:03:17,719 [DEBUG] (MainThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/fullFrameSnapshot HTTP/1.1" 200 16
2018-11-15 05:03:23,719 [INFO] (MainThread) Sending notification via IFTTT...
2018-11-15 05:03:23,721 [INFO] (MainThread) {
    "value1": "Arlo Snapshot: 151 SR - Driveway 2", 
    "value2": "Time: 2018-11-15 5:03:23 AM\nBattery: 67%\nModel: VMC4030", 
    "value3": "https://arlos3-prod-z2.s3.us-west-2.amazonaws.com/223544c7_9027_4dc8_9e56_0fae761c93b4/Q4UK-336-6678285/{{CAMERA_SERIAL}}/fullFrameSnapshot.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20181115T100317Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86400&X-Amz-Credential=...&X-Amz-Signature=..."
}

It looks like the EventStream reset, and then the script continued processing.

@jeffreydwalter
Copy link
Owner

Thanks for sending that output!

Did you happen to open another connection to your Arlo account from anywhere? i.e., did you open the Arlo web or mobile app during that time?

@jsm174
Copy link
Author

jsm174 commented Nov 17, 2018

I created a separate account just for the script. Also when the connection reset it was ~5am, so I would have been sleeping.

@jeffreydwalter
Copy link
Owner

Okay, great. Just wanted to rule that out. Arlo is designed to only allow a single connection to the EventStream per account. So, logging in from two devices logs out the first one.

@jeffreydwalter
Copy link
Owner

Looks like your logs had some editing (from the above):

subscribe (ping) event for basestation: {{BASE_STATION}}
while basestation conne2018-11-15 05:01:46,072 [DEBUG] (EventStream) Resetting dropped connection: arlo.netgear.com
2018-11-15 05:01:47,392 [DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/{{BASE_STATION}} HTTP/1.1" 200 None

Do you happen to have the whole unedited log? It would be really helpful to see the full context.

@jsm174
Copy link
Author

jsm174 commented Nov 17, 2018

I did a search and replace for the serial #. As for the ‘conne2018’, that’s how the log was. Can I send the log through some other means?

@jeffreydwalter
Copy link
Owner

You should be able to drag/drop a .txt file with the logs: https://help.github.com/articles/file-attachments-on-issues-and-pull-requests/

@jsm174
Copy link
Author

jsm174 commented Nov 17, 2018

Ah, I meant not in a public forum, since it has serials, tokens, etc..

@jeffreydwalter
Copy link
Owner

jeffreydwalter commented Nov 17, 2018

So, what I noticed is that this event is missing:

{u'action': u'fullFrameSnapshotAvailable', u'resource': u'cameras/CAMERIA_SERIAL', u'transId': u'BASE_SERIAL!7b0f9621!1541563448770', u'from': u'BASE_SERIAL', u'properties': {u'presignedFullFrameSnapshotUrl': u'https://arlos3-prod-z2.s3.us-west-2.amazonaws.com/223544c7_9027_4dc8_9e56_0fae761c93b4/Q4UK-336-6678285/CAMERIA_SERIAL/fullFrameSnapshot.jpg?...'}}

One possibility is that there's a race condition happening because I do the POST to trigger the snapshot before the eventstream connection is made. That might mean the response event is being dropped.

@jeffreydwalter
Copy link
Owner

You can email it to me: [email protected]

@jeffreydwalter
Copy link
Owner

One thing I'm curious about. When it failed to send the fullFrameSnapshotAvailable event, did your camera actually take a snapshot?

@jsm174
Copy link
Author

jsm174 commented Nov 17, 2018

The snapshot url was null because when I got the push notification from ifttt, {{value3}} was empty.

I will send the logs shortly.

@jeffreydwalter
Copy link
Owner

Okay, the url was null, but did the camera actually take the snapshot?

@jeffreydwalter
Copy link
Owner

@jsm174 looking at the logs you emailed, and I see this error in the log:

{u'resource': u'cameras/XXXXXXXXXXX', u'to': u'XXXXXXXX-XXX-XXXXXXXX_web', u'error': {u'message': u'Invalid camera activity state change.: From userStreamActive to fullFrameSnapshot', u'code': 4006}, u'action': u'is', u'from': u'XXXXXXXXXXX', u'transId': u'web!6163ffa7.e90078!1542411036842', u'properties': {u'activityState': u'fullFrameSnapshot'}}

This occurs when the camera is streaming and you call TriggerFullFrameSnapshot. If you're trying to take a snapshot while the camera is streaming, you need to call TriggerStreamSnapshot.

@jsm174
Copy link
Author

jsm174 commented Nov 27, 2018

Just curious could that be if any other account is streaming?

Over the past week I can guarantee no account is streaming while trying to capture snapshots.

@jeffreydwalter
Copy link
Owner

Do you have multiple accounts tied to the same camera? If so, then I suppose that's a possibility. You might want to get the state of the camera to see if it's streaming or not and TriggerFullFrameSnapshot or TriggerStreamSnapshot depending on whether or not the camera is actively streaming.

jeffreydwalter pushed a commit that referenced this issue Jan 24, 2019
…ived within the initial 120s timeout.
@jeffreydwalter
Copy link
Owner

@jsm174 just pushed a fix for this issue. Please give it a try when you can and let me know how it goes. Thanks!

@jsm174
Copy link
Author

jsm174 commented Jan 25, 2019

@jeffreydwalter Thank you!

I installed it, and just gave it a test, but it's stuck at on the GetCameraState.

2019-01-25 08:31:05,574
2019-01-25 08:31:05,574 Arlo Snapshot Script
2019-01-25 08:31:05,575 2018-11-30 v1.2
2019-01-25 08:31:05,575
2019-01-25 08:31:07,587 Fetching camera connection states...

I'm not sure if it's on my end. (Since it's cold, I currently have 2 dead cams out of my 5).

I put the logging back on:

[INFO] (MainThread)
[INFO] (MainThread) Arlo Snapshot Script
[INFO] (MainThread) 2018-11-30 v1.2
[INFO] (MainThread)
[DEBUG] (MainThread) Starting new HTTPS connection (1): arlo.netgear.com:443
[DEBUG] (MainThread) https://arlo.netgear.com:443 "POST /hmsweb/login/v2 HTTP/1.1" 200 None
[DEBUG] (MainThread) https://arlo.netgear.com:443 "GET /hmsweb/users/devices HTTP/1.1" 200 None
[INFO] (MainThread) Fetching camera connection states...
[DEBUG] (MainThread) https://arlo.netgear.com:443 "GET /hmsweb/client/subscribe?token=***** HTTP/1.1" 200 None
[DEBUG] (MainThread) Starting new HTTPS connection (2): arlo.netgear.com:443
[DEBUG] (MainThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/4R01697WA011C HTTP/1.1" 200 16
[DEBUG] (MainThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/4R01697WA011C HTTP/1.1" 200 None
[DEBUG] (HeartbeatThread) https://arlo.netgear.com:443 "POST /hmsweb/users/devices/notify/4R01697WA011C HTTP/1.1" 200 None

Just for reference, the code is:

    logging.info("Fetching camera connection states...")

    for camera in arlo.GetCameraState(basestation)['properties']:
       logging.info("Camera " + camera['serialNumber'] + " connection state: " + camera['connectionState'])

@jeffreydwalter
Copy link
Owner

Hey, that was my bad. I didn't have my Arlo stuff hooked up, so I was not able to test. I ended up hooking everything back up and properly debugged it. Please give the latest a try.

@jsm174
Copy link
Author

jsm174 commented Jan 26, 2019

I put the latest latest code in. :) If I'm reading the code properly, it is a 120s timeout? If so, unfortunately, it is not timing out:

pi@raspberrypi ~/scripts % ./arlo.py
2019-01-25 19:45:48,372
2019-01-25 19:45:48,372 Arlo Snapshot Script
2019-01-25 19:45:48,373 2018-11-30 v1.2
2019-01-25 19:45:48,373
2019-01-25 19:45:49,312 Fetching camera connection states...
2019-01-25 19:45:52,485 Camera 4PY16******* connection state: batteryCritical
2019-01-25 19:45:52,486 Camera 4PY16******* connection state: batteryCritical
2019-01-25 19:45:52,487 Camera 4PY16******* connection state: available
2019-01-25 19:45:52,488 Camera 4PY16******* connection state: unavailable
2019-01-25 19:45:52,488 Camera 4XH37******* connection state: available
2019-01-25 19:45:52,489 Camera 4XH57******* connection state: available
2019-01-25 19:45:52,489 Fetching camera devices...
2019-01-25 19:45:52,651 Fetching snapshot for 151 SR - Backyard...

It is now 19:51 and still stuck.

@jeffreydwalter
Copy link
Owner

@jsm174 thanks for the feedback. That's a disappointment. :/ Will keep looking... If you happen to see where the code is hung, please let me know. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants