How to use the webserver.addFormCheckBox function in webserver

To help you get started, we’ve selected a few webserver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enesbcs / rpieasy / _C020_LoraDirect.py View on Github external
webserver.addFormNumericBox("Spreading factor","spreading",self.sf,6,12)
   options = ["7.8","10.4","15.6","20.8","31.25","41.7","62.5","125","250","500"]
   optionvalues = [BW.BW7_8, BW.BW10_4, BW.BW15_6, BW.BW20_8, BW.BW31_25, BW.BW41_7, BW.BW62_5, BW.BW125, BW.BW250, BW.BW500]
   webserver.addFormSelector("Bandwidth","bw",len(optionvalues),options,optionvalues,None,self.bw)
   webserver.addUnit("khz")

   options = ["CR4/5","CR4/6","CR4/7","CR4/8"]
   optionvalues = [CODING_RATE.CR4_5,CODING_RATE.CR4_6,CODING_RATE.CR4_7,CODING_RATE.CR4_8]
   webserver.addFormSelector("Coding rate","coding",len(optionvalues),options,optionvalues,None,self.coding)

   webserver.addFormNumericBox("Sync Word","sync",self.sync,0,255)
   webserver.addHtml("( 0x"+format(self.sync, '02x')+" )")
   webserver.addFormNote("Default 0x12, LoRaWAN is 0x34. Nodes can only communicate each other if uses same sync word!")

   webserver.addFormCheckBox("Enable Sending","sender",self.enablesend)
   webserver.addFormNumericBox("Default destination node index","defaultnode",self.defaultunit,0,255)
   webserver.addFormNote("Default node index for data sending")
  except Exception as e:
   misc.addLog(rpieGlobals.LOG_LEVEL_ERROR,str(e))
  return True
github enesbcs / rpieasy / _C022_ESPNow.py View on Github external
webserver.addFormSelector("Pin"+str(i+1),"pin"+str(i+1),len(options),options,optionvalues,None,int(ts[3+i]))
   except:
    pass
   try:
    if pluginparams[pp]["ports"]>0:
     webserver.addFormNumericBox("Port","port",int(ts[6]),0,32768)
   except:
    pass
   try:
    if pluginparams[pp]["pullup"]>0:
     webserver.addFormCheckBox("Internal pullup","pullup",int(cs[2])==1)
   except:
    pass
   try:
    if pluginparams[pp]["inverse"]>0:
     webserver.addFormCheckBox("Inversed logic","inverse",int(cs[3])==1)
   except:
    pass
   try:
    if len(pluginparams[pp]["conf"])>0:
     for i in range(len(pluginparams[pp]["conf"])):
      typedef = pluginparams[pp]["conf"][i]
      if typedef["type"]=="select":
       webserver.addFormSelector(typedef["name"],"c"+str(i),len(typedef["options"]),typedef["options"],typedef["optionvalues"],None,int(cs[4+i]))
      elif typedef["type"]=="bool":
       webserver.addFormCheckBox(typedef["name"],"c"+str(i),int(cs[4+i])==1)
      elif typedef["type"]=="num":
       webserver.addFormNumericBox(typedef["name"],"c"+str(i),int(cs[4+i]),0,32768)
   except Exception as e:
    print(e)
github enesbcs / rpieasy / _P029_DomoOutput.py View on Github external
def webform_load(self):
  webserver.addFormNote("Please make sure to select <a href="pinout">pin configured for Output!</a>")
  webserver.addFormCheckBox("Preserve state at startup","p029_preserve",self.taskdevicepluginconfig[0])
  return True
github enesbcs / rpieasy / _P023_OLED.py View on Github external
choice4 = self.taskdevicepluginconfig[3] # store resolution
  webserver.addHtml("Resolution:")
  webserver.addSelector_Head("p023_res",False)
  for d in range(len(options)):
   webserver.addSelector_Item(options[d],options[d],(choice4==options[d]),False)
  webserver.addSelector_Foot()

  choice5 = int(float(self.taskdevicepluginconfig[4])) # store line count
  webserver.addHtml("Number of lines:")
  webserver.addSelector_Head("p023_linecount",False)
  for l in range(1,self.P23_Nlines+1):
   webserver.addSelector_Item(str(l),l,(l==choice5),False)
  webserver.addSelector_Foot()
  webserver.addFormNumericBox("Try to display # characters per row","p023_charperl",self.taskdevicepluginconfig[5],1,32)
  webserver.addFormNote("Leave it '1' if you do not care")
  webserver.addFormCheckBox("Clear only used lines","p023_partialclear",self.taskdevicepluginconfig[6])
  if choice5 &gt; 0 and choice5&lt;9:
   lc = choice5
  else:
   lc = self.P23_Nlines
  for l in range(lc):
   try:
    linestr = self.lines[l]
   except:
    linestr = ""
   webserver.addFormTextBox("Line"+str(l+1),"p023_template"+str(l),linestr,128)

  return True
github enesbcs / rpieasy / _C022_ESPNow.py View on Github external
optionvalues = []
    for p in range(17):
     options.append("GPIO"+str(p))
     optionvalues.append(p)
    for i in range(0,pluginparams[pp]["pins"]):
     webserver.addFormSelector("Pin"+str(i+1),"pin"+str(i+1),len(options),options,optionvalues,None,int(ts[3+i]))
   except:
    pass
   try:
    if pluginparams[pp]["ports"]>0:
     webserver.addFormNumericBox("Port","port",int(ts[6]),0,32768)
   except:
    pass
   try:
    if pluginparams[pp]["pullup"]>0:
     webserver.addFormCheckBox("Internal pullup","pullup",int(cs[2])==1)
   except:
    pass
   try:
    if pluginparams[pp]["inverse"]>0:
     webserver.addFormCheckBox("Inversed logic","inverse",int(cs[3])==1)
   except:
    pass
   try:
    if len(pluginparams[pp]["conf"])>0:
     for i in range(len(pluginparams[pp]["conf"])):
      typedef = pluginparams[pp]["conf"][i]
      if typedef["type"]=="select":
       webserver.addFormSelector(typedef["name"],"c"+str(i),len(typedef["options"]),typedef["options"],typedef["optionvalues"],None,int(cs[4+i]))
      elif typedef["type"]=="bool":
       webserver.addFormCheckBox(typedef["name"],"c"+str(i),int(cs[4+i])==1)
      elif typedef["type"]=="num":
github enesbcs / rpieasy / _C021_BLEDirect.py View on Github external
def webform_load(self):
  webserver.addFormNote("IP and Port parameter is not used!")
  webserver.addFormNote("<a href="https://github.com/enesbcs/ESPEasyRetro/blob/master/ESPEasyRetro/_C021.ino">ESP32 reference controller</a>")

  webserver.addFormCheckBox("Enable Receiver Service","receiver",self.enablerec)
  webserver.addFormNote("Enable this for Gateway/Repeater unit, Disable if you only want to send data!")
  try:
   if self.bleserv is not None:
    webserver.addFormNote("Current Address: "+str(self.bleserv.getaddress()))
  except:
   pass
  webserver.addFormCheckBox("Enable Sending to Default Master Unit","sender",self.enablesend)
  webserver.addFormCheckBox("Enable Direct Sending to Units in P2P list","directsender",self.directsend)
  webserver.addFormNote("Please respect MASTER-SLAVE nature of BLE and do not create infinite loops!")
  webserver.addFormTextBox("Default BLE Master Unit address","masteraddress",self.defaultdestination,23)
  webserver.addFormNote("Enable bluetooth then <a href="blescanner">scan RPIEasy BLE address</a> first.")
  webserver.addFormNumericBox("Default destination node index","defaultnode",self.defaultunit,0,255)
  webserver.addFormNote("Default node index for data sending, only used when Master Unit address is setted")
  return True
github enesbcs / rpieasy / _C021_BLEDirect.py View on Github external
def webform_load(self):
  webserver.addFormNote("IP and Port parameter is not used!")
  webserver.addFormNote("<a href="https://github.com/enesbcs/ESPEasyRetro/blob/master/ESPEasyRetro/_C021.ino">ESP32 reference controller</a>")

  webserver.addFormCheckBox("Enable Receiver Service","receiver",self.enablerec)
  webserver.addFormNote("Enable this for Gateway/Repeater unit, Disable if you only want to send data!")
  try:
   if self.bleserv is not None:
    webserver.addFormNote("Current Address: "+str(self.bleserv.getaddress()))
  except:
   pass
  webserver.addFormCheckBox("Enable Sending to Default Master Unit","sender",self.enablesend)
  webserver.addFormCheckBox("Enable Direct Sending to Units in P2P list","directsender",self.directsend)
  webserver.addFormNote("Please respect MASTER-SLAVE nature of BLE and do not create infinite loops!")
  webserver.addFormTextBox("Default BLE Master Unit address","masteraddress",self.defaultdestination,23)
  webserver.addFormNote("Enable bluetooth then <a href="blescanner">scan RPIEasy BLE address</a> first.")
  webserver.addFormNumericBox("Default destination node index","defaultnode",self.defaultunit,0,255)
  webserver.addFormNote("Default node index for data sending, only used when Master Unit address is setted")
  return True
github enesbcs / rpieasy / _P001_Switch.py View on Github external
def webform_load(self):
  webserver.addFormNote("Please make sure to select <a href="pinout">pin configured</a> for input for default (or output to report back its state)!")
  webserver.addFormCheckBox("Force 10/sec periodic checking of pin","p001_per",self.taskdevicepluginconfig[0])
  webserver.addFormNote("For output pin, only 10/sec periodic method will work!")
  webserver.addFormNumericBox("De-bounce (ms)","p001_debounce",self.taskdevicepluginconfig[1],0,1000)
  options = ["Normal Switch","Push Button Active Low","Push Button Active High"]
  optionvalues = [0,1,2]
  webserver.addFormSelector("Switch Button Type","p001_button",len(optionvalues),options,optionvalues,None,self.taskdevicepluginconfig[2])
  webserver.addFormNote("Use only normal switch for output type, i warned you!")
  return True