Skip to content

Commit

Permalink
Fix Arlo Q not working with 0.48.1 (home-assistant#8446)
Browse files Browse the repository at this point in the history
* This change will enable the functionality for Arlo Q cameras. When we added the code to enable/disable motion detection, we assumed that base station will be present for all arlo type of cameras. But found recently that Arlo Q cameras does not have base station. So, removed the base_station dependency in the init code. Also added code in enable/disable motion detection code to first check if base station is detected by library. If base station is detected then it will use it to enable the motion detection. If not detected, even if service was called, it will not do anything.  Enabling/disabling the motion detection for Arlo Q cameras have to added by someone who has that camera.  I don't have the Arlo Q cameras.

* Fixed a typo in the code.
  • Loading branch information
viswa-swami authored and dethpickle committed Aug 18, 2017
1 parent 0a57e14 commit bdc5372
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions homeassistant/components/camera/arlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def __init__(self, hass, camera, device_info):
"""Initialize an Arlo camera."""
super().__init__()
self._camera = camera
self._base_stn = hass.data[DATA_ARLO].base_stations[0]
self._name = self._camera.name
self._motion_status = False
self._ffmpeg = hass.data[DATA_FFMPEG]
Expand Down Expand Up @@ -103,7 +102,16 @@ def motion_detection_enabled(self):

def set_base_station_mode(self, mode):
"""Set the mode in the base station."""
self._base_stn.mode = mode
# Get the list of base stations identified by library
base_stations = self.hass.data[DATA_ARLO].base_stations

# Some Arlo cameras does not have basestation
# So check if there is base station detected first
# if yes, then choose the primary base station
# Set the mode on the chosen base station
if base_stations:
primary_base_station = base_stations[0]
primary_base_station.mode = mode

def enable_motion_detection(self):
"""Enable the Motion detection in base station (Arm)."""
Expand Down

0 comments on commit bdc5372

Please sign in to comment.