From 98ea697941088250dec0cc249adbab19cc91d776 Mon Sep 17 00:00:00 2001 From: Simon Sawert Date: Sun, 13 Sep 2026 00:25:54 +0200 Subject: [PATCH] fix: simulate other than 0 rssi --- matrixbox_simulator/device/cpstubs/wifi.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/matrixbox_simulator/device/cpstubs/wifi.py b/matrixbox_simulator/device/cpstubs/wifi.py index 08da0d6..40f961a 100644 --- a/matrixbox_simulator/device/cpstubs/wifi.py +++ b/matrixbox_simulator/device/cpstubs/wifi.py @@ -14,6 +14,11 @@ ) +class _ApInfo: + def __init__(self, rssi: int) -> None: + self.rssi = rssi + + class Radio: def __init__(self) -> None: self.connected: bool = True @@ -23,6 +28,12 @@ def __init__(self) -> None: self.ipv4_address: str | None = _LOCAL_IPV4_ADDRESS self.ipv4_address_ap: str | None = _LOCAL_IPV4_ADDRESS + # The sim has no real association to measure RSSI from. -50 dBm + # lands in matrixbox's own "4 of 5" signal-bar bracket (see + # web_interface._sig_bars) instead of the "no signal" 0 bars that + # an absent ap_info used to fall back to. + self.ap_info: _ApInfo | None = _ApInfo(rssi=-50) + def connect( self, ssid: str, password: str, *, channel: int = 0, timeout: float = 15 ) -> None: