Schedule a post-connection ping sweep to refresh network data.
(self, ssid)
| 348 | First-time establishment (no active network yet) propagates immediately |
| 349 | so the per-network DB switches before the next scan cycle. Subsequent |
| 350 | *changes* between known SSIDs are debounced: a transient misread of |
| 351 | the SSID (common during roaming on Pi Zero) used to trip |
| 352 | mark_all_hosts_degraded() and wipe the entire target list. |
| 353 | """ |
| 354 | self.current_ssid = ssid |
| 355 | |
| 356 | if not hasattr(self.shared_data, 'set_active_network'): |
| 357 | return |
| 358 | |
| 359 | active_ssid = getattr(self.shared_data, 'active_network_ssid', None) |
| 360 | |
| 361 | # Same SSID as what storage already considers active → clear pending. |
| 362 | if ssid == active_ssid: |
| 363 | if self._pending_ssid_change is not None: |
| 364 | self.logger.debug( |
| 365 | f"SSID change to {self._pending_ssid_change} aborted " |
| 366 | f"(reverted to {active_ssid})") |
| 367 | self._pending_ssid_change = None |
| 368 | self._pending_ssid_first_seen = 0.0 |
| 369 | return |
| 370 | |
| 371 | # Fresh establishment from no active network → propagate immediately. |
| 372 | if not active_ssid: |
| 373 | self._propagate_active_network(ssid) |
| 374 | return |
| 375 | |
| 376 | # Real change from one SSID to another → debounce. |
| 377 | now = time.time() |
| 378 | if self._pending_ssid_change != ssid: |
| 379 | self._pending_ssid_change = ssid |
| 380 | self._pending_ssid_first_seen = now |
no test coverage detected