Fix bugs, add reauth/reconfigure flows, diagnostics and entity translations - #158
Open
LightD31 wants to merge 3 commits into
Open
Fix bugs, add reauth/reconfigure flows, diagnostics and entity translations#158LightD31 wants to merge 3 commits into
LightD31 wants to merge 3 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug fixes
KeyErrorwhen the router had not yet reported a system status (e.g. right after a router restart)UNKNOWN2duplicatedUNKNOWN's enum value, making it an alias thatlist()excludes — so integer interface types >= 8 were mislabelled and type 12 raisedIndexError. Replaced with an explicit int-to-member mapping with a safe fallbackconsider_homeonly and no longer echoes credentials back to the userConfigEntryAuthFailedraised inside a timer callback is not handled by Home Assistant, so a changed password left the integration silently brokentailscale_configuredthrough the shared error handler so a timeout can no longer escape the update loopwireguard_connectionsproperty,@callbackdecorators wrongly applied to async methods, and dead codeNew features
Detect and create a re-configure entry if the password changesTODO)Polish
consider_homesemanticsConfigEntry[GLinetRouter]) andPlatformenumconsider_homeis stored in entry options for new entries, falling back to entry data for existing ones — no migration needed