From 6fc96188d5b8b021e5ad7ef607f9d71a6205ff1a Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 27 Oct 2025 12:05:30 -0500 Subject: [PATCH] tweak --- esphome/components/network/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/network/__init__.py b/esphome/components/network/__init__.py index 22fc81d2df..502803da1e 100644 --- a/esphome/components/network/__init__.py +++ b/esphome/components/network/__init__.py @@ -13,7 +13,7 @@ network_ns = cg.esphome_ns.namespace("network") IPAddress = network_ns.class_("IPAddress") -def ip_address_literal(ip: str | None) -> cg.MockObj: +def ip_address_literal(ip: str | int | None) -> cg.MockObj: """Generate an IPAddress with compile-time initialization instead of runtime parsing. This function parses the IP address in Python during code generation and generates @@ -32,7 +32,7 @@ def ip_address_literal(ip: str | None) -> cg.MockObj: try: # Parse using Python's ipaddress module - ip_obj = ipaddress.ip_address(str(ip)) + ip_obj = ipaddress.ip_address(ip) except (ValueError, TypeError): pass else: