How to use the webserver.arg 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 / _P513_BLEMijiaClock.py View on Github external
def webform_save(self,params): # process settings post reply
  self.taskdevicepluginconfig[0] = str(webserver.arg("plugin_513_addr",params)).strip()
  self.taskdevicepluginconfig[1] = (webserver.arg("plugin_513_bat",params)=="on")
  if self.taskdevicepluginconfig[1]:
   self.valuecount = 3
   self.vtype = rpieGlobals.SENSOR_TYPE_TRIPLE
  else:
   self.valuecount = 2
   self.vtype = rpieGlobals.SENSOR_TYPE_TEMP_HUM
  self.plugin_init()
  return True
github enesbcs / rpieasy / _P201_GenSerial.py View on Github external
self.taskdevicepluginconfig[0] = str(par)
  try: 
   baud = webserver.arg("p201_spd",params)
   self.taskdevicepluginconfig[1] = int(baud)
  except:
   self.taskdevicepluginconfig[1] = 50
  try:
   par = webserver.arg("p201_bsize",params)
   self.bsize = int(par)
   self.taskdevicepluginconfig[2] = self.bsize
   par = webserver.arg("p201_par",params)
   self.taskdevicepluginconfig[3] = str(par)
   par = webserver.arg("p201_sbit",params)
   self.sbit = int(par)
   self.taskdevicepluginconfig[4] = self.sbit
   par = webserver.arg("p201_pkt",params)
   self.maxexpecteddata = int(par)
   self.taskdevicepluginconfig[5] = self.maxexpecteddata
   par = webserver.arg("p201_fmt",params)
   self.taskdevicepluginconfig[6] = int(par)
  except:
   self.bsize = 8
   self.sbit  = 1
   self.maxexpecteddata = 512
  self.calctimeout()
  self.plugin_init()
  return True
github enesbcs / rpieasy / _P012_LCD.py View on Github external
def webform_save(self,params): # process settings post reply
   par = webserver.arg("p012_type",params)
   if par == "":
    par = "PCF8574"
   self.taskdevicepluginconfig[0] = str(par)

   par = webserver.arg("p012_adr",params)
   if par == "":
    par = 0x27
   self.taskdevicepluginconfig[1] = int(par)

   par = webserver.arg("p012_res",params)
   self.taskdevicepluginconfig[2] = str(par)

   par = webserver.arg("p012_break",params)
   self.taskdevicepluginconfig[3] = str(par)

   par = webserver.arg("p012_blight",params)
   self.taskdevicepluginconfig[4] = str(par)

   for l in range(self.P12_Nlines):
    linestr = webserver.arg("p012_template"+str(l),params).strip()
    try:
      self.lines[l]=linestr
    except:
      self.lines.append(linestr)
   try:
    self.taskdevicepin[0]=int(webserver.arg("taskdevicepin0",params))
   except:
    self.taskdevicepin[0]=-1
   self.plugin_init()
github enesbcs / rpieasy / _P036_FrameOLED.py View on Github external
self.taskdevicepluginconfig[3] = str(par)

   par = webserver.arg("p036_linecount",params)
   if par == "":
    par = 1
   self.taskdevicepluginconfig[4] = int(par)

   for l in range(self.P36_Nlines):
    linestr = webserver.arg("p036_template"+str(l),params).strip()
#    if linestr!="" and linestr!="0":
    try:
      self.lines[l]=linestr
    except:
      self.lines.append(linestr)

   par = webserver.arg("p036_scroll",params)
   if par == "":
    par = 1
   self.taskdevicepluginconfig[5] = int(par)
   par = webserver.arg("p036_contrast",params)
   if par == "":
    par = self.P36_CONTRAST_MED
   self.taskdevicepluginconfig[6] = int(par)

   par = webserver.arg("p036_charperl",params)
   if par == "":
    par = 1
   self.taskdevicepluginconfig[7] = int(par)

   self.plugin_init()
   return True
github enesbcs / rpieasy / _P073_7DGT.py View on Github external
def webform_save(self,params): # process settings post reply
   par = webserver.arg("p073_type",params)
   if par == "":
    par = 1
   self.taskdevicepluginconfig[0] = int(par)
   par = webserver.arg("p073_output",params)
   if par == "":
    par = 1
   self.taskdevicepluginconfig[1] = int(par)
   par = webserver.arg("p073_brightness",params)
   if par == "":
    par = 15
   self.taskdevicepluginconfig[2] = int(par)
   self.plugin_init()
   return True
github enesbcs / rpieasy / _C002_DomoMQTT.py View on Github external
def webform_save(self,params): # process settings post reply
  pchange = False
  pval = self.inchannel
  self.inchannel = webserver.arg("inchannel",params)
  if pval != self.inchannel:
   pchange = True
  pval = self.outchannel
  self.outchannel = webserver.arg("outchannel",params)
  if pval != self.outchannel:
   pchange = True
  try:
   p1 = self.authmode
   p2 = self.certfile
   self.authmode = int(webserver.arg("c002_mode",params))
   self.certfile = webserver.arg("c002_cert",params)
   if p1 != self.authmode or p2 != self.certfile:
    pchange = True
  except:
   self.authmode = 0
   self.certfile = ""
  pval = self.keepalive
  try:
   self.keepalive = int(webserver.arg("keepalive",params))
  except:
   self.keepalive = 60
  if pval != self.keepalive:
   pchange = True
  if pchange and self.enabled:
   self.disconnect()
   time.sleep(0.1)
github enesbcs / rpieasy / _P024_MLX90614.py View on Github external
def webform_save(self,params): # process settings post reply
   par = webserver.arg("plugin_024_addr",params)
   if par == "":
    par = 0x5A
   self.taskdevicepluginconfig[0] = int(par)
   par = webserver.arg("plugin_024_type",params)
   try:
    self.taskdevicepluginconfig[1] = int(par)
   except:
    self.taskdevicepluginconfig[1] = 7
   return True
github enesbcs / rpieasy / _C014_GenMQTT.py View on Github external
def webform_save(self,params): # process settings post reply
  pchange = False
  pval = self.inchannel
  self.inchannel = webserver.arg("inchannel",params)
  if pval != self.inchannel:
   pchange = True
  pval = self.outchannel
  self.outchannel = webserver.arg("outchannel",params)
  if self.inchannel == self.outchannel:
   self.outchannel = self.outchannel+"/set"
  if pval != self.outchannel:
   pchange = True
  try:
   p1 = self.authmode
   p2 = self.certfile
   self.authmode = int(webserver.arg("c014_mode",params))
   self.certfile = webserver.arg("c014_cert",params)
   if p1 != self.authmode or p2 != self.certfile:
    pchange = True
  except:
   self.authmode = 0
   self.certfile = ""
  pval = self.keepalive
  try:
   self.keepalive = int(webserver.arg("keepalive",params))
  except:
   self.keepalive = 60
  if pval != self.keepalive:
   pchange = True
  try:
   lwt = self.lwt_topic
   lwt1 = self.lwtconnmsg
github enesbcs / rpieasy / _C020_LoraDirect.py View on Github external
def webform_save(self,params):
  try:
   self.freq = float(webserver.arg("freq",params))
   self.duty = int(webserver.arg("duty",params))
   self.sf = int(webserver.arg("spreading",params))
   self.coding = int(webserver.arg("coding",params))
   self.sync = int(webserver.arg("sync",params))
   self.defaultunit = int(webserver.arg("defaultnode",params))
   self.enablesend = (webserver.arg("sender",params)=="on")
  except Exception as e:
   misc.addLog(rpieGlobals.LOG_LEVEL_ERROR,"LORA parameter save: "+str(e))
  return True
github enesbcs / rpieasy / _C022_ESPNow.py View on Github external
def webform_save(self,params):
  try:
   self.port = str(webserver.arg("ser_addr",params))
   self.baud = int(webserver.arg("ser_spd",params))
   self.wchan = int(webserver.arg("wchannel",params))
   self.defaultunit = int(webserver.arg("defaultnode",params))
#   self.enablesend = (webserver.arg("sender",params)=="on")
  except Exception as e:
   self.baud = 0
   misc.addLog(rpieGlobals.LOG_LEVEL_ERROR,"ESPNow parameter save: "+str(e))
  self.calctimeout()
  return True