- Drop station connect/status/credentials from wifi util and settings API - Remove station activation from main - Remove station UI and JS from index, settings template, and help.js - Device settings now only configure WiFi Access Point Co-authored-by: Cursor <cursoragent@cursor.com>
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
import network
|
|
|
|
|
|
def ap(ssid, password, channel=None):
|
|
ap_if = network.WLAN(network.AP_IF)
|
|
ap_mac = ap_if.config('mac')
|
|
print(ssid)
|
|
ap_if.active(True)
|
|
if channel is not None:
|
|
ap_if.config(essid=ssid, password=password, channel=channel)
|
|
else:
|
|
ap_if.config(essid=ssid, password=password)
|
|
ap_if.active(False)
|
|
ap_if.active(True)
|
|
print(ap_if.ifconfig())
|
|
|
|
def get_mac():
|
|
ap_if = network.WLAN(network.AP_IF)
|
|
return ap_if.config('mac')
|
|
|
|
|
|
def get_ap_config():
|
|
"""Get current AP configuration."""
|
|
try:
|
|
ap_if = network.WLAN(network.AP_IF)
|
|
if ap_if.active():
|
|
config = ap_if.ifconfig()
|
|
return {
|
|
'ssid': ap_if.config('essid'),
|
|
'channel': ap_if.config('channel'),
|
|
'ip': config[0] if config else None,
|
|
'active': True
|
|
}
|
|
return {
|
|
'ssid': None,
|
|
'channel': None,
|
|
'ip': None,
|
|
'active': False
|
|
}
|
|
except Exception as e:
|
|
print(f"Error getting AP config: {e}")
|
|
return None
|