Skip to content

Warn and leave Powerwall gateway host blank when discovery fails - #987

Draft
Bre77 wants to merge 1 commit into
fm/pw-stack-basefrom
fm/pw-discovery-tests
Draft

Warn and leave Powerwall gateway host blank when discovery fails#987
Bre77 wants to merge 1 commit into
fm/pw-stack-basefrom
fm/pw-discovery-tests

Conversation

@Bre77

@Bre77 Bre77 commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Breaking change

Proposed change

The energy-site subentry flow discovers the local Powerwall gateway address via
find_gateway_address() before showing the credentials form. When discovery
returned no address or raised, the form defaulted the host to
DEFAULT_GATEWAY_HOST (192.168.91.1, the setup-AP address) and logged only at
debug — silently pointing the user at the wrong host for a normally-connected
gateway. The form now leaves the host field blank and logs a warning on both the
no-address and error paths, so the user enters the gateway host instead of
inheriting a misleading default.

The tests pin Home Assistant's side of the gateway-discovery contract at the
find_gateway_address() boundary, not the library's address decoding:

  • a discovered address pre-fills the credentials host default;
  • given a realistic two-interface networking_status, the resolved active-route
    LAN address is surfaced rather than the gateway-internal one (the interface
    selection itself is the library's responsibility);
  • both the None and exception (ClientError / TeslaFleetError) paths leave
    the field blank and emit a warning.

The fixture is Teslemetry-format networking_status (dotted-quad string
addresses; Tesla Fleet's own API serves uint32 ints), with all identifying
values replaced by synthetic ones.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

When gateway-address discovery returns no address or raises, the energy-site
credentials form defaulted the host to the setup-AP address, silently sending
users to the wrong host for a normally-connected gateway, and logged only at
debug. Leave the field blank and warn on both paths instead.

Add tests pinning the gateway-discovery contract at the find_gateway_address
boundary: a discovered address pre-fills the host, the active-route LAN address
(not the gateway-internal one) is surfaced, and both the None and exception
paths leave the field blank and warn.
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