Conversation
…le_instance_allowed, strings cleanup Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Conduct complete code review for Python and Home Assistant best practices
Code quality improvements: robust error handling, HA best practices, stale translation cleanup
Mar 16, 2026
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.
Complete code review pass addressing fragile error detection, HA anti-patterns, dead code, and stale/missing translation keys.
coordinator.pystrerrorstring match withisinstance(exc, socket.gaierror)— the original check only caught one locale-specific DNS error message and missed others (e.g."Name or service not known")_LOGGER.warning()in all exception handlers —_LOGGERwas defined but never used; log messages now include host/username context for easier diagnosisPath('~', '.ssh', CONF_KNOWN_HOSTS)coincidentally worked (the constant value equals the filename) but was semantically wrong; replaced with the literal"known_hosts"config_flow.pysingle_instance_allowed = True— the HA-native class attribute for single-instance integrations; allows the framework to abort duplicate flows beforeasync_step_useris reached (HA ≥ 2024.x)hass.data.get(DOMAIN)redundant check — non-standard secondary guard that required# pylint: disable=no-member;_async_current_entries()is the correct HA patternlogging/_LOGGERstrings.json/translations/en.json/translations/de.jsonscript_fileservice field andscript_file_not_foundexception (feature was replaced byinput)passwordandinputservice fieldscommand_or_inputmessage: "script file" → "input"integration_not_set_upexception (used in__init__.pybut absent from all translation files)📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.