From 5f982f9d363f5af31e8f646a9f63337128436bb9 Mon Sep 17 00:00:00 2001 From: WillCodeForCats <48533968+WillCodeForCats@users.noreply.github.com> Date: Tue, 18 Aug 2026 13:34:03 -0700 Subject: [PATCH] Fix incorrect use of 'or' comparison for ipaddress --- custom_components/solaredge_modbus_multi/helpers.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/custom_components/solaredge_modbus_multi/helpers.py b/custom_components/solaredge_modbus_multi/helpers.py index 92b4e0f0..7ca394e9 100644 --- a/custom_components/solaredge_modbus_multi/helpers.py +++ b/custom_components/solaredge_modbus_multi/helpers.py @@ -51,9 +51,7 @@ def update_accum(self, accum_value: int) -> None: def host_valid(host): """Return True if hostname or IP address is valid.""" try: - if ipaddress.ip_address(host).version == (4 or 6): - return True - + return ipaddress.ip_address(host).version in (4, 6) except ValueError: return DOMAIN_REGEX.match(host)