Fix LoRaWan config max node index

This commit is contained in:
Theo Arends 2025-08-01 17:05:12 +02:00
parent 4e92f66f88
commit 4d2162507a

View File

@ -186,6 +186,14 @@ class webPageLoRaWAN : Driver
tasmota.cmd('LoRaWanNode'+inode+' '+cmdArg,true) tasmota.cmd('LoRaWanNode'+inode+' '+cmdArg,true)
end end
var appKey, decoder, name, enabled
var hintAK='32 character Application Key'
var hintDecoder='Decoder file, ending in .be'
var hintAN='Device name for MQTT messages'
var arg='LoRaWanNode'
var enables=string.split(tasmota.cmd(arg,true).find(arg), ',') # [1,!2,!3,!4,5,6]
var maxnode=enables.size()
webserver.content_start("LoRaWAN") #- title of the web page -# webserver.content_start("LoRaWAN") #- title of the web page -#
webserver.content_send_style() #- send standard Tasmota styles -# webserver.content_send_style() #- send standard Tasmota styles -#
webserver.content_send( webserver.content_send(
@ -207,31 +215,23 @@ class webPageLoRaWAN : Driver
"}" "}"
"}" "}"
"e.classList.add('active');" "e.classList.add('active');"
"for(i=1;i<=16;i++){" "for(i=1;i<="+str(maxnode)+";i++){"
"document.getElementById('nd'+i).style.display=(i==n)?'block':'none';" "document.getElementById('nd'+i).style.display=(i==n)?'block':'none';"
"}" "}"
"}" "}"
"window.onload = function(){selNode("+str(inode)+");};" "window.onload = function(){selNode("+str(inode)+");};"
"</script>") "</script>")
var arg, appKey, decoder, name, enables, enabled
var hintAK='32 character Application Key'
var hintDecoder='Decoder file, ending in .be'
var hintAN='Device name for MQTT messages'
webserver.content_send( webserver.content_send(
f"<fieldset>" f"<fieldset>"
"<legend><b>&nbsp;LoRaWan End Device&nbsp;</b></legend>" "<legend><b>&nbsp;LoRaWan End Device&nbsp;</b></legend>"
"<br><div>") #- Add space and indent to align form tabs -# "<br><div>") #- Add space and indent to align form tabs -#
for node:1..16 for node:1..maxnode
webserver.content_send(f"<button type='button' onclick='selNode({node})' id='n{node}' class='tl inactive'>{node}</button>") webserver.content_send(f"<button type='button' onclick='selNode({node})' id='n{node}' class='tl inactive'>{node}</button>")
end end
webserver.content_send( webserver.content_send(
f"</div><br><br><br><br>") #- Terminate indent and add space -# f"</div><br><br><br><br>") #- Terminate indent and add space -#
for node:1..maxnode
arg='LoRaWanNode'
enables=string.split(tasmota.cmd(arg,true).find(arg), ',') # [1,!2,!3,!4,5,6,7,8,9,10,11,12,13,14,15,16]
for node:1..16
enabled="" enabled=""
if enables[node-1][0] != '!' if enables[node-1][0] != '!'
enabled=' checked' enabled=' checked'