Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #62 from tchellomello/base_attributes
Browse files Browse the repository at this point in the history
Introduced refresh_rate as property
  • Loading branch information
tchellomello authored Oct 25, 2017
2 parents ff85369 + 3a94ddc commit b58564e
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions pyarlo/base_station.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
class ArloBaseStation(object):
"""Arlo Base Station module implementation."""

def __init__(self, name, attrs, session_token, arlo_session):
def __init__(self, name, attrs, session_token, arlo_session,
refresh_rate=REFRESH_RATE):
"""Initialize Arlo Base Station object.
:param name: Base Station name
:param attrs: Attributes
:param session_token: Session token passed by camera class
:param arlo_session: PyArlo shared session
:param refresh_rate: Attributes refresh rate. Defaults to 15
"""
self.name = name
self._attrs = attrs
Expand All @@ -32,7 +34,7 @@ def __init__(self, name, attrs, session_token, arlo_session):
self._available_mode_ids = None
self._camera_properties = None
self._last_refresh = None
self._refresh_rate = REFRESH_RATE
self._refresh_rate = refresh_rate
self.__sseclient = None
self.__subscribed = False
self.__events = []
Expand Down Expand Up @@ -245,6 +247,22 @@ def xcloud_id(self):
"""Return X-Cloud-ID attribute."""
return self._attrs.get('xCloudId')

@property
def last_refresh(self):
"""Return last_refresh attribute."""
return self._last_refresh

@property
def refresh_rate(self):
"""Return refresh_rate attribute."""
return self._refresh_rate

@refresh_rate.setter
def refresh_rate(self, value):
"""Override the refresh_rate attribute."""
if isinstance(value, (int, float)):
self._refresh_rate = value

@property
def available_modes(self):
"""Return list of available mode names."""
Expand Down

0 comments on commit b58564e

Please sign in to comment.