mirror of
https://github.com/home-assistant/core.git
synced 2025-07-12 07:47:08 +00:00
Update enphase_envoy zeroconf checks to use stdlib ipaddress methods (#100624)
This commit is contained in:
parent
7af62c35f5
commit
33f748493e
@ -15,7 +15,6 @@ from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PASSWORD, CONF_USERNA
|
|||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.data_entry_flow import FlowResult
|
from homeassistant.data_entry_flow import FlowResult
|
||||||
from homeassistant.helpers.httpx_client import get_async_client
|
from homeassistant.helpers.httpx_client import get_async_client
|
||||||
from homeassistant.util.network import is_ipv4_address
|
|
||||||
|
|
||||||
from .const import DOMAIN, INVALID_AUTH_ERRORS
|
from .const import DOMAIN, INVALID_AUTH_ERRORS
|
||||||
|
|
||||||
@ -90,7 +89,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
self, discovery_info: zeroconf.ZeroconfServiceInfo
|
self, discovery_info: zeroconf.ZeroconfServiceInfo
|
||||||
) -> FlowResult:
|
) -> FlowResult:
|
||||||
"""Handle a flow initialized by zeroconf discovery."""
|
"""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")
|
return self.async_abort(reason="not_ipv4_address")
|
||||||
serial = discovery_info.properties["serialnum"]
|
serial = discovery_info.properties["serialnum"]
|
||||||
self.protovers = discovery_info.properties.get("protovers")
|
self.protovers = discovery_info.properties.get("protovers")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user