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

check_alerts was removed

Open nhet opened this issue 5 years ago • 5 comments

With one of the last checkins (#184) the check_alerts() function was removed. For example in doorbot.py. I currently use this for example like this: if poll_device.check_alerts() and poll_device.alert: dev = devs[poll_device.alert.get('doorbot_id')] I have not yet found a way to rewrite this.

nhet avatar Feb 27 '20 21:02 nhet

On the ring class there is either update_dings or update_data (internally calls update_dings), which stores data into ring.dings_data. I would imagine this should get you what you would need, since check_alerts was just hitting the dings endpoint.

ring = Ring(auth)
ring.update_dings()
print(ring.dings_data)

steve-gombos avatar Feb 28 '20 19:02 steve-gombos

I'm going to dig into this a little more later this evening, the session setup may be causing issues.

steve-gombos avatar Feb 28 '20 20:02 steve-gombos

So I am not super familiar with this endpoint, but from what I have researched this is basically a 1 time read event. If you have anything else polling ring, for example, the mobile app, HA integration, etc... then you would be competing with those to pull the events from the dings/active endpoint. I'm not sure how this would be resolved since it isn't guaranteed to grab the events.

I'll look into some other libraries to see what they are doing when I have some time.

steve-gombos avatar Feb 29 '20 16:02 steve-gombos

I also ran into this after updating my libraries. From what I found, you can now use update_dings() in combination with the active_alerts() function on the class ring_doorbell.Ring object. You'll need to parse the result of active_alerts() for the source of the alert. Seems to be working for me since replacing the code this morning.

Example without bothering to see where the alert came from:

    while True:
      myring.update_dings()
      if myring.active_alerts() != []:
        print("There was an alert!")
      time.sleep(5)

wdstorer avatar Mar 02 '20 16:03 wdstorer

So I am not super familiar with this endpoint, but from what I have researched this is basically a 1 time read event. If you have anything else polling ring, for example, the mobile app, HA integration, etc... then you would be competing with those to pull the events from the dings/active endpoint. I'm not sure how this would be resolved since it isn't guaranteed to grab the events.

That makes sense given my observations, whenever I attempted to run my downloads script in two locations one of them always gets knocked offline. And when I run just one instance of my download it still occasionally gets kicked before it finishes. Knowing there can only be a single session, perhaps it is my own phone app that is causing the download script to get kicked occasionally.... On that topic, ring allows you to share devices with other users, and I have been meaning to create a new account specifically for my script to use, and this might solve the parallelism issue. Hummm...

4Dolio avatar Mar 05 '20 04:03 4Dolio

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]