From 95957b290c1c93031c29bd596196f51eda164b85 Mon Sep 17 00:00:00 2001 From: Cobra Date: Tue, 14 Apr 2026 14:25:32 -0400 Subject: [PATCH] Any enrolled non-infrastructure device marks location as occupied --- net_alerter/net_alerter.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/net_alerter/net_alerter.py b/net_alerter/net_alerter.py index 908f12a..cf9f458 100644 --- a/net_alerter/net_alerter.py +++ b/net_alerter/net_alerter.py @@ -889,14 +889,14 @@ def _update_occupancy_state_unlocked() -> None: """ global location_occupancy - # Count active personal devices (in known_devices, not marked departing) - active_personal_count = 0 + # Count active enrolled devices that are not infrastructure (in known_devices, not marked departing, not infrastructure IP) + active_enrolled_count = 0 for mac, dev in known_devices.items(): - if not dev.get('departing', False) and is_personal_device(mac): - active_personal_count += 1 + if not dev.get('departing', False) and dev['ip'] not in infrastructure_ips: + active_enrolled_count += 1 # Determine new occupancy state - new_occupancy = "OCCUPIED" if active_personal_count > 0 else "VACANT" + new_occupancy = "OCCUPIED" if active_enrolled_count > 0 else "VACANT" # Fire alert on transitions (but not UNKNOWN → OCCUPIED on startup) if new_occupancy != location_occupancy: @@ -908,7 +908,7 @@ def _update_occupancy_state_unlocked() -> None: logging.debug(f"Suppressing startup occupancy alert: UNKNOWN → OCCUPIED") location_occupancy = new_occupancy - logging.info(f"Location occupancy updated to {location_occupancy} ({active_personal_count} personal devices active)") + logging.info(f"Location occupancy updated to {location_occupancy} ({active_enrolled_count} enrolled non-infra devices active)") def update_occupancy_state() -> None: