diff --git a/matrixbox_simulator/device/cpstubs/wifi.py b/matrixbox_simulator/device/cpstubs/wifi.py index b84e5bb..08da0d6 100644 --- a/matrixbox_simulator/device/cpstubs/wifi.py +++ b/matrixbox_simulator/device/cpstubs/wifi.py @@ -7,6 +7,12 @@ only special-cases the real CircuitPython name. """ +import os + +_LOCAL_IPV4_ADDRESS = ( + f"127.0.0.1:{os.environ.get('MATRIXBOX_SIMULATOR_HTTP_PORT', '8080')}" +) + class Radio: def __init__(self) -> None: @@ -14,8 +20,8 @@ def __init__(self) -> None: self.ap_active: bool = False self.mac_address: bytes = bytes([0x02, 0x00, 0x00, 0x45, 0x53, 0x50]) self.tx_power: float = 0.0 - self.ipv4_address: str | None = None - self.ipv4_address_ap: str | None = None + self.ipv4_address: str | None = _LOCAL_IPV4_ADDRESS + self.ipv4_address_ap: str | None = _LOCAL_IPV4_ADDRESS def connect( self, ssid: str, password: str, *, channel: int = 0, timeout: float = 15