diff --git a/custom_components/intesishome_local/config_flow.py b/custom_components/intesishome_local/config_flow.py index 5479fae..39565e6 100644 --- a/custom_components/intesishome_local/config_flow.py +++ b/custom_components/intesishome_local/config_flow.py @@ -29,11 +29,11 @@ async def _test_device_connection(self, host: str) -> bool: try: async with async_timeout.timeout(2): async with aiohttp.request('HEAD', f"http://{host}", raise_for_status=False) as response: - if response.status != 200: - _LOGGER.error("Device at %s is not responding (HTTP %s)", host, response.status) + if response.status == 200: + _LOGGER.info("Successfully connected to device at %s", host) + return True + _LOGGER.error("Device at %s is not responding (HTTP %s)", host, response.status) return False - _LOGGER.info("Successfully connected to device at %s", host) - return True except Exception as ex: _LOGGER.error("Failed to connect to device at %s: %s", host, str(ex)) return False