Skip to content

Prefer a reachable gateway address over the Powerwall's 192.168.90.x network - #230

Merged
Bre77 merged 1 commit into
mainfrom
fm/gw-addr-subnet-lib
Nov 17, 2026
Merged

Bre77 merged 1 commit into
mainfrom
fm/gw-addr-subnet-lib

Conversation

@Bre77

@Bre77 Bre77 commented Nov 16, 2026

Copy link
Copy Markdown
Member

find_gateway_address() picked the first of eth/wifi with active_route set, so on a two-Powerwall 3 site Tesla's reported ethernet address 192.168.90.2 (the Powerwall's own hotspot and inter-Powerwall network, with active_route true) was offered to Home Assistant instead of the reachable Wi-Fi address 192.168.1.252, and the local login timed out. It now takes an optional networks argument (IPv4 networks of the caller, as Home Assistant gets from its network adapters) and prefers an address inside one of them, then ethernet, then Wi-Fi, using a 192.168.90.0/24 address only when there is no other. active_route is no longer used: in that payload it was set on the unreachable interface, and in the single-Powerwall captures it only ever pointed away from a 192.168.90.x eth, which the new rule already skips. Calling it without networks keeps working, with ethernet then Wi-Fi.

@gitar-bot

gitar-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Gateway discovery ignores active_route and prefers caller-subnet interfaces; incomplete network data could still select an unreachable fallback address.

Changes find_gateway_address() to accept an optional networks argument and prefer a gateway address inside the caller's IPv4 networks, then ethernet, then Wi-Fi, using a 192.168.90.0/24 address only as a last resort. This fixes local login timeouts on two-Powerwall 3 sites where the unreachable 192.168.90.2 was selected. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Approved

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@gitar-bot gitar-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gitar has auto-approved this PR (configure)

@Bre77
Bre77 enabled auto-merge (squash) November 16, 2026 23:23
@Bre77
Bre77 disabled auto-merge November 17, 2026 01:42
@Bre77
Bre77 merged commit e0bd950 into main Nov 17, 2026
7 checks passed
@Bre77
Bre77 deleted the fm/gw-addr-subnet-lib branch November 17, 2026 01:43
@Bre77 Bre77 mentioned this pull request Nov 17, 2026
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