From beb71de9632495f78086a54090f1c5c5d7d2411d Mon Sep 17 00:00:00 2001 From: Dev Nino Date: Sat, 13 Jun 2026 16:48:12 +0100 Subject: [PATCH] fix: don't block HA startup on first nmap scan Passing update_before_add=True to async_add_entities forces HA to await the first nmap scan before completing platform setup. On a /24 network this regularly takes 30s+, producing repeated 'Setup of sensor platform network_scanner is taking over 10 seconds' warnings (issue #35) and delaying overall HA startup (issue #41). Switch to update_before_add=False. The entity appears in unknown state and is populated on the first scheduled poll, which matches the user request in #41 ('scan in the background after HASS starts'). For a 15-minute SCAN_INTERVAL the wait is bounded and acceptable. Closes #41 Refs #35, #37 --- custom_components/network_scanner/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/network_scanner/sensor.py b/custom_components/network_scanner/sensor.py index 2edbbec..f002b6d 100644 --- a/custom_components/network_scanner/sensor.py +++ b/custom_components/network_scanner/sensor.py @@ -131,4 +131,4 @@ async def async_setup_entry(hass, config_entry, async_add_entities): # Set up the network scanner entity scanner = NetworkScanner(hass, ip_range, mac_mappings) - async_add_entities([scanner], True) + async_add_entities([scanner], False)