feat: wifi hotspot provisioning + config integrations block
This commit is contained in:
@@ -168,9 +168,16 @@ def run_provisioning():
|
||||
print('[provisioning] connection from', addr)
|
||||
method, path, body = _parse_http_request(conn)
|
||||
|
||||
if method == 'GET' and path == '/':
|
||||
info = ujson.dumps({'sn': sn, 'ip': ip, 'status': 'awaiting_provision'})
|
||||
if method == 'GET' and (path == '/' or path == '/info'):
|
||||
info = ujson.dumps({
|
||||
'sn': sn,
|
||||
'ip': ip,
|
||||
'status': 'awaiting_provision',
|
||||
'type': 'identity-iot',
|
||||
'port': HTTP_PORT,
|
||||
})
|
||||
_http_response(conn, '200 OK', info)
|
||||
conn.close()
|
||||
|
||||
elif method == 'POST' and path == '/provision':
|
||||
try:
|
||||
@@ -184,7 +191,7 @@ def run_provisioning():
|
||||
|
||||
# Basic validation
|
||||
required = ['wifi_ssid', 'wifi_pass', 'comm_key', 'comm_iv',
|
||||
'base_url', 'tenant_id', 'node_type', 'node_id']
|
||||
'identity_iot_url', 'tenant_id', 'node_type', 'node_id']
|
||||
for k in required:
|
||||
if k not in cfg:
|
||||
raise Exception('missing field: ' + k)
|
||||
@@ -209,4 +216,4 @@ def run_provisioning():
|
||||
|
||||
udp.close()
|
||||
srv.close()
|
||||
return received_cfg
|
||||
return received_cfg
|
||||
Reference in New Issue
Block a user