From bdc5372c6aa67a6fd9f0642f06d354a3062a125f Mon Sep 17 00:00:00 2001 From: viswa-swami Date: Wed, 12 Jul 2017 02:25:55 -0400 Subject: [PATCH] Fix Arlo Q not working with 0.48.1 (#8446) * 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. --- homeassistant/components/camera/arlo.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/camera/arlo.py b/homeassistant/components/camera/arlo.py index 637b0dfc2e635..80833e34b207e 100644 --- a/homeassistant/components/camera/arlo.py +++ b/homeassistant/components/camera/arlo.py @@ -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] @@ -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)."""