Skip to content

Fix bugs, add reauth/reconfigure flows, diagnostics and entity translations - #158

Open
LightD31 wants to merge 3 commits into
HarvsG:masterfrom
LightD31:pr3-fixes-reauth-diagnostics
Open

Fix bugs, add reauth/reconfigure flows, diagnostics and entity translations#158
LightD31 wants to merge 3 commits into
HarvsG:masterfrom
LightD31:pr3-fixes-reauth-diagnostics

Conversation

@LightD31

Copy link
Copy Markdown

Bug fixes

  • Sensor platform setup crash: the setup filter mutated the sensor list while iterating over it, and the uptime sensor raised KeyError when the router had not yet reported a system status (e.g. right after a router restart)
  • Interface type reporting: UNKNOWN2 duplicated UNKNOWN's enum value, making it an alias that list() excludes — so integer interface types >= 8 were mislabelled and type 12 raised IndexError. Replaced with an explicit int-to-member mapping with a safe fallback
  • Polling timer leak: the periodic timer was not cancelled on unload, so every reload of the entry stacked another 30s polling loop
  • Options never applied: the config entry update listener was not registered. The options flow is also slimmed down to consider_home only and no longer echoes credentials back to the user
  • Reauth never triggered: ConfigEntryAuthFailed raised inside a timer callback is not handled by Home Assistant, so a changed password left the integration silently broken
  • Log in once during setup instead of three times
  • Route tailscale_configured through the shared error handler so a timeout can no longer escape the update loop
  • Validate WireGuard client configs before building state, and stop logging their values (they contain private key material)
  • Remove a duplicate wireguard_connections property, @callback decorators wrongly applied to async methods, and dead code

New features

  • Reauth flow — a changed router password can be fixed from the UI instead of deleting and re-adding the integration (closes the Detect and create a re-configure entry if the password changes TODO)
  • Reconfigure flow for changing host/username/password
  • Diagnostics with credentials, MACs and SSIDs redacted

Polish

  • Entity names use translation keys (display names unchanged)
  • Sensors, switches and the reboot button report unavailable while the router is unreachable; device trackers keep consider_home semantics
  • Typed config entry (ConfigEntry[GLinetRouter]) and Platform enum
  • consider_home is stored in entry options for new entries, falling back to entry data for existing ones — no migration needed

claude added 3 commits July 26, 2026 21:43
This repository was started from a component template and some strings
still name the components it was copied from:

- pyproject.toml describes the project as the Google Home integration
- the prettier pre-commit hook excludes custom_components/google_home/
  manifest.json, a path that does not exist here, so glinet's
  manifest.json is not actually excluded
- button.py and switch.py carry Pi-hole module and function docstrings

No behaviour changes.
GLinetRouter dispatches signal_device_new when polling finds a client it
has not seen before (router.py:368), but device_tracker.async_setup_entry
never subscribed to it: it called update_router() once at setup and then
nothing again. Devices that joined the network later got no tracker
entity until the config entry was reloaded or Home Assistant restarted.

Connect update_router to the signal, unsubscribing on unload.
…ations

Bug fixes:
- Fix sensor platform setup crash: the setup filter mutated the sensor
  list while iterating over it, and the uptime sensor raised KeyError
  when the router had not yet reported a system status (e.g. right
  after a router restart)
- Fix interface type reporting: UNKNOWN2 duplicated UNKNOWN's enum value
  making it an alias excluded from list(), so integer interface types
  >= 8 were mislabelled and type 12 raised IndexError; replaced with an
  explicit int-to-member mapping with a safe fallback
- Cancel the periodic polling timer on unload; previously every reload
  of the entry stacked another 30s polling loop
- Register the config entry update listener so options changes actually
  apply; the options flow is slimmed down to consider_home only and no
  longer echoes credentials back to the user
- Trigger the reauth flow from the polling loop; ConfigEntryAuthFailed
  raised inside a timer callback is not handled by Home Assistant
- Log in once during setup instead of three times
- Route tailscale_configured through the shared error handler so a
  timeout can no longer escape the update loop
- Validate WireGuard client configs before building state and avoid
  logging their values (they contain private key material)
- Remove duplicate wireguard_connections property, wrong @callback
  decorators on async methods and dead code

New features:
- Reauth flow: a changed router password can now be fixed from the UI
  instead of deleting and re-adding the integration
- Reconfigure flow for changing host/username/password
- Diagnostics support with credentials, MACs and SSIDs redacted

Polish:
- Entity names now use translation keys (display names unchanged)
- Sensors, switches and the reboot button report unavailable while the
  router is unreachable (device trackers keep consider_home semantics)
- Typed config entry (ConfigEntry[GLinetRouter]) and Platform enum
- consider_home is stored in entry options for new entries, with
  fallback to entry data for existing ones (no migration needed)

The manifest version is left alone so the release version stays the
maintainer's call.
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.

2 participants