Skip to content

Conversation

@primmer10590
Copy link

Summary

When the Arlo API returns None from the active mode endpoint, update_mode() crashes with an AttributeError because it calls .get() on None. This causes a tight error loop that consumes excessive CPU.

Problem

AttributeError: 'NoneType' object has no attribute 'get'
  File "pyaarlo/location.py", line 158, in update_mode
    mode_id = data.get("properties", {}).get('mode')

This can happen when:

  • The Arlo API is temporarily unavailable
  • Network issues cause a failed request
  • The API returns an unexpected response

Solution

Add a None check before accessing data, consistent with the existing pattern used in update_modes() just below this function.

Testing

  • Tested with pyaarlo 0.8.0.17
  • Verified the fix prevents the error loop when the API returns None
  • Normal operation unaffected when API returns valid data

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant