Repository navigation
fix(unifi): populate device SSIDs from wireless clients - #1836
Conversation
Read essid instead of the UniFi network name, exclude wired clients, and map the plugin result to scanSSID. Label the imported value as SSID.
Cover wireless, wired, missing flags, missing SSIDs, and differing network names. Keep standalone imports valid when real pytz is installed.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe UniFi import now uses ChangesUniFi client SSID import
Priority: ➖ Normal Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The SSID import follows the intended mapping, with no established issue requiring a fix before merge. Normal checks remain appropriate. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks a lot @ itwormz 🙏 |
📌 Description
This fix is based on the bug report and sanitized UniFi client examples in #1832 — UNFIMP does not populate devSSID for UniFi wireless clients. The report identifies the distinction between
essidand the UniFi network name, and the missing mapping toscanSSID; we independently reproduced both problems on clean upstreammainand compared the proposed behavior with real data from our UniFi network.UNFIMP imports UniFi wireless clients but leaves their device SSID empty because it reads
connection_network_nameand does not map its result toscanSSID.Read the wireless SSID from
essid, return an empty value for explicitly wired clients, and mapextratoCurrentScan.scanSSID. Rename the displayed column from Network to SSID in its existing translations. The normal device update pipeline then applies the existingSET_ALWAYS,SET_EMPTY, and protected-field rules todevSSID.An available
essidis accepted whenis_wiredis absent. Network/VLAN names are not used as SSID fallbacks. Empty scan values retain the existing behavior; clearing a previously saved SSID after a connection change is outside this fix.🔍 Related Issues
Fixes #1832.
📋 Type of Change
📷 Screenshots or Logs
Before the fix, the UniFi test file reports 5 failed, 15 passed: SSID extraction, network-name confusion, wired exclusion, and scan mapping failures.
After the fix, it reports 20 passed on macOS and Debian. The Debian run covering UniFi, authoritative field rules, and plugin conventions reports 464 passed.
🧪 Testing Steps
We run a UniFi network and also checked real client data from our controller. At the time of verification, all 13 active wireless clients had a saved
devSSIDmatching the controller'sessid, while all 27 active wired clients had an emptydevSSID. For all 13 wireless clients,last_connection_network_namediffered fromessid, confirming that a network name would be an incorrect SSID fallback in our environment.This live verification used our existing installation with a local UNFIMP patch implementing the same SSID extraction and mapping. The isolated upstream patch was separately reproduced and tested against clean
main, as described below. The live check did not exercise a Wi-Fi-to-Ethernet transition or clients with a missingis_wiredflag; those edge cases were evaluated separately in code/tests.Regression cases include distinct SSID and network names, missing
is_wired, explicitly wired clients with a staleessid, missing SSIDs, and null/empty SSIDs. The standalone test settings stub supplies UTC so tests also work when realpytzis installed.The Debian application suite (
pytest test --ignore=test/docker_tests) reports 1719 passed, 29 skipped, with 16 existing SQLite datetime-adapter deprecation warnings. Browser-dependent tests were skipped because the runner has no Chromium/ChromeDriver.The separate Docker suite reports 73 passed, 4 failed. Three failures reproduce on unmodified
mainin the same Debian environment:test_host_network_composetest_normal_startup_no_warnings_composetest_app_conf_override_file_written_from_graphql_portThe fourth,
test_custom_port_without_writable_conf, passes when rerun individually on both unmodifiedmainand the patched version. The complete suite is therefore not claimed to pass; the remaining Docker failures require separate investigation. The full suite could not be collected in the minimal macOS test environment because application dependencies and runtime paths were unavailable.✅ Checklist
🙋 Additional Notes
Two separate commits keep the application fix and regression tests independently reviewable:
6b76b8c8—fix(unifi): import wireless SSIDs into device scans75e427f8—test(unifi): cover SSID extraction and scan mappingThe implementation and tests were prepared with AI assistance, reviewed by the submitter, and verified as described above.
Summary by CodeRabbit