Arlo - Fixes for updated library (#9892)
* Reduce update calls to API. Add signal strength monitor. * Fix lint errors * Fix indent * Update pyarlo version and review fixes * Fix lint errors * Remove staticmethod * Clean up attributes * Update arlo.py
This commit is contained in:
1 parent
c7b0f25eae
commit
c2d0c8fba4
4 files changed
+39
-24
No files matched your search
@@ -29,7 +29,8 @@ SENSOR_TYPES = {
|
||||
'last_capture': ['Last', None, 'run-fast'],
|
||||
'total_cameras': ['Arlo Cameras', None, 'video'],
|
||||
'captured_today': ['Captured Today', None, 'file-video'],
|
||||
'battery_level': ['Battery Level', '%', 'battery-50']
|
||||
'battery_level': ['Battery Level', '%', 'battery-50'],
|
||||
'signal_strength': ['Signal Strength', None, 'signal']
|
||||
}
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
@@ -97,6 +98,16 @@ class ArloSensor(Entity):
|
||||
|
||||
def update(self):
|
||||
"""Get the latest data and updates the state."""
|
||||
try:
|
||||
base_station = self._data.base_station
|
||||
except (AttributeError, IndexError):
|
||||
return
|
||||
|
||||
if not base_station:
|
||||
return
|
||||
|
||||
base_station.refresh_rate = SCAN_INTERVAL.total_seconds()
|
||||
|
||||
self._data.update()
|
||||
|
||||
if self._sensor_type == 'total_cameras':
|
||||
@@ -114,7 +125,13 @@ class ArloSensor(Entity):
|
||||
|
||||
elif self._sensor_type == 'battery_level':
|
||||
try:
|
||||
self._state = self._data.get_battery_level
|
||||
self._state = self._data.battery_level
|
||||
except TypeError:
|
||||
self._state = None
|
||||
|
||||
elif self._sensor_type == 'signal_strength':
|
||||
try:
|
||||
self._state = self._data.signal_strength
|
||||
except TypeError:
|
||||
self._state = None
|
||||
|
||||
@@ -128,7 +145,8 @@ class ArloSensor(Entity):
|
||||
|
||||
if self._sensor_type == 'last_capture' or \
|
||||
self._sensor_type == 'captured_today' or \
|
||||
self._sensor_type == 'battery_level':
|
||||
self._sensor_type == 'battery_level' or \
|
||||
self._sensor_type == 'signal_strength':
|
||||
attrs['model'] = self._data.model_id
|
||||
|
||||
return attrs
|
||||
Reference in new issue
Block a user