-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathweb.html
1012 lines (960 loc) · 36 KB
/
web.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang='zh-cn'>
<head>
<meta charset='utf-8'/>
<meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no'/>
<title>motion_53eb24 - 人体存在传感器</title>
<style type='text/css'>body {
font-family: -apple-system, BlinkMacSystemFont, 'Microsoft YaHei', sans-serif;
font-size: 16px;
color: #333;
line-height: 1.75
}
#body {
margin: 0 auto;
}
@media screen and (max-width: 900px) {
#body {
width: 98%
}
}
#nav {
text-align: center
}
#tab > div {
display: none;
margin: 0 auto;
max-width: 600px
}
#nav button {
background: #eee;
border: 1px solid #ddd;
padding: .7em 1em;
cursor: pointer;
z-index: 1;
margin-left: -1px;
outline: 0;
line-height: 17px
}
#nav .active {
background: #fff
}
table.gridtable {
color: #333;
border-width: 1px;
border-color: #ddd;
border-collapse: collapse;
margin: auto;
margin-top: 15px;
width: 100%
}
table.gridtable th {
border-width: 1.5px;
padding: 8px;
border-style: solid;
border-color: #ddd;
background-color: #f5f5f5
}
table.gridtable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #ddd;
background-color: #fff
}
input, select {
border: 1px solid #ccc;
padding: 7px 0;
border-radius: 3px;
padding-left: 5px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s
}
input:focus, select:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6)
}
#tab button {
color: #fff;
border-width: 0;
border-radius: 3px;
cursor: pointer;
outline: 0;
font-size: 17px;
line-height: 2.4rem;
width: 100%
}
#tab button[disabled] {
cursor: not-allowed;
filter: alpha(opacity=65);
-webkit-box-shadow: none;
box-shadow: none;
opacity: .65
}
.btn-info {
background-color: #5bc0de;
border-color: #46b8da
}
.btn-info:hover {
background-color: #31b0d5;
border-color: #269abc
}
.btn-success {
background-color: #5cb85c;
border-color: #4cae4c
}
.btn-success:hover {
background-color: #449d44;
border-color: #398439
}
.btn-danger {
background-color: #d9534f;
border-color: #d43f3a
}
.btn-danger:hover {
background-color: #c9302c;
border-color: #ac2925
}
.alert {
width: 80%;
padding: 15px;
border: 1px solid transparent;
border-radius: 4px;
position: fixed;
top: 10px;
left: 10%;
z-index: 999999;
display: none
}
label.bui-radios-label input {
position: absolute;
opacity: 0;
visibility: hidden
}
label.bui-radios-label .bui-radios {
display: inline-block;
position: relative;
width: 13px;
height: 13px;
background: #fff;
border: 1px solid #979797;
border-radius: 50%;
vertical-align: -2px
}
label.bui-radios-label input:checked + .bui-radios:after {
position: absolute;
content: '';
width: 7px;
height: 7px;
background-color: #fff;
border-radius: 50%;
top: 3px;
left: 3px
}
label.bui-radios-label input:checked + .bui-radios {
background: #00b066;
border: 1px solid #00b066
}
label.bui-radios-label input:disabled + .bui-radios {
background-color: #e8e8e8;
border: solid 1px #979797
}
label.bui-radios-label input:disabled:checked + .bui-radios:after {
background-color: #c1c1c1
}
label.bui-radios-label .bui-radios {
-webkit-transition: background-color ease-out .3s;
transition: background-color ease-out .3s
}
input[type='range'] {
width: 80%;
height: 10px;
border: 0;
background-color: #f0f0f0;
border-radius: 5px;
position: relative;
-webkit-appearance: none !important;
outline: 0
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
background: #f40
}
.file {
position: relative;
display: inline-block;
background: #d0eeff;
border: 1px solid #99d3f5;
border-radius: 4px;
padding: 4px 12px;
overflow: hidden;
color: #1e88c7;
text-decoration: none;
text-indent: 0;
line-height: 20px
}
.file input {
position: absolute;
font-size: 100px;
right: 0;
top: 0;
opacity: 0
}
.file:hover {
background: #aadffd;
border-color: #78c3f3;
color: #004974;
text-decoration: none
}
a {
color: #1e6bb8;
text-decoration: none
}
a:hover {
text-decoration: underline
}</style>
<script type='text/javascript'>var timer;
var logIndex = 0;
var defIntervalTime = 3000;
var intervalTime = defIntervalTime;
var lt;
function id(d) {
return document.getElementById(d)
}
function tab(v) {
var divs = id('tab').children;
var btns = id('nav').getElementsByTagName('button');
for (var i = 0; i < divs.length; i++) {
divs[i].style.display = divs[i] == id('tab' + v) ? 'block' : 'none';
btns[i].setAttribute('class', '')
}
id('tb' + v).setAttribute('class', 'active');
intervalTime = v == 5 ? 1000 : defIntervalTime
}
function serialize(form) {
var field, s = '';
if (typeof form == 'object' && form.nodeName == 'FORM') {
for (var i = 0; i < form.elements.length; i++) {
field = form.elements[i];
if (field.name && !field.disabled && field.type != 'file' && field.type != 'reset' && field.type != 'submit' && field.type != 'button') {
if ((field.type != 'checkbox' && field.type != 'radio') || field.checked) {
s += field.name + '=' + encodeURIComponent(field.value) + '&'
}
}
}
}
if (s.length > 1) {
s = s.substring(0, s.length - 1)
}
return s
}
function ajax() {
var ajaxData = {
type: (arguments[0].type || 'GET').toUpperCase(),
url: arguments[0].url || '',
data: arguments[0].data || null,
success: arguments[0].success || function () {
},
error: arguments[0].error || function () {
}
};
var xhr = new XMLHttpRequest();
xhr.responseType = 'json';
xhr.open(ajaxData.type, ajaxData.url);
if (ajaxData.type == 'POST') {
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
xhr.send(ajaxData.data)
} else {
xhr.send()
}
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
ajaxData.success(xhr.response)
} else {
ajaxData.error()
}
if (ajaxData.url == '/get_status') {
lt = setTimeout(get_status, intervalTime)
}
}
}
}
function toast(msg, duration, isok) {
var m = id('alert');
m.innerHTML = msg;
m.style.cssText = isok ? 'color: #3c763d;background-color: #dff0d8;border-color: #d6e9c6;' : 'color: #a94442; background-color: #f2dede; border-color: #ebccd1;';
m.style.display = 'block';
clearTimeout(timer);
timer = setTimeout(function () {
var d = 0.5;
m.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
m.style.opacity = '0';
setTimeout(function () {
m.style.display = 'none'
}, d * 1000)
}, duration)
}
function postupdate(the) {
var form = new FormData(the);
var xhr = new XMLHttpRequest();
xhr.responseType = 'json';
xhr.open('POST', the.getAttribute('action'), true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
if (xhr.response.msg) {
toast(xhr.response.msg, xhr.response.code ? 5000 : 9000, xhr.response.code)
}
if (xhr.response.code) {
tab(5);
if (the.getAttribute('action') == '/update') {
setTimeout('location.reload();', 7000)
}
}
} else {
toast('<strong>Oh snap!</strong> 请求出错!', 9000, false)
}
}
};
xhr.upload.onprogress = function (ev) {
if (ev.lengthComputable) {
toast('已上传' + Math.floor(100 * ev.loaded / ev.total) + '%,请耐心等待,稍后将弹出升级情况。', 16000, 1)
}
};
xhr.send(form)
}
function postform(the) {
ajaxPost(the.getAttribute('action'), serialize(the));
return false
}
function getRadioValue(radioName) {
var radios = document.getElementsByName(radioName);
for (var i = 0; i < radios.length; i++) {
var radio = radios.item(i);
if (radio.checked) {
return radio.value
}
}
return undefined
}
function setRadioValue(radioName, value) {
var radios = document.getElementsByName(radioName);
for (var i = 0; i < radios.length; i++) {
var radio = radios.item(i);
if (radio.value == value) {
radio.checked = true;
return
}
}
}
function setSelectValue(selectId, checkValue) {
var select = document.getElementsByName(selectId)[0];
for (var i = 0; i < select.options.length; i++) {
if (select.options[i].value == checkValue) {
select.options[i].selected = true;
return
}
}
}
function ajaxPost(url, data, callback) {
ajax({
type: 'POST', url: url, dataType: 'json', data: data, success: function (data) {
if (typeof(callback) == 'function') {
if (callback(data) === true) {
return
}
}
if (data.msg) {
toast(data.msg, data.code ? 5000 : 9000, data.code)
}
if (data.data) {
setData(data.data)
}
}, error: function () {
toast('<strong>Oh snap!</strong> 请求出错!', 9000, false)
}
})
}
function get_status() {
clearTimeout(lt);
ajaxPost('/get_status', 'i=' + logIndex)
}
window.addEventListener('load', get_status);
var setDataL = new Array();
function setData(data) {
for (var key in data) {
var result = false;
for (var j in setDataL) {
result = setDataL[j](data, key);
if (result) {
break
}
}
if (result) {
continue
}
if (typeof(setDataSub) == 'function') {
result = setDataSub(data, key);
if (result) {
continue
}
}
var v = data[key];
if (key == 'discovery') {
id('discovery').innerHTML = v == 1 ? '已启动' : '未启动';
id('discovery_btn').setAttribute('class', v == 1 ? 'btn-danger' : 'btn-info');
id('discovery_btn').innerHTML = v == 1 ? '关闭MQTT自动发现' : '打开MQTT自动发现'
} else if (key == 'logindex') {
logIndex = v
} else if (key == 'log') {
if (v) {
id('log').value += v;
id('log').scrollTop = 99999
}
} else if (key == 'ip') {
if (window.location.hostname == '192.168.4.1' && v && v != '192.168.4.1') {
toast('连接WiFi成功,IP地址:' + v, 5000, 1);
window.setTimeout('location.href=\'http://' + v + '\'', 5000)
}
} else {
if (id(key)) {
id(key).innerHTML = v
} else {
console.log(key)
}
}
}
}</script>
</head>
<body>
<div id='body'>
<div id='alert' class='alert'></div>
<h1 style='text-align:center'>人体存在传感器</h1>
<div id='nav'>
<button id='tb1' onclick='tab(1)' class='active'>状态</button>
<button id='tb2' onclick='tab(2)'>联网</button>
<button id='tb6' onclick='tab(6)'>MQTT</button>
<button id='tb3' onclick='tab(3)'>控制</button>
<button id='tb4' onclick='tab(4)'>关于</button>
<button id='tb5' onclick='tab(5)'>日志</button>
</div>
<div id='tab'>
<div id='tab1' style='display: block;'>
<table class='gridtable'>
<thead>
<tr>
<th colspan='2'>设备状态</th>
</tr>
</thead>
<tbody>
<tr>
<td>主机名</td>
<td>motion_53eb24</td>
</tr>
<tr>
<td>开机时间</td>
<td id='uptime'>0T00:00:13</td>
</tr>
<tr>
<td>空闲内存</td>
<td><span id='free_mem'>34</span> kB</td>
</tr>
<tr>
<td>WiFi模式</td>
<td>STA</td>
</tr>
<tr>
<td>SSID</td>
<td>hello</td>
</tr>
<tr>
<td>RSSI</td>
<td>-59dBm</td>
</tr>
<tr>
<td>IP地址</td>
<td>192.168.10.192</td>
</tr>
<tr>
<td>DHCP</td>
<td>DHCP</td>
</tr>
</tbody>
</table>
</div>
<div id='tab2'>
<form method='post' action='/wifi' onsubmit='postform(this);return false'>
<table class='gridtable'>
<thead>
<tr>
<th>WiFi名称</th>
<th>信号</th>
</tr>
</thead>
<tbody>
<tr id='clusss'>
<td>WiFi名称</td>
<td><input type='text' id='wifi_ssid' name='wifi_ssid'></td>
</tr>
<tr>
<td>WiFi密码</td>
<td><input type='text' name='wifi_password'></td>
</tr>
<tr>
<td colspan='2'>
<button type='submit' class='btn-info'>连接WiFi</button>
</td>
</tr>
<tr>
<td colspan='2'>
<button type='button' class='btn-danger' onclick='scanWifi()'>搜索WiFi</button>
</td>
</tr>
</tbody>
</table>
</form>
<script type='text/javascript'>function clickwifi(t) {
id('wifi_ssid').value = t.value
}
function scanWifi() {
ajaxPost('scan_wifi', '', function (data) {
if (data.code == 1) {
if (data.data.list.length == 0) {
scanWifi();
return;
}
var trs = document.getElementsByClassName('addwifi');
for (var i = trs.length - 1; i >= 0; i--) {
trs[i].remove()
}
for (var a in data.data.list) {
var w = data.data.list[a];
var tr = document.createElement("tr");
var td = document.createElement("td");
tr.setAttribute('class', 'addwifi');
td.innerHTML = "<label class='bui-radios-label'><input type='radio' name='wifi' onclick='clickwifi(this)' value='" + w.name + "'/><i class='bui-radios'></i> " + w.name + (w.type == 7 ? ' [开放]' : '') + "</label>";
tr.appendChild(td);
td = document.createElement("td");
td.innerHTML = w.rssi + 'dBm ' + w.quality + '%';
tr.appendChild(td);
var oldEle = id('clusss');
oldEle.parentNode.insertBefore(tr, oldEle)
}
} else {
toast(data.msg, data.code ? 5000 : 9000, data.code)
}
})
}</script>
<form method='post' action='/dhcp' onsubmit='postform(this);return false'>
<table class='gridtable'>
<thead>
<tr>
<th colspan='2'>WIFI高级设置</th>
</tr>
</thead>
<tbody>
<tr>
<td>高级</td>
<td><label class='bui-radios-label'><input type='checkbox' name='wifi_dis_restart' value='1'/><i
class='bui-radios' style='border-radius:20%'></i> 断开Wifi 10分钟自动重启</label></td>
</tr>
<tr>
<td>DHCP</td>
<td><label class='bui-radios-label'><input type='radio' name='dhcp' value='1'
onchange='dhcponchange(this)'/><i
class='bui-radios'></i> DHCP</label> <label
class='bui-radios-label'><input type='radio' name='dhcp' value='2'
onchange='dhcponchange(this)'/><i
class='bui-radios'></i> 静态IP</label></td>
</tr>
<tr class='dhcp_hide'>
<td>静态IP</td>
<td><input type='text' name='static_ip' value=''></td>
</tr>
<tr class='dhcp_hide'>
<td>子网掩码</td>
<td><input type='text' name='static_netmask' value=''></td>
</tr>
<tr class='dhcp_hide'>
<td>网关</td>
<td><input type='text' name='static_gateway' value=''></td>
</tr>
<tr>
<td colspan='2'>
<button type='submit' class='btn-info'>保存</button>
</td>
</tr>
</tbody>
</table>
</form>
<script type='text/javascript'>function dhcponchange(the) {
var v = getRadioValue('dhcp');
var dom = document.getElementsByClassName('dhcp_hide');
for (var i = 0; i < dom.length; i++) {
dom[i].style.display = v == 2 ? '' : 'none'
}
}</script>
<form method='post' action='/http' onsubmit='postform(this);return false'>
<table class='gridtable'>
<thead>
<tr>
<th colspan='2'>WEB安全设置</th>
</tr>
</thead>
<tbody>
<tr>
<td>端口</td>
<td><input type='number' min='0' max='65535' name='http_port' required value='80'>
<tr>
<td>用户名</td>
<td><input type='text' name='http_user' value=''></td>
</tr>
<tr>
<td>密码</td>
<td><input type='password' name='http_pass' value=''></td>
</tr>
<tr>
<td colspan='2'>
<button type='submit' class='btn-info'>保存</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div id='tab6'>
<form method='post' action='/mqtt' onsubmit='postform(this);return false'>
<table class='gridtable'>
<thead>
<tr>
<th colspan='2'>MQTT设置</th>
</tr>
</thead>
<tbody>
<tr>
<td>地址</td>
<td><input type='text' name='mqtt_server' value=''></td>
</tr>
<tr>
<td>端口</td>
<td><input type='number' min='0' max='65535' name='mqtt_port' required value='0'> 0为不启动mqtt
</td>
</tr>
<tr>
<td>用户名</td>
<td><input type='text' name='mqtt_username' value=''></td>
</tr>
<tr>
<td>密码</td>
<td><input type='password' name='mqtt_password' value=''></td>
</tr>
<tr>
<td>主题</td>
<td><input type='text' name='mqtt_topic' value='%module%/%hostname%/%prefix%/'
style='min-width:90%'></td>
</tr>
<tr>
<td>心跳上报间隔</td>
<td><input type='number' min='0' max='3600' name='interval' required value='5'> 秒 0为不上报
</td>
</tr>
<tr>
<td>保留(Retain)</td>
<td><label class='bui-radios-label'><input type='radio' name='retain' value='0'/><i
class='bui-radios'></i> 关闭</label> <label
class='bui-radios-label'><input type='radio' name='retain' value='1'/><i
class='bui-radios'></i> 开启</label><br>除非你知道它是干嘛的。
</td>
</tr>
<tr>
<td>状态</td>
<td id='mqttconnected'>未连接 重连次数:-1</td>
</tr>
<tr>
<td colspan='2'>
<button type='submit' class='btn-info'>保存</button>
</td>
</tr>
</tbody>
</table>
</form>
<form method='post' action='/discovery' onsubmit='postform(this);return false'>
<table class='gridtable'>
<thead>
<tr>
<th colspan='2'>MQTT自动发现</th>
</tr>
</thead>
<tbody>
<tr>
<td>自发现状态</td>
<td id='discovery'>未启动</td>
</tr>
<tr>
<td>自发现前缀</td>
<td><input type='text' name='discovery_prefix' required value='homeassistant'></td>
</tr>
<tr>
<td colspan='2'>
<button type='submit' class='btn-info' id='discovery_btn'>打开MQTT自动发现</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div id='tab3'>
<table class='gridtable'>
<thead>
<tr>
<th colspan='2'>传感器状态</th>
</tr>
</thead>
<tbody>
<tr style='text-align:center'>
<td colspan='2'>
<button type='button' style='width:80px' id='relay_1' class='btn-info'>无人</button>
</td>
</tr>
</tbody>
</table>
<table class='gridtable'>
<thead>
<tr>
<th colspan='2'>设置</th>
</tr>
</thead>
<form method='post' action='/relay_setting' onsubmit='postform(this);return false'>
<tr>
<td>延时上报无人</td>
<td><input type='number' min='1' max='360' name='delay_report' required value='5'> 秒
</td>
</tr>
<tr>
<td>MQTT上报间隔</td>
<td><input type='number' min='0' max='360' name='report_interval' required value='1'> 秒 0为不上报
</td>
</tr>
<tr>
<td>光照上报间隔</td>
<td><input type='number' min='0' max='3600' name='lux_report_interval' required value='5'> 秒 建议大于5秒,0为不上报
</td>
</tr>
<tr>
<td>指示灯</td>
<td><label class='bui-radios-label'><input type='radio' name='led_state' value='0'/><i
class='bui-radios'></i>开</label> <label
class='bui-radios-label'><input type='radio' name='led_state' value='1'/><i
class='bui-radios'></i>关</label></td>
</tr>
<tr>
<td>传感器位置</td>
<td><input type='text' name='location' value=''></td>
</tr>
<tr>
<td colspan='2'>
<button type='submit' class='btn-info'>保存</button>
<br>
</form>
<button type='button' class='btn-success' style='margin-top:10px' onclick='window.location.href="/ha"'>
下载HA配置文件
</button>
</table>
<table class='gridtable'>
<thead>
<tr>
<th colspan='2'>串口指令</th>
</tr>
</thead>
<tbody>
<form method='post' action='/serial' onsubmit='postform(this);return false'>
<tr>
<td>指令</td>
<td><input type='text' name='serial' value=''></td>
</tr>
<tr>
<td colspan='2'>
<button type='submit' class='btn-info'>执行</button>
<br>
</form>
</tbody>
</table>
<script type='text/javascript'>function setDataSub(data, key) {
if (key.substr(0, 10) == 'brightness' || key.substr(0, 5) == 'color') {
var t = id(key);
var v = data[key];
t.value = v;
t.nextSibling.nextSibling.innerHTML = v + (key.substr(0, 10) == 'brightness' ? "%" : "");
return true
} else if (key.substr(0, 5) == 'relay') {
var t = id(key);
var v = data[key];
t.setAttribute('class', v == 1 ? 'btn-success' : 'btn-info');
t.innerHTML = v == 1 ? '有人' : '无人';
return true
}
return false
}
setRadioValue('led_state', '0');
function ledLightRangOnChange(the) {
the.nextSibling.nextSibling.innerHTML = the.value
};</script>
<form method='post' action='/module_setting' onsubmit='postform(this);return false'>
<table class='gridtable'>
<thead>
<tr>
<th colspan='2'>模块设置</th>
</tr>
</thead>
<tbody>
<tr>
<td>主机名</td>
<td><input type='text' name='uid' value='motion_53eb24' maxlength=15> 具有唯一性,留空默认</td>
</tr>
<tr>
<td>日志输出</td>
<td><label class='bui-radios-label'><input type='checkbox' name='log_serial' value='1'/><i
class='bui-radios' style='border-radius:20%'></i> Serial</label> <label
class='bui-radios-label'><input type='checkbox' name='log_serial1' value='1'/><i
class='bui-radios' style='border-radius:20%'></i> Serial1</label> <label
class='bui-radios-label'><input type='checkbox' name='log_web' value='1'/><i
class='bui-radios' style='border-radius:20%'></i> web</label>
</td>
</tr>
<tr>
<td>NTP服务器</td>
<td><input type='text' name='ntp' style='width:150px' value=''> 建议在获取时间失败时才填写</td>
</tr>
<tr>
<td colspan='2'>
<button type='submit' class='btn-info'>设置</button>
</td>
</tr>
</tbody>
</table>
</form>
<div>
<button type='button' class='btn-danger' style='margin-top: 10px'
onclick="javascript:if(confirm('确定要重启模块?')){ajaxPost('/operate', 'd=1');}">重启模块
</button>
<button type='button' class='btn-danger' style='margin-top: 10px'
onclick="javascript:if(confirm('确定要重置模块?')){ajaxPost('/operate', 'd=2');}">重置模块
</button>
</div>
</div>
<div id='tab4'>
<table class='gridtable'>
<thead>
<tr>
<th colspan='2'>硬件参数</th>
</tr>
</thead>
<tbody>
<tr>
<td>ESP芯片ID</td>
<td>5499684</td>
</tr>
<tr>
<td>Flash芯片 ID</td>
<td>1458270</td>
</tr>
<tr>
<td>Flash大小</td>
<td>4096 kB</td>
</tr>
<tr>
<td>固件Flash大小</td>
<td>2048 kB</td>
</tr>
<tr>
<td>固件大小</td>
<td>378 kB</td>
</tr>
<tr>
<td>空闲程序空间</td>
<td>1648 kB</td>
</tr>
<tr>
<td>内核和SDK版本</td>
<td>2_7_4/2.2.2-dev(38a443e)</td>
</tr>
<tr>
<td>重启原因</td>
<td>Power On</td>
</tr>
<tr>
<td>MAC地址</td>
<td>C8:C9:00:53:00:24</td>
</tr>
</tbody>
</table>
<table class='gridtable'>
<thead>
<tr>
<th colspan='2'>固件升级</th>
</tr>
</thead>
<tbody>
<tr>
<td>当前版本</td>
<td>v20220716</td>
</tr>
<tr>
<td>编译时间</td>
<td>2022-07-16 22:41:45</td>
</tr>
<form method='POST' action='/update' enctype='multipart/form-data'
onsubmit='postupdate(this);return false'>
<tr>
<td colspan='2'><a class='file'><input type='file' name='file'>选择文件</a></td>
</tr>
<tr>
<td colspan='2'>
<button type='submit' class='btn-info'>升级</button>
<br>
</form>
<tr>
<td colspan='2' style='text-align:center'>OTA更新</td>
</tr>
<form method='POST' action='/ota' onsubmit='postform(this);return false'>
<tr>
<td>OTA地址</td>
<td><input type='text' name='ota_url' value='http://10.0.0.50/esp/%module%.bin'
style='width:98%'></td>
</tr>
<tr>
<td colspan='2'>
<button type='submit' class='btn-success' onclick="return confirm('确定要OTA更新?')">OTA更新
</button>
</td>
</tr>
</form>
</tbody>
</table>
</div>
<div id='tab5'>
<div style='display:inline-block;color:#000000;min-width:340px;position:absolute;left:1%;margin-top:20px;width:99%'>
<textarea readonly id='log' cols='340' wrap='off'
style='resize:none;width:98%;height:600px;padding:5px;overflow:auto;background:#ffffff;color:#000000;'></textarea>
</div>
</div>