From d4b985c66263e5caa14b707a54d068269f9d0a97 Mon Sep 17 00:00:00 2001 From: Paul Rimmer Date: Wed, 24 Dec 2025 05:54:47 +0000 Subject: [PATCH] Fix AttributeError in update_mode when API returns None Add None check before accessing data.get(), matching the existing pattern used in update_modes(). Prevents tight error loop and excessive CPU usage when Arlo API returns None. --- pyaarlo/location.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyaarlo/location.py b/pyaarlo/location.py index 8d6d21a..212e7ca 100644 --- a/pyaarlo/location.py +++ b/pyaarlo/location.py @@ -155,6 +155,9 @@ def update_mode(self): """Check and update the base's current mode.""" data = self._arlo.be.get(LOCATION_ACTIVEMODE_PATH_FORMAT.format(self._id), headers=self._extra_headers()) + if data is None: + self._arlo.error("failed to read active mode.") + return mode_id = data.get("properties", {}).get('mode') mode_revision = data.get("revision") self._save_and_do_callbacks(MODE_KEY, mode_id)