Skip to content

Fix brightness-0 bug, KeyError guard, dead code, typo - #171

Open
ColinSummers wants to merge 5 commits into
schmittx:mainfrom
ColinSummers:fix/pp-pass-cleanup
Open

Fix brightness-0 bug, KeyError guard, dead code, typo#171
ColinSummers wants to merge 5 commits into
schmittx:mainfrom
ColinSummers:fix/pp-pass-cleanup

Conversation

@ColinSummers

Copy link
Copy Markdown

Summary

Code review pass found several issues:

  • api/eero.py:143 — bug: set_status_light_brightness(0) returned the bound method self.set_status_light_off instead of calling it (missing ()). Setting brightness to 0 silently did nothing.

  • __init__.py:401 — potential crash: conf_activity[network_id] used direct indexing while every other config lookup uses .get(). A network present in resources but missing from activity (possible for entries migrated from old config versions) would crash setup with KeyError.

  • __init__.py:575,583 — copy-paste docstrings: Both network and resource properties had "Return the state attributes." as their docstring.

  • api/__init__.py:284 — dead code: file.close() after a with block (already closed).

  • api/network.py:87 — typo: "Adblock dasy" → "Adblock day".

🤖 Generated with Claude Code

ColinSummers and others added 5 commits July 20, 2026 12:48
async_remove_device raises KeyError when the device has already been
removed from the registry (e.g. by a prior iteration of the cleanup
loop). Python 3.14's ReadOnlyDict.pop() surfaces this as an unhandled
exception, causing the entire integration setup to fail with
setup_error.

Wrap the call in try/except to handle the race gracefully.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix KeyError in device cleanup on Python 3.14
HA 2026.7 changed zone/person tracking to rely on the in_zones state
attribute. The old manual state/state_attributes approach doesn't set
in_zones, so zone.home reports 0 persons for router-based trackers.

BaseScannerEntity is the intended base class for connection-based
trackers — it derives state from is_connected and handles in_zones
automatically. The existing is_connected, source_type, ip_address,
mac_address, and hostname properties are exactly what it needs.

Closes #3

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix device tracker zone counting (HA 2026.7)
- api/eero.py:143: set_status_light_brightness(0) returned the bound
  method instead of calling it — added missing parentheses
- __init__.py:401: conf_activity[network_id] → .get(network_id, {})
  to guard against KeyError on migrated config entries
- __init__.py: fixed copy-pasted "Return the state attributes" docstrings
  on network and resource properties
- api/__init__.py:284: removed dead file.close() after with block
- api/network.py:87: "Adblock dasy" → "Adblock day"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mikesten added a commit to mikesten/home-assistant-eero that referenced this pull request Aug 12, 2026
…d code, typos

Adopted from ColinSummers via schmittx#171 (unmerged
upstream). Carries PR schmittx#169 (Python 3.14 device-cleanup KeyError) and
PR schmittx#170 (BaseScannerEntity for HA 2026.7+) in its history.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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