python-ring-doorbell icon indicating copy to clipboard operation
python-ring-doorbell copied to clipboard

Check_alerts() function not working

Open mrwhale opened this issue 7 years ago • 5 comments

Hopefully I'm just doing it wrong, but the check_alerts() function for the doorbell is not working for me

I have set up a ~7s loop, to check that function and get the alert details when one happens

from ring_doorbell import Ring
from ring_doorbell import RingDoorBell
from pprint import pprint
import time

myring = Ring('creds', "False", 'True','http://localhost/', 'True', 'ring_doorbell-session.cache')

while(True):
    obj2 = RingDoorBell(myring, 'Front Door')
    checker = obj2.check_alerts()
    print checker
    print obj2.battery_life
    time.sleep(2)

This runs and continues to print None and the battery life, after creating a motion event while this loop is running i get nothing

mrwhale avatar May 29 '18 01:05 mrwhale

this works for me, but what it does is simply tell u if a Ding or a Motion event was triggered last.. Checkout my code https://github.com/asantaga/alexashowRing/blob/master/alexaringdoor.py

asantaga avatar May 29 '18 22:05 asantaga

Thanks @asantaga looks like its just me then! I'll grab that snippet out of your code base there and try that

mrwhale avatar May 29 '18 23:05 mrwhale

Please @mrwhale let us know if that worked.

tchellomello avatar May 30 '18 01:05 tchellomello

Yeah so it seems that class doesn't like the check_alerts() method

from ring_doorbell import Ring
from ring_doorbell import RingDoorBell
myring = Ring('creds', "False", 'True','http://localhost/', 'True', 'ring_doorbell-session.cache')

while(True):
    print  RingDoorBell(myring, 'Front Door').check_alerts()
    print  myring.doorbells[1].check_alerts()

When an event happens ( A ring event in this case) i got

None
True

So it seems myring.doorbells[1].check_alerts() works but RingDoorBell(myring, 'Front Door').check_alerts() does not

mrwhale avatar May 30 '18 01:05 mrwhale

@mrwhale you may want to use return instead of print this may be causing your output to be none

kevnflores avatar Feb 16 '19 20:02 kevnflores

There hasn't been any activity on this issue recently. This issue has been automatically marked as stale because of that. It will be closed if no further activity occurs. Please make sure to update to the latest ring_doorbell version and check if that solves the issue. Thank you for your contributions.

github-actions[bot] avatar Apr 18 '24 18:04 github-actions[bot]