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

Snapshot capture

Open broyuken opened this issue 6 years ago • 5 comments

Now that ring has rolled out the snapshot capture feature, could that be added to the library to grab those images?

broyuken avatar Dec 24 '19 15:12 broyuken

if you look at https://github.com/tchellomello/python-ring-doorbell/issues/124 someone has implemented the feature you are after using pure REST requests...

The api does have a get_snapshot() method but I cant get that working.

asantaga avatar Dec 25 '19 12:12 asantaga

please change

    def get_snapshot(self, retries=3, delay=1):
        """Take a snapshot and download it"""
        url = API_URI + SNAPSHOT_TIMESTAMP_ENDPOINT
        payload = {"doorbot_ids": [self._attrs.get('id')]}
        self._ring.query(url, json=payload)
        request_time = time.time()
        for _ in range(retries):
            time.sleep(delay)
            response = self._ring.query(
                url, method="POST", json=payload, raw=1).json()
            #if response["timestamps"][0]["timestamp"] / 1000 > request_time:
            return self._ring.query(API_URI + SNAPSHOT_ENDPOINT.format(
                    self._attrs.get('id')), raw=True).content
        return False

example how to use

            doorbell = myring.doorbells[0] 
            while True:
                  snapshot = doorbell.get_snapshot()
                  if snapshot:
                     # logger.info("Updating snapshot...")
                     open(snapshot_filename, "wb").write(snapshot)
[...]

                     if kind== "motion":
                         sendTelegram(snapshot_filename, MOTION_CHAT)

                     if kind == "ding":
                        sendTelegram(snapshot_filename, DING_CHAT)

                     callXBMC()

                  time.sleep(10)

odenisenko-zz avatar Dec 29 '19 08:12 odenisenko-zz

Having tried this with a Ring Doorbell 2, it seems to me that the POST query method doesn't update the snapshot. It does get the timestamp of the latest snapshot and downloads it, but from what I can see it's just the most recent scheduled snapshot taken automatically by the doorbell.

tzbailey avatar Jan 03 '20 13:01 tzbailey

btw, now I have rcvd snapshot on my old AppleWatch. wow!

odenisenko-zz avatar Jan 06 '20 10:01 odenisenko-zz

I need to add this to my "archiver" script that downloads all video clips! Note to self, because still frames are awesome for later time lapse! Hope to try it out some time soon... Thanks for the added feature, hope it's working soon.

I am curious about the differences between:

  • Take a photo now and download?
  • Poll for list of $device $timespan images available?
  • Download $snapshot_by_id_from_poll? ** I am assuming the still frames use similar mechanics as video clips?

4Dolio avatar Jun 26 '20 05:06 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]