briancmpbll / home_assistant_custom_envoy

177 stars 77 forks source link

Use ipv4 in zeroconf when core is using ipv4 address #110

Closed posixx closed 1 year ago

posixx commented 1 year ago

Currently the integration will autodetect an ipv6 address through zeroconf, even when the network is not configured for ipv6. Reasons: in homeassistant the main interface contains an ipv6 address even if you disable ipv6 through the Gui. Also the enphase envoy does expose an ipv6 address for autodiscovery; this cannot be disabled.

In order to have ipv4-only networks autodetect the correct ip, the zeroconf routine checks for an existing ipv4 address on the main interface of home assistant. If it finds one; the ipv6 detection is skipped so it correctly autodiscovers the ipv4 address, If homeassistant is configured to use ipv6 only, the ipv6 address will be autodiscovered.