Repository navigation
Conversation
|
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. |
|
Thanks for putting this together — this is the missing upstream piece for home-assistant/core#155796. I pulled this branch and tested it locally on Python 3.9.6. The endpoint change and snapshot tests work, but the branch currently cannot import on Python 3.9 because Changing the import to the already-required compatibility package fixes it: from typing_extensions import deprecatedWith that change, the complete test suite passes on Python 3.9: 41 passed. The focused snapshot test also passes. It would be great to rebase/update this PR so the more reliable snapshot method can land; I am happy to prepare a replacement or follow-up PR if that would be easier. |
Fix for python 3.9 Co-authored-by: Thomas Gregg <thomas@gregg.de>
|
Hey @thomasgregg ! Thanks for looking over this. I accepted your change into the PR, looks like it should be mergable as-is (the last change on master looks to be older than the PR). LMK if anyone needs anything else from me! |
|
Thanks, Adam. The updated PR is mergeable and the tests pass. @sdb9696, when you have a chance, could you review this? It is the remaining upstream dependency for home-assistant/core#155796. |
|
Hi @joostlek. You prepared the latest ring-doorbell release, and this PR is currently mergeable but waiting for a maintainer review. Would you be able to review it or point us to someone with merge access? It unblocks home-assistant/core#155796. |
Upstream python-ring-doorbell has had no merges for months; this takes what its open pull requests offer, adapted to this fork: - WebRTC: _close() no longer awaits its own reader task when the stream closes from inside it (upstream python-ring-doorbell#548, python-ring-doorbell#534). - New RingDoorBell.async_take_snapshot(): one request that returns a stored snapshot newer than max_age or captures a fresh one, via the endpoint ring-mqtt uses (upstream python-ring-doorbell#528). Existing snapshot methods are unchanged. - Outdoor Cam Plus reports a battery from its health data when it says either way, so plug-in variants no longer get one; a camera whose battery died reports nothing and keeps it (upstream python-ring-doorbell#538, reworked). - Device kinds: Battery Doorbell Pro 4K, Wired Doorbell Plus (2nd Gen), Wired Doorbell (doorbell_tahoe), Doorbell (2nd Gen) cocoa_doorbell_v3, Indoor Cam Plus, Spotlight Cam Pro 4K, Elite Cam 140/360 4K and Chime (2nd Gen) (upstream python-ring-doorbell#553, python-ring-doorbell#539, python-ring-doorbell#536, python-ring-doorbell#531, python-ring-doorbell#550). Co-authored-by: Niels Haagsman <haagsman@gmail.com> Co-authored-by: Adam Reeve <adam@adamreeve.com> Co-authored-by: danielcolquitt <daniel@colquitt.xyz> Co-authored-by: Tom Roberts <tom@tomroberts.co.uk> Co-authored-by: ben79 <benjaminfearnley@gmail.com> Co-authored-by: Aaron Wolen <aaron@wolen.com> Co-authored-by: Yoan <yoan.cousin@proton.me>
Upstream python-ring-doorbell has had no merges for months; this takes what its open pull requests offer, adapted to this fork: - WebRTC: _close() no longer awaits its own reader task when the stream closes from inside it (upstream python-ring-doorbell#548, python-ring-doorbell#534). - New RingDoorBell.async_take_snapshot(): one request that returns a stored snapshot newer than max_age or captures a fresh one, via the endpoint ring-mqtt uses (upstream python-ring-doorbell#528). Existing snapshot methods are unchanged. - Outdoor Cam Plus reports a battery from its health data when it says either way, so plug-in variants no longer get one; a camera whose battery died reports nothing and keeps it (upstream python-ring-doorbell#538, reworked). - Device kinds: Battery Doorbell Pro 4K, Wired Doorbell Plus (2nd Gen), Wired Doorbell (doorbell_tahoe), Doorbell (2nd Gen) cocoa_doorbell_v3, Indoor Cam Plus, Spotlight Cam Pro 4K, Elite Cam 140/360 4K and Chime (2nd Gen) (upstream python-ring-doorbell#553, python-ring-doorbell#539, python-ring-doorbell#536, python-ring-doorbell#531, python-ring-doorbell#550). Co-authored-by: Niels Haagsman <haagsman@gmail.com> Co-authored-by: Adam Reeve <adam@adamreeve.com> Co-authored-by: danielcolquitt <daniel@colquitt.xyz> Co-authored-by: Tom Roberts <tom@tomroberts.co.uk> Co-authored-by: ben79 <benjaminfearnley@gmail.com> Co-authored-by: Aaron Wolen <aaron@wolen.com> Co-authored-by: Yoan <yoan.cousin@proton.me>
Upstream python-ring-doorbell has had no merges for months; this takes what its open pull requests offer, adapted to this fork: - WebRTC: _close() no longer awaits its own reader task when the stream closes from inside it (upstream python-ring-doorbell#548, python-ring-doorbell#534). - New RingDoorBell.async_take_snapshot(): one request that returns a stored snapshot newer than max_age or captures a fresh one, via the endpoint ring-mqtt uses (upstream python-ring-doorbell#528). Existing snapshot methods are unchanged. - Outdoor Cam Plus reports a battery from its health data when it says either way, so plug-in variants no longer get one; a camera whose battery died reports nothing and keeps it (upstream python-ring-doorbell#538, reworked). - Device kinds: Battery Doorbell Pro 4K, Wired Doorbell Plus (2nd Gen), Wired Doorbell (doorbell_tahoe), Doorbell (2nd Gen) cocoa_doorbell_v3, Indoor Cam Plus, Spotlight Cam Pro 4K, Elite Cam 140/360 4K and Chime (2nd Gen) (upstream python-ring-doorbell#553, python-ring-doorbell#539, python-ring-doorbell#536, python-ring-doorbell#531, python-ring-doorbell#550). Co-authored-by: Niels Haagsman <haagsman@gmail.com> Co-authored-by: Adam Reeve <adam@adamreeve.com> Co-authored-by: danielcolquitt <daniel@colquitt.xyz> Co-authored-by: Tom Roberts <tom@tomroberts.co.uk> Co-authored-by: ben79 <benjaminfearnley@gmail.com> Co-authored-by: Aaron Wolen <aaron@wolen.com> Co-authored-by: Yoan <yoan.cousin@proton.me>
Upstream python-ring-doorbell has had no merges for months; this takes what its open pull requests offer, adapted to this fork: - WebRTC: _close() no longer awaits its own reader task when the stream closes from inside it (upstream python-ring-doorbell#548, python-ring-doorbell#534). - New RingDoorBell.async_take_snapshot(): one request that returns a stored snapshot newer than max_age or captures a fresh one, via the endpoint ring-mqtt uses (upstream python-ring-doorbell#528). Existing snapshot methods are unchanged. - Outdoor Cam Plus reports a battery from its health data when it says either way, so plug-in variants no longer get one; a camera whose battery died reports nothing and keeps it (upstream python-ring-doorbell#538, reworked). - Device kinds: Battery Doorbell Pro 4K, Wired Doorbell Plus (2nd Gen), Wired Doorbell (doorbell_tahoe), Doorbell (2nd Gen) cocoa_doorbell_v3, Indoor Cam Plus, Spotlight Cam Pro 4K, Elite Cam 140/360 4K and Chime (2nd Gen) (upstream python-ring-doorbell#553, python-ring-doorbell#539, python-ring-doorbell#536, python-ring-doorbell#531, python-ring-doorbell#550). Co-authored-by: Niels Haagsman <haagsman@gmail.com> Co-authored-by: Adam Reeve <adam@adamreeve.com> Co-authored-by: danielcolquitt <daniel@colquitt.xyz> Co-authored-by: Tom Roberts <tom@tomroberts.co.uk> Co-authored-by: ben79 <benjaminfearnley@gmail.com> Co-authored-by: Aaron Wolen <aaron@wolen.com> Co-authored-by: Yoan <yoan.cousin@proton.me>
Upstream python-ring-doorbell has had no merges for months; this takes what its open pull requests offer, adapted to this fork: - WebRTC: _close() no longer awaits its own reader task when the stream closes from inside it (upstream python-ring-doorbell#548, python-ring-doorbell#534). - New RingDoorBell.async_take_snapshot(): one request that returns a stored snapshot newer than max_age or captures a fresh one, via the endpoint ring-mqtt uses (upstream python-ring-doorbell#528). Existing snapshot methods are unchanged. - Outdoor Cam Plus reports a battery from its health data when it says either way, so plug-in variants no longer get one; a camera whose battery died reports nothing and keeps it (upstream python-ring-doorbell#538, reworked). - Device kinds: Battery Doorbell Pro 4K, Wired Doorbell Plus (2nd Gen), Wired Doorbell (doorbell_tahoe), Doorbell (2nd Gen) cocoa_doorbell_v3, Indoor Cam Plus, Spotlight Cam Pro 4K, Elite Cam 140/360 4K and Chime (2nd Gen) (upstream python-ring-doorbell#553, python-ring-doorbell#539, python-ring-doorbell#536, python-ring-doorbell#531, python-ring-doorbell#550). Co-authored-by: Niels Haagsman <haagsman@gmail.com> Co-authored-by: Adam Reeve <adam@adamreeve.com> Co-authored-by: danielcolquitt <daniel@colquitt.xyz> Co-authored-by: Tom Roberts <tom@tomroberts.co.uk> Co-authored-by: ben79 <benjaminfearnley@gmail.com> Co-authored-by: Aaron Wolen <aaron@wolen.com> Co-authored-by: Yoan <yoan.cousin@proton.me>
Resolves #527
This PR replaces the implementation of
async_get_snapshotwith a call to the same snapshot endpoint used by ring-mqtt. This endpoint essentially does a search query, you can pass in a "must be after" timestamp, and if an image already exists that is younger than that it will be returned. Otherwise, if theforceflag is set, a new image will be generated on the fly and returned, provided the timeout doesn't elapse. This removes the need to make multiple API calls, and the fail/retry logic of the old method.I wasn't sure how you like to handle API changes (as the parameters are quite different given this code works differently) - I elected to mark the old one deprecated and create a whole new method. But if you prefer to just replace the old one with the same name and flag a breaking change in the release notes I'm happy to make that update. I also added some basic tests.
LMK if you have questions/comments :)