How to use the webserver.addFormSelector 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.addHtml("DIO3GPIO"+str(BOARD.DIO3))
   webserver.addHtml("RSTGPIO"+str(BOARD.RST))
   webserver.addTableSeparator("LoRa settings",2,3)
   webserver.addFormFloatNumberBox("Frequency","freq",self.freq,433,928)
   webserver.addUnit("Mhz")
   if self.lora is not None:
     try:
      afreq = self.lora.get_freq()
     except:
      afreq = "UNINITIALIZED"
     webserver.addFormNote("Current frequency: "+str(afreq)+" Mhz")
   webserver.addFormNote("Please check local regulations for your selected frequency!")

   options = ["10%","1%","0.1%"]
   optionvalues = [10,100,1000]
   webserver.addFormSelector("Duty cycle","duty",len(optionvalues),options,optionvalues,None,self.duty)
   webserver.addFormNote("Please check your local Duty cycle regulations for your selected frequency!")

   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!")
github enesbcs / rpieasy / _P012_LCD.py View on Github external
options.append(str(hex(optionvalues[i])))
  webserver.addFormSelector("Address","p012_adr",len(options),options,optionvalues,None,choice2)
  webserver.addFormNote("Enable <a href="pinout">I2C bus</a> first, than <a href="i2cscanner">search for the used address</a>!")

  choice3 = self.taskdevicepluginconfig[2] # store resolution
  webserver.addHtml("Resolution:")
  webserver.addSelector_Head("p012_res",False)
  options = ["16x2","20x4"]
  for d in range(len(options)):
   webserver.addSelector_Item(options[d],options[d],(choice3==options[d]),False)
  webserver.addSelector_Foot()

  choice4 = int(float(self.taskdevicepluginconfig[3])) # store linewrap state
  options =      ["Auto","None"]
  optionvalues = [1,0]
  webserver.addFormSelector("Linebreak","p012_break",len(optionvalues),options,optionvalues,None,choice4)

  choice5 = int(float(self.taskdevicepluginconfig[4])) # store backlight state
  options =      ["Enabled","Disabled"]
  optionvalues = [1,0]
  webserver.addFormSelector("Backlight","p012_blight",len(optionvalues),options,optionvalues,None,choice5)

  if "x2" in str(self.taskdevicepluginconfig[2]):
   lc = 2
  else:
   lc = 4
  for l in range(lc):
   try:
    linestr = self.lines[l]
   except:
    linestr = ""
   webserver.addFormTextBox("Line"+str(l+1),"p012_template"+str(l),linestr,128)
github enesbcs / rpieasy / _P201_GenSerial.py View on Github external
def webform_load(self):
  choice1 = self.taskdevicepluginconfig[0]
  options = rpiSerial.serial_portlist()
  if len(options)&gt;0:
   webserver.addHtml("Serial Device:")
   webserver.addSelector_Head("p201_addr",False)
   for o in range(len(options)):
    webserver.addSelector_Item(options[o],options[o],(str(options[o])==str(choice1)),False)
   webserver.addSelector_Foot()
   webserver.addFormNote("For RPI use 'raspi-config' tool: 5- Interfacing Options-P6 Serial- (Kernel logging disabled + serial port hardware enabled) before enable this plugin")
   webserver.addFormNumericBox("Baudrate","p201_spd",self.taskdevicepluginconfig[1],50,4000000)
   webserver.addFormNote("Generic values: 9600, 19200, 38400, 57600, 115200")
   choice2 = self.taskdevicepluginconfig[2]
   options = ["5","6","7","8"]
   optionvalues = [rpiSerial.FIVEBITS,rpiSerial.SIXBITS,rpiSerial.SEVENBITS,rpiSerial.EIGHTBITS]
   webserver.addFormSelector("Bytesize","p201_bsize",len(optionvalues),options,optionvalues,None,int(choice2))
   webserver.addFormNote("Most common setting is 8")
   choice3 = self.taskdevicepluginconfig[3]
   options = ["None","Even","Odd","Mark","Space"]
   optionvalues = [rpiSerial.PARITY_NONE,rpiSerial.PARITY_EVEN,rpiSerial.PARITY_ODD,rpiSerial.PARITY_MARK,rpiSerial.PARITY_SPACE]
   webserver.addHtml("Parity:")
   webserver.addSelector_Head("p201_par",False)
   for o in range(len(options)):
    webserver.addSelector_Item(options[o],optionvalues[o],(str(optionvalues[o])==str(choice3)),False)
   webserver.addSelector_Foot()
   webserver.addFormNote("Most common setting is None")
   choice4 = self.taskdevicepluginconfig[4]
   options = ["1","2"]
   optionvalues = [rpiSerial.STOPBITS_ONE,rpiSerial.STOPBITS_TWO]
   webserver.addFormSelector("Stopbits","p201_sbit",len(optionvalues),options,optionvalues,None,float(choice4))
   webserver.addFormNote("Most common setting is 1")
   webserver.addFormNumericBox("Expected max packet size","p201_pkt",self.taskdevicepluginconfig[5],1,4096) # Linux serial buffer is fixed max 4096 bytes
github enesbcs / rpieasy / _C001_DomoHTTP.py View on Github external
def webform_load(self):
  try:
   am = self.authmode
  except:
   am = 0
  options = ["HTTP","HTTPS/auto negotiation","HTTPS/disable verify"]
  optionvalues = [0,1,2]
  webserver.addFormSelector("Mode","c001_mode",len(optionvalues),options,optionvalues,None,int(am))
  return True
github enesbcs / rpieasy / _P025_ADS1x15.py View on Github external
options = ["ADS1015","ADS1115"]
  optionvalues = [10,11]
  webserver.addFormSelector("Type","plugin_025_type",2,options,optionvalues,None,int(choice1))
  choice2 = self.taskdevicepluginconfig[1]
  options = ["0x48","0x49","0x4A","0x4B"]
  optionvalues = [0x48,0x49,0x4a,0x4b]
  webserver.addFormSelector("Address","plugin_025_addr",4,options,optionvalues,None,int(choice2))
  webserver.addFormNote("Enable <a href="pinout">I2C bus</a> first, than <a href="i2cscanner">search for the used address</a>!")
  choice3 = self.taskdevicepluginconfig[2]
  options =      ["2/3","1","2","4","8","16"]
  optionvalues = [(2/3),1,2,4,8,16]
  webserver.addFormSelector("Gain","plugin_025_gain",len(optionvalues),options,optionvalues,None,float(choice3))
  choice4 = self.taskdevicepluginconfig[3]
  options = ["A0","A1","A2","A3"]
  optionvalues = [0,1,2,3]
  webserver.addFormSelector("Analog pin","plugin_025_apin",4,options,optionvalues,None,int(choice4))
  webserver.addFormCheckBox("Oversampling","plugin_025_over",self.timer1s)
  return True
github enesbcs / rpieasy / _P508_Temper.py View on Github external
def webform_load(self):
  choice1 = self.taskdevicepluginconfig[0]
  try:
   options = utemper.get_select_list()
  except:
   options = []
  if len(options)&gt;0:
   webserver.addHtml("Device:")
   webserver.addSelector_Head("p508_addr",True)
   for o in range(len(options)):
    webserver.addSelector_Item(str(options[o][1])+" "+str(options[o][2]),int(o+1),(str(o+1)==str(choice1)),False)
   webserver.addSelector_Foot()
   choice2 = self.taskdevicepluginconfig[1]
   options = ["Internal temp","External temp", "Internal temp+humidity", "External temp+humidity"]
   optionvalues = [0,1,2,3]
   webserver.addFormSelector("Sensor type","p508_type",len(optionvalues),options,optionvalues,None,choice2)
  webserver.addFormNote("Without root rights you will not see any Temper device!")
  return True
github enesbcs / rpieasy / _P064_APDS9960.py View on Github external
def webform_load(self): # create html page for settings
  webserver.addFormNote("I2C address is fixed 0x39! You can check it at <a href="i2cscanner">i2cscan</a> page.")
  webserver.addFormPinSelect("Interrupt pin","p064_int_pin",self.taskdevicepin[0])
  webserver.addFormNote("Set an Input for using interrupt pin or none if you want to scan gestures continously!")
  choice1 = self.taskdevicepluginconfig[0]
  options = ["Gesture/Dimmer","Proximity+Light/Dual"]
  optionvalues = [0,1]
  webserver.addFormSelector("Type","p064_type",2,options,optionvalues,None,choice1)
  return True
github enesbcs / rpieasy / _P058_HT16K33_KeyPad.py View on Github external
def webform_load(self):
  choice1 = int(float(self.taskdevicepluginconfig[0])) # store i2c address
  optionvalues = []
  for i in range(0x70, 0x78):
   optionvalues.append(i)
  options = []
  for i in range(len(optionvalues)):
   options.append(str(hex(optionvalues[i])))
  webserver.addFormSelector("Address","p058_adr",len(options),options,optionvalues,None,choice1)
  webserver.addFormNote("Enable <a href="pinout">I2C bus</a> first, than <a href="i2cscanner">search for the used address</a>!")
  return True
github enesbcs / rpieasy / _P009_MCP.py View on Github external
else:
    ownpin = ""
  except Exception as e:
   ownpin = -1
  webserver.addFormPinSelect("MCP interrupt","taskdevicepin0",ownpin)
  webserver.addFormNote("Add one RPI input pin to handle input changes immediately - not needed for interval input reading and output using only")
  webserver.addFormNumericBox("Port","p009_pnum",self.taskdevicepluginconfig[0],0,128)
  webserver.addFormNote("First extender 1-16, Second 17-32...")
  choice2 = self.taskdevicepluginconfig[1]
  options = ["Input","Input-Pullup","Output"]
  optionvalues = [0,1,2]
  webserver.addFormSelector("Type","p009_ptype",len(optionvalues),options,optionvalues,None,int(choice2))
  choice3 = self.taskdevicepluginconfig[2]
  options = ["MCP23017","MCP23008"]
  optionvalues = [0,1]
  webserver.addFormSelector("Chip","p009_chip",len(optionvalues),options,optionvalues,None,int(choice3))
  return True
github enesbcs / rpieasy / _P019_PCF8574.py View on Github external
def webform_load(self): # create html page for settings
  try:
   if self.pcf.externalintsetted:
    self.taskdevicepin[0]=self.pcf.extinta
  except Exception as e:
   pass
  webserver.addFormPinSelect("PCF interrupt","taskdevicepin0",self.taskdevicepin[0])
  webserver.addFormNote("Add one RPI INPUT-PULLUP pin to handle input changes immediately - not needed for interval input reading and output using")
  webserver.addFormNumericBox("Port","p019_pnum",self.taskdevicepluginconfig[0],1,128)
  webserver.addFormNote("First extender 1-8 (0x20), Second 9-16 (0x21)...")
  choice2 = self.taskdevicepluginconfig[1]
  options = ["Input","Output"]
  optionvalues = [0,2]
  webserver.addFormSelector("Type","p019_ptype",len(optionvalues),options,optionvalues,None,int(choice2))
  return True