Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,15 @@ Listing devices linked to your account
myring.doorbells
[<RingDoorBell: Front Door>]

# All stickup cams
myring.stickup_cams
[<RingStickUpCam: Driveway>]

Playing with the attributes and functions
-----------------------------------------
.. code-block:: python

for dev in list(myring.chimes + myring.doorbells):
for dev in list(myring.stickup_cams + myring.chimes + myring.doorbells):

# refresh data
dev.update()
Expand Down
27 changes: 25 additions & 2 deletions ring_doorbell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def devices(self):
"""Return all devices."""
devs = {}
devs['chimes'] = self.chimes
devs['stickup_cams'] = self.stickup_cams
devs['doorbells'] = self.doorbells
return devs

Expand All @@ -215,6 +216,11 @@ def __devices(self, device_type):
lst = []
url = API_URI + DEVICES_ENDPOINT
try:
if device_type == 'stickup_cams':
req = self.query(url).get('stickup_cams')
for member in list((obj['description'] for obj in req)):
lst.append(RingStickUpCam(self, member))

if device_type == 'chime':
req = self.query(url).get('chimes')
for member in list((obj['description'] for obj in req)):
Expand All @@ -239,6 +245,11 @@ def chimes(self):
"""Return a list of RingDoorChime objects."""
return self.__devices('chime')

@property
def stickup_cams(self):
"""Return a list of RingStickUpCam objects."""
return self.__devices('stickup_cams')

@property
def doorbells(self):
"""Return a list of RingDoorBell objects."""
Expand Down Expand Up @@ -396,7 +407,6 @@ def test_sound(self, kind=KIND_DING):
self._ring.query(url, method='POST', extra_params={"kind": kind})
return True


class RingDoorBell(RingGeneric):
"""Implementation for Ring Doorbell."""

Expand Down Expand Up @@ -653,8 +663,21 @@ def volume(self, value):
self._ring.query(url, extra_params=params, method='PUT')
self.update()
return True

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace

@property
def connection_status(self):
"""Return connection status."""
return self._attrs.get('alerts').get('connection')


class RingStickUpCam(RingDoorBell):
"""Implementation for Ring RingStickUpCam."""

def __init__(self, ring, name):
super(RingDoorBell, self).__init__()
self._attrs = None
self._ring = ring
self.debug = self._ring.debug
self.family = 'stickup_cams'
self.name = name
self.update()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no newline at end of file