Fix and Unify LoRaWan berry parameter GUI

This commit is contained in:
Theo Arends 2025-07-21 16:21:26 +02:00
parent e11c874eda
commit d7eebc174e

View File

@ -141,7 +141,7 @@ lwdecode = lwdecode_cls()
import webserver import webserver
class webPageLoRaWAN : Driver class webPageLoRaWAN : Driver
def sendNodeButton(node) def sendNodeButton(node)
webserver.content_send("<td><button onclick='selNode("+str(node)+")' id='n"+str(node)+"' class='button inactive' style='width:30px'>"+str(node)+"</button>") webserver.content_send(f"<td><button onclick='selNode({node})' id='n{node}' class='button inactive' style='width:41px'>{node}</button></td>")
end end
def web_add_config_button() def web_add_config_button()
@ -168,8 +168,9 @@ class webPageLoRaWAN : Driver
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(
"<style>.inactive{background:#10537c;}.active{background:#1fa3ec;}</style>" # "<style>.inactive{background:#10537c;}.active{background:#1fa3ec;}</style>"
"<h2>LoRaWAN End Devices</h2>" "<style>.inactive{background:var(--c_btnoff);}.active{background:var(--c_btn);}</style>"
# "<h2>LoRaWAN End Devices</h2>"
"<script>" "<script>"
"function selNode(n){" "function selNode(n){"
"var i;var d=4;" "var i;var d=4;"
@ -197,11 +198,11 @@ class webPageLoRaWAN : Driver
for node:1..8 for node:1..8
self.sendNodeButton(node) self.sendNodeButton(node)
end end
webserver.content_send("<tr>") webserver.content_send("</tr><tr>")
for node:9..16 for node:9..16
self.sendNodeButton(node) self.sendNodeButton(node)
end end
webserver.content_send("</table>") webserver.content_send("</tr></table>")
for node:1..16 for node:1..16
arg='LoRaWanAppKey' + str(node) arg='LoRaWanAppKey' + str(node)
appKey=tasmota.cmd(arg,true).find(arg) appKey=tasmota.cmd(arg,true).find(arg)
@ -210,24 +211,24 @@ class webPageLoRaWAN : Driver
arg='LoRaWanDecoder' + str(node) arg='LoRaWanDecoder' + str(node)
decoder=tasmota.cmd(arg,true).find(arg) decoder=tasmota.cmd(arg,true).find(arg)
webserver.content_send( webserver.content_send(
"<div id='nd"+str(node)+"' style='display:none'>" f"<div id='nd{node}' style='display:none'>"
"<fieldset>" "<fieldset>"
"<legend><b>&nbsp;End Device "+str(node)+"&nbsp;</b></legend>" "<legend><b>&nbsp;LoRaWan End Device {node}&nbsp;</b></legend>"
"<form action='' method='post'>" "<form action='' method='post'>"
"<p>Application Key" "<p><b>Application Key</b>"
"<input title='"+hintAK+"' pattern='[A-Fa-f0-9]{32}' id='ak' minlength='32' maxlength='32' required='' placeholder='"+hintAK+"' value='"+appKey+ "' name='ak' style='font-size:smaller'>" "<input title='{hintAK}' pattern='[A-Fa-f0-9]{{32}}' id='ak' minlength='32' maxlength='32' required='' placeholder='{hintAK}' value='{appKey}' name='ak' style='font-size:smaller'>"
"</p>" "</p>"
"<p></p>" "<p></p>"
"<p>Device Name" "<p><b>Device Name</b>"
"<input id='an' placeholder='"+hintAN+"' value='"+name+ "' name='an'>" "<input id='an' placeholder='{hintAN}' value='{name}' name='an'>"
"</p>" "</p>"
"<p></p>" "<p></p>"
"<p>Decoder File" "<p><b>Decoder File</b>"
"<input title='"+hintDecoder+"' id='dc' placeholder='"+hintDecoder+"' value='"+decoder+"' name='dc'>" "<input title='{hintDecoder}' id='dc' placeholder='{hintDecoder}' value='{decoder}' name='dc'>"
"</p>" "</p>"
"<p></p>" "<br>"
"<button name='save' class='button bgrn'>Save</button>" "<button name='save' class='button bgrn'>Save</button>"
"<input type='hidden' name='node' value='"+str(node)+"'>" "<input type='hidden' name='node' value='{node}'>"
"</form>" "</form>"
"</fieldset>" "</fieldset>"
"</div>") "</div>")