Coder Social home page Coder Social logo

Comments (22)

twrecked avatar twrecked commented on May 28, 2024

Do we know what build of pyaarlo this is? There were some base station modes fixes put in recently.

But also, I'll double check the code around the v2 mode setting. I know Arlo changed something recently which was causing the mode requests to fail in new and exciting ways.

from pyaarlo.

m0urs avatar m0urs commented on May 28, 2024

Do we know what build of pyaarlo this is? There were some base station modes fixes put in recently.

But also, I'll double check the code around the v2 mode setting. I know Arlo changed something recently which was causing the mode requests to fail in new and exciting ways.

Yes, it should be your most current master version ...

from pyaarlo.

m0urs avatar m0urs commented on May 28, 2024

Should fix for #40 fix also this issue (as the error sound similar): AttributeError: 'NoneType' object has no attribute 'get'?

UPDATE: Answer is: No :-) It did appear again today.

from pyaarlo.

twrecked avatar twrecked commented on May 28, 2024

I think Arlo changed something on their back end and it's finding some holes in my code.

What kind of camera is this?

from pyaarlo.

twrecked avatar twrecked commented on May 28, 2024

It was broke on mine too. It should be fixed by PR #47

Arlo changed their response to a mode change and I had to handle the new case.

from pyaarlo.

m0urs avatar m0urs commented on May 28, 2024

After updating my code to your current master, I do see now my script hanging while setting the modes. I do have a base station and two Arlo bridges which I do set this way:

<...>
       elif command == 'set-mode':
            if parameter1 == 'deaktiviert':
                base = getDeviceFromName("Home",arlo.base_stations)
                base.mode = 'disarmed'
                base = getDeviceFromName("Bridge_AZMichael",arlo.base_stations)
                base.mode = 'disarmed'
                base = getDeviceFromName("Bridge_AZSabine",arlo.base_stations)
                base.mode = 'disarmed'
<...>

getDeviceFromName() does get the base station object based on the name like:

def getDeviceFromName(name, devices):
    for device in devices:
        if device.name == name:
            return(device)
    return("")

It seems that changing the modes for a base station does still work as before. However, setting the mode of the bridge does lead to a hanging script for 60 seconds. It does set the mode of the bridge correctly but then "sleeps" for 60 seconds. Afterwards I can send another command again.

I attach a debug.log where I t
debug-encrypted.log
riedto arm the Bridge_AZMichael.

Could you please have a look? Let me know where I can help you ...

Thanks a lot!

from pyaarlo.

twrecked avatar twrecked commented on May 28, 2024

Can you add the following to pyaarlo.PyArlo and try again. It was missing some debug I need.

                      dump=True, verbose_debug=True

from pyaarlo.

m0urs avatar m0urs commented on May 28, 2024

I wil do that as soon as Arlo (Cloudflare) has whitelisted my IP again ;-) It seems that experimenting with the python script is something Cloudflare does not like ... Had that a few days ago also.

I saw that with these debugging parameters, my account details (user, password etc.) will be written to the debug log. That is something I would not like. Anything I can do?

I tried with "type ..\debug.log | python pyaarlo -u -p anonymize" but that does not work (2020-10-22 17:39:40,328:pyaarlo:ERROR: authentication failed)

Maybe it does not work as I am unable to login with these credentials?

from pyaarlo.

m0urs avatar m0urs commented on May 28, 2024

It seems that Cloudflare will block me as soon as I try to use the debug parameter you wrote above ... If I remove them again, I can login again. Seems to be strange, but I just tried it again on another machine with another IP as well ..

from pyaarlo.

twrecked avatar twrecked commented on May 28, 2024

The file is just plain text so you can delete the username/password from the file before passing them in pyaarlo. But I'll look at a way of blocking that debug or removing it from the anonymize.

edit: I just pushed a change that anonymizes the username and password.

from pyaarlo.

m0urs avatar m0urs commented on May 28, 2024

Thanks, I pulled the new version. However: I am still uanble to login if I add the two parameters. Maybe I did something wrong? This is the login line:

arlo = pyaarlo.PyArlo(username=username, password=password,tfa_source='imap', tfa_type='email', tfa_host=tfa_host, tfa_username=tfa_username, tfa_password=tfa_password, synchronous_mode=True, refresh_devices_every=3, dump=True, verbose_debug=True)

If I use this line, it works:

arlo = pyaarlo.PyArlo(username=username, password=password,tfa_source='imap', tfa_type='email', tfa_host=tfa_host, tfa_username=tfa_username, tfa_password=tfa_password, synchronous_mode=True, refresh_devices_every=3)

Update: Enclosed the debug log with the failed login.

debug-encrypted.log

from pyaarlo.

twrecked avatar twrecked commented on May 28, 2024

My bad. Try without dump=True

from pyaarlo.

m0urs avatar m0urs commented on May 28, 2024

This time it worked ;-) However I needed to anonymize some more things like the URLs pointing to the last image, the thumbnails etc. Hopefully I did not delete anything valuable.

debug-encrypted.log

from pyaarlo.

twrecked avatar twrecked commented on May 28, 2024

Found it. I'll fix it. It looks like there are 2 different returns possible for the mode command. I need to handle both.

from pyaarlo.

twrecked avatar twrecked commented on May 28, 2024

Can you try the master again?

from pyaarlo.

m0urs avatar m0urs commented on May 28, 2024

Thank you! This seems to work again now.

If there is a mode to change and the mode has been changed, a short time later something like this is printed out (for every device where the mode has been changed):

<RequestsCookieJar[Cookie(version=0, name='__cfduid', value= ........ comment=None, comment_url=None, rest={}, rfc2109=False)]>
Any idea where this is coming from? Can I suppress that somehow?

from pyaarlo.

twrecked avatar twrecked commented on May 28, 2024

Where there anything else on that line?

edit: Do you have an extra debug turned on?

from pyaarlo.

m0urs avatar m0urs commented on May 28, 2024

I shortened the line, means I deleted the part represented by "........". Start and end was exactly what you see above. I did not see anything else.

My debug code at the beginning of my script is:

# set up logging, change ERROR or INFO to DEBUG for a *lot* more information
logging.basicConfig(level=logging.ERROR,
                    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
                    filename='debug.log')
_LOGGER = logging.getLogger('arlo-fhem')

from pyaarlo.

twrecked avatar twrecked commented on May 28, 2024

How long after? I'm waiting 90 seconds and not seeing anything here.

from pyaarlo.

m0urs avatar m0urs commented on May 28, 2024

Only a few seconds.

from pyaarlo.

m0urs avatar m0urs commented on May 28, 2024

I created a minimal sample file with which I can reproduce the output I mentioned (the one starting with "<RequestsCookieJar...".

And I saw that there are errors reported as well, although setting the mode is successful (think these messages had formerly be written to the debug.log and I forgot to check that.

Be aware: The mentioned output does only appear if the mode is changed. So in my example, if the base station is already disarmed, the output does not happen.

And: If you leave out the sleep command, the output is also NOT written.

Here is my sample script:

#!/usr/bin/python3

import pyaarlo
import time

USERNAME = "user"
PASSWORD = "password"

##### Start Test Code ####

arlo = pyaarlo.PyArlo(username=USERNAME, password=PASSWORD, synchronous_mode=True)
base = arlo.base_stations[0]
base.mode = 'disarmed'
time.sleep(5)
arlo.stop()

This is the output generated:

attempt 1: error in response when setting mode=
{'59G1865E007ED': {'activeModes': ['mode0'],   
                   'activeSchedules': [],      
                   'timestamp': 1603532082481},
 'resource': 'activeAutomations'}
attempt 2: error in response when setting mode=
{'59G1865E007ED': {'activeModes': ['mode0'],   
                   'activeSchedules': [],      
                   'timestamp': 1603532082768},
 'resource': 'activeAutomations'}
attempt 3: error in response when setting mode=
{'59G1865E007ED': {'activeModes': ['mode0'],
                   'activeSchedules': [],
                   'timestamp': 1603532083002},
 'resource': 'activeAutomations'}
Failed to set mode.
<RequestsCookieJar[Cookie(version=0, name='__cfduid', .......................................... , domain='ocapi-app.arlo.com', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=1603532111, discard=False, comment=None, comment_url=None, rest={}, rfc2109=False)]>
file not written

from pyaarlo.

m0urs avatar m0urs commented on May 28, 2024

Besides the strange output the original crash nas no longer happened with the new version. So your fix seems to work!

from pyaarlo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.