Update enphase_envoy zeroconf checks to use stdlib ipaddress methods (#100624)

This commit is contained in:
J. Nick Koston 2023-09-20 09:49:16 +02:00 committed by GitHub
parent 7af62c35f5
commit 33f748493e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,7 +15,6 @@ from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PASSWORD, CONF_USERNA
from homeassistant.core import HomeAssistant, callback
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers.httpx_client import get_async_client
from homeassistant.util.network import is_ipv4_address
from .const import DOMAIN, INVALID_AUTH_ERRORS
@ -90,7 +89,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
self, discovery_info: zeroconf.ZeroconfServiceInfo
) -> FlowResult:
"""Handle a flow initialized by zeroconf discovery."""
if not is_ipv4_address(discovery_info.host):
if discovery_info.ip_address.version != 4:
return self.async_abort(reason="not_ipv4_address")
serial = discovery_info.properties["serialnum"]
self.protovers = discovery_info.properties.get("protovers")