@@ -67,8 +67,13 @@ <h1 class="" id="sw1_name">SW1 Name</h1>
67
67
< div class ="form ">
68
68
< div class ="">
69
69
< div class ="form-control ">
70
- < label > Push-button:</ label >
71
- < input type ="checkbox " id ="sw1_pushbutton ">
70
+ < label > Mode:</ label >
71
+ < select id ="sw1_in_mode ">
72
+ < option id ="sw1_in_mode_0 " value ="0 "> Momentary</ option >
73
+ < option id ="sw1_in_mode_1 " value ="1 "> Toggle</ option >
74
+ < option id ="sw1_in_mode_2 " value ="2 "> Edge</ option >
75
+ < option id ="sw1_in_mode_3 " value ="3 "> Detached</ option >
76
+ </ select >
72
77
</ div >
73
78
< div class ="form-control ">
74
79
< label > Persist state:</ label >
@@ -105,8 +110,13 @@ <h1 class="" id="sw2_name">SW2 Name</h1>
105
110
< div class ="form ">
106
111
< div class ="">
107
112
< div class ="form-control ">
108
- < label > Push-button:</ label >
109
- < input type ="checkbox " id ="sw2_pushbutton ">
113
+ < label > Mode:</ label >
114
+ < select id ="sw2_in_mode ">
115
+ < option id ="sw2_in_mode_0 " value ="0 "> Momentary</ option >
116
+ < option id ="sw2_in_mode_1 " value ="1 "> Toggle</ option >
117
+ < option id ="sw2_in_mode_2 " value ="2 "> Edge</ option >
118
+ < option id ="sw2_in_mode_3 " value ="3 "> Detached</ option >
119
+ </ select >
110
120
</ div >
111
121
< div class ="form-control ">
112
122
< label > Persist state:</ label >
@@ -325,15 +335,15 @@ <h1 class="">Firmware</h1>
325
335
) ;
326
336
}
327
337
328
- function sw_save_common ( cfg_key , pb , persist , spinner ) {
338
+ function sw_save_common ( cfg_key , in_mode , persist , spinner ) {
329
339
spinner . className = "spin" ;
330
340
var data = {
331
341
config : { } ,
332
342
save : true ,
333
343
reboot : false ,
334
344
} ;
335
345
data . config [ cfg_key ] = {
336
- in_push_button : pb ,
346
+ in_mode : parseInt ( in_mode ) ,
337
347
persist_state : persist ,
338
348
} ;
339
349
axios . post ( host + "/rpc/Config.Set" , data ) . then ( function ( res ) {
@@ -351,7 +361,7 @@ <h1 class="">Firmware</h1>
351
361
document . getElementById ( "sw1_save_btn" ) . onclick = function ( ) {
352
362
sw_save_common (
353
363
"sw1" ,
354
- document . getElementById ( "sw1_pushbutton " ) . checked ,
364
+ document . getElementById ( "sw1_in_mode " ) . value ,
355
365
document . getElementById ( "sw1_persist" ) . checked ,
356
366
document . getElementById ( "sw1_save_spinner" ) ,
357
367
) ;
@@ -360,7 +370,7 @@ <h1 class="">Firmware</h1>
360
370
document . getElementById ( "sw2_save_btn" ) . onclick = function ( ) {
361
371
sw_save_common (
362
372
"sw2" ,
363
- document . getElementById ( "sw2_pushbutton " ) . checked ,
373
+ document . getElementById ( "sw2_in_mode " ) . value ,
364
374
document . getElementById ( "sw2_persist" ) . checked ,
365
375
document . getElementById ( "sw2_save_spinner" ) ,
366
376
) ;
@@ -388,7 +398,7 @@ <h1 class="">Firmware</h1>
388
398
document . getElementById ( "sw1_name" ) . innerText = res . data . sw1 . name ;
389
399
document . getElementById ( "sw1_state" ) . innerText = ( res . data . sw1 . state ? "on" : "off" ) ;
390
400
document . getElementById ( "sw1_btn_label" ) . innerText = "Turn " + ( res . data . sw1 . state ? "Off" : "On" ) ;
391
- document . getElementById ( "sw1_pushbutton" ) . checked = res . data . sw1 . pb ;
401
+ document . getElementById ( "sw1_in_mode_" + res . data . sw1 . in_mode ) . selected = true ;
392
402
document . getElementById ( "sw1_persist" ) . checked = res . data . sw1 . persist ;
393
403
document . getElementById ( "sw1_container" ) . sw_id = res . data . sw1 . id ;
394
404
document . getElementById ( "sw1_container" ) . sw_state = res . data . sw1 . state ;
@@ -398,7 +408,7 @@ <h1 class="">Firmware</h1>
398
408
document . getElementById ( "sw2_name" ) . innerText = res . data . sw2 . name ;
399
409
document . getElementById ( "sw2_state" ) . innerText = ( res . data . sw2 . state ? "on" : "off" ) ;
400
410
document . getElementById ( "sw2_btn_label" ) . innerText = "Turn " + ( res . data . sw2 . state ? "Off" : "On" ) ;
401
- document . getElementById ( "sw2_pushbutton" ) . checked = res . data . sw2 . pb ;
411
+ document . getElementById ( "sw2_in_mode_" + res . data . sw2 . in_mode ) . selected = true ;
402
412
document . getElementById ( "sw2_persist" ) . checked = res . data . sw2 . persist ;
403
413
document . getElementById ( "sw2_container" ) . sw_id = res . data . sw2 . id ;
404
414
document . getElementById ( "sw2_container" ) . sw_state = res . data . sw2 . state ;
0 commit comments