Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows to filter history by event kind: 'motion', 'on_demand', 'ding' #20

Merged
merged 2 commits into from Mar 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion ring_doorbell/__init__.py
Expand Up @@ -485,7 +485,7 @@ def existing_doorbell_type_duration(self, value):
return True
return None

def history(self, limit=30, timezone=None):
def history(self, limit=30, timezone=None, kind=None):
"""Return history with datetime objects."""
# allow modify the items to return
params = {'limit': str(limit)}
Expand All @@ -508,6 +508,10 @@ def history(self, limit=30, timezone=None):
entry['created_at'] = tz_dt
else:
entry['created_at'] = utc_dt

if kind:
return list(filter(lambda array: array['kind'] == kind, response))

return response

@property
Expand Down