Repository navigation
Prefer a reachable gateway address over the Powerwall's 192.168.90.x network - #230
Conversation
Code Review ✅ Approved 🟡 Medium riskGateway discovery ignores active_route and prefers caller-subnet interfaces; incomplete network data could still select an unreachable fallback address. Changes VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Approved For more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
find_gateway_address()picked the first ofeth/wifiwithactive_routeset, 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, withactive_routetrue) 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 optionalnetworksargument (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_routeis 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.xeth, which the new rule already skips. Calling it withoutnetworkskeeps working, with ethernet then Wi-Fi.