Skip to content

Score channels by RSSI and adjacent-channel overlap#4

Merged
vpadman1 merged 1 commit intomainfrom
vignesh/rssi-aware-recommendations
Apr 16, 2026
Merged

Score channels by RSSI and adjacent-channel overlap#4
vpadman1 merged 1 commit intomainfrom
vignesh/rssi-aware-recommendations

Conversation

@vpadman1
Copy link
Copy Markdown
Owner

Summary

Previously `recommend_channel` used raw network counts — treated one strong nearby AP the same as five weak ones and ignored 2.4 GHz adjacent-channel interference.

Now the recommender weights each nearby network by signal strength and, on 2.4 GHz, by distance from the candidate channel.

  • `score_channels(networks, channels, band)` — returns a congestion score per channel, lower is better.
    • RSSI buckets: strong (> −55 dBm) = 3.0, medium (−55..−75) = 1.5, weak (< −75) = 0.5.
    • 2.4 GHz adjacent-channel spill: 1.0 at Δ=0, 0.5 at Δ=±1..±2, 0.25 at Δ=±3..±4, 0 beyond. Models the overlap between adjacent 2.4 GHz channels.
    • 5 GHz channels at 20 MHz don't overlap, so no spill is applied — 5 GHz path is O(n) via dict lookup.
  • `recommend_channel` picks the lowest-scoring channel (same current-channel tiebreaker as before). The dashboard chart still displays raw counts since counts are more intuitive than weighted scores.
  • 4 new tests covering strong-vs-weak weighting, 2.4 GHz spill, 5 GHz no-overlap, and empty input.

Test plan

  • `uv run pytest -v` — 32/32 passing (28 existing + 4 new)
  • `uvx ruff check .` — clean
  • CI green

Previously recommend_channel used raw network counts, which treated one strong
nearby network the same as five weak ones and ignored 2.4 GHz adjacent-channel
interference. Now:

- score_channels() weights each nearby network by RSSI bucket (strong > −55
  dBm gets 3.0, medium −55..−75 gets 1.5, weak < −75 gets 0.5).
- On 2.4 GHz, a network on channel N spills into ±1..±4 with decreasing
  weight (1.0, 0.5, 0.5, 0.25, 0.25). 5 GHz channels at 20 MHz don't overlap
  so no spill is applied there.
- recommend_channel picks the lowest-scoring channel (same current-channel
  tiebreaker as before). Raw counts are still used for the dashboard chart.

Added 4 new tests covering strong-vs-weak weighting, 2.4 GHz spill, 5 GHz
no-overlap, and empty input.
@vpadman1 vpadman1 merged commit 934de92 into main Apr 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant