Пример #1
0
    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
Пример #2
0
 def webform_load(self):
     webserver.addFormNote("Select an output pin.")
     prot = self.taskdevicepluginconfig[0]
     try:
         prot = int(prot)
     except:
         prot = 0
     if prot == 0:
         prot = 1
     options = ["1", "2", "3", "4", "5", "6", "7"]
     optionvalues = [1, 2, 3, 4, 5, 6, 7]
     webserver.addFormSelector("Protocol", "p112_prot", len(options),
                               options, optionvalues, None, prot)
     webserver.addFormNote("Default is 1")
     bits = self.taskdevicepluginconfig[1]
     try:
         bits = int(bits)
     except:
         bits = 0
     if bits == 0:
         bits = 24
     webserver.addFormNumericBox("Data bits", "p112_bits", bits, 1, 64)
     webserver.addFormNote("Default is 24")
     rep = self.taskdevicepluginconfig[2]
     try:
         rep = int(rep)
     except:
         rep = 0
     if rep == 0:
         rep = 3
     webserver.addFormNumericBox("Repeat", "p112_rep", rep, 1, 20)
     webserver.addFormNote("Default is 3")
     return True
Пример #3
0
 def webform_load(self):  # create html page for settings
     webserver.addFormTextBox("Controller Publish", "inchannel",
                              self.inchannel, 255)
     webserver.addFormTextBox("Controller Subscribe", "outchannel",
                              self.outchannel, 255)
     try:
         kp = self.keepalive
     except:
         kp = 60
     webserver.addFormNumericBox("Keepalive time", "keepalive", kp, 2, 600)
     webserver.addUnit("s")
     try:
         am = self.authmode
         fname = self.certfile
     except:
         am = 0
         fname = ""
     options = ["MQTT", "MQTTS/with cert", "MQTTS/insecure"]
     optionvalues = [0, 1, 2]
     webserver.addFormSelector("Mode", "c002_mode", len(optionvalues),
                               options, optionvalues, None, int(am))
     webserver.addFormTextBox("Server certificate file", "c002_cert",
                              str(fname), 120)
     webserver.addBrowseButton("Browse", "c002_cert", startdir=str(fname))
     webserver.addFormNote(
         "Upload certificate first at <a href='filelist'>filelist</a> then select here!"
     )
     return True
Пример #4
0
    def webform_load(self):  # create html page for settings
        webserver.addFormNote("TM1637:  1st GPIO=CLK-Pin, 2nd GPIO=DIO-Pin")

        choice1 = self.taskdevicepluginconfig[0]  # store display type
        options = ["TM1637 - 4 digit (colon)", "TM1637 - 4 digit (dots)"]
        optionvalues = [self.P073_TM1637_4DGTCOLON, self.P073_TM1637_4DGTDOTS]
        webserver.addFormSelector("Display Type", "p073_type",
                                  len(optionvalues), options, optionvalues,
                                  None, choice1)

        choice2 = self.taskdevicepluginconfig[1]
        options = [
            "Manual", "Clock 24h - Blink", "Clock 24h - No Blink",
            "Clock 12h - Blink", "Clock 12h - No Blink", "Date"
        ]
        optionvalues = [
            self.P073_DISP_MANUAL, self.P073_DISP_CLOCK24BLNK,
            self.P073_DISP_CLOCK24, self.P073_DISP_CLOCK12BLNK,
            self.P073_DISP_CLOCK12, self.P073_DISP_DATE
        ]
        webserver.addFormSelector("Display Output", "p073_output",
                                  len(optionvalues), options, optionvalues,
                                  None, choice2)

        webserver.addFormNumericBox("Brightness", "p073_brightness",
                                    self.taskdevicepluginconfig[2], 0, 15)
        return True
Пример #5
0
 def webform_load(self):  # create html page for settings
     webserver.addFormNote("I2C Line is not selectable currently!")  #ToDo!
     webserver.addFormNumericBox("Port", "p007_pnum",
                                 self.taskdevicepluginconfig[0], 1, 32)
     webserver.addFormNote(
         "First extender 1-4 (0x48), Second 5-8 (0x49)...")
     return True
Пример #6
0
 def webform_load(self):
  webserver.addFormNote("IP and Port parameter is not used!")
  try:
   choice1 = self.port
   options = rpiSerial.serial_portlist()
   if len(options)>0:
    webserver.addHtml("<tr><td>Serial Device:<td>")
    webserver.addSelector_Head("ser_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","ser_spd",self.baud,50,4000000)
    webserver.addFormNote("Generic values: 9600, 19200, 38400, 57600, 115200")
#    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")
    webserver.addFormNote("Detected gateway MAC address "+str(self.mac))
    options = []
    optionvalues = []
    for i in range(1,14):
       options.append(str(i))
       optionvalues.append(i)
    webserver.addFormSelector("Wifi channel","wchannel",len(options),options,optionvalues,None,self.wchan)
    webserver.addFormNote("Set the same wifi channel at all nodes!")
    webserver.addWideButton("espnow","ESPNow endpoint management","")
   else:
    webserver.addFormNote("No serial ports found")

  except Exception as e:
   misc.addLog(rpieGlobals.LOG_LEVEL_ERROR,"ESPNow GW init error: "+str(e))
  return True
Пример #7
0
 def webform_load(self):  # create html page for settings
     choice = self.taskdevicepin[0]
     webserver.addRowLabel("GPIO")
     webserver.addSelector_Head("p038_pin", False)
     if len(Settings.Pinout) > 0:
         webserver.addSelector_Item(Settings.Pinout[0]["name"][0], -1,
                                    (str(choice) == -1), False, "")
     for x in range(len(Settings.Pinout)):
         if Settings.Pinout[x][
                 "altfunc"] == 0 and Settings.Pinout[x]["canchange"] > 0:
             oname = Settings.Pinout[x]["name"][0]
             if "PWM" in oname:
                 if Settings.Pinout[x]["canchange"] == 1:
                     onum = 0
                     try:
                         onum = int(Settings.Pinout[x]["startupstate"])
                         if onum < 1:
                             onum = 0
                     except:
                         pass
                     oname += " (" + Settings.PinStates[onum] + ")"
                 webserver.addSelector_Item(
                     oname, Settings.Pinout[x]["BCM"],
                     (str(choice) == str(Settings.Pinout[x]["BCM"])), False,
                     "")
     webserver.addSelector_Foot()
     webserver.addFormNote(
         "Only PWM-able pins can be used! WARNING: internal audio, I2S and other PWM functions might interfere with NeoPixel, so <a href='pinout'>disable them at the Hardware page</a>"
     )
     webserver.addFormNumericBox("Led Count", "p038_leds",
                                 self.taskdevicepluginconfig[0], 1, 2700)
     webserver.addFormNumericBox("Initial brightness", "p038_bright",
                                 self.taskdevicepluginconfig[1], 0, 255)
     return True
Пример #8
0
 def webform_load(self):  # create html page for settings
     ownpin = -1
     try:
         if self.mcp:
             if self.mcp.externalintsetted > -1:
                 ownpin = int(self.mcp.extinta)
         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
Пример #9
0
 def webform_load(self):
     webserver.addFormNote(
         "Set 4 pins to OUTPUT <a href='pinout'>at pinout</a> first, than specify them here."
     )
     webserver.addFormNumericBox("Speed", "p204_speed",
                                 self.taskdevicepluginconfig[0], 1, 25)
     return True
Пример #10
0
 def webform_load(self): # create html page for settings
  choice1 = self.taskdevicepluginconfig[0]
  options = ["0x69","0x68"]
  optionvalues = [0x69,0x68]
  webserver.addFormSelector("I2C address","plugin_209_addr",len(optionvalues),options,optionvalues,None,int(choice1))
  webserver.addFormNote("Enable <a href='pinout'>I2C bus</a> first, than <a href='i2cscanner'>search for the used address</a>!")
  options = ["None","Min","Max","Average","Temp range","Thermistor","# of greater values than reference temp","Avg deviance from reference temp","Temp median","Heatsource detection"]
  optionvalues = [0,1,2,3,4,5,6,7,8,9]
  webserver.addFormSelector("Value1","plugin_209_func0",len(optionvalues),options,optionvalues,None,int(self.taskdevicepluginconfig[1]))
  webserver.addFormSelector("Value2","plugin_209_func1",len(optionvalues),options,optionvalues,None,int(self.taskdevicepluginconfig[2]))
  webserver.addFormSelector("Value3","plugin_209_func2",len(optionvalues),options,optionvalues,None,int(self.taskdevicepluginconfig[3]))
  webserver.addFormSelector("Value4","plugin_209_func3",len(optionvalues),options,optionvalues,None,int(self.taskdevicepluginconfig[4]))
  webserver.addFormFloatNumberBox("Reference temperature","plugin_209_reftemp",self._reftemp,0,80)
  webserver.addFormNote("Set this to 0 to use built-in thermistor as reference!")
  webserver.addFormNumericBox("Number of + deviances means heatsource detected","plugin_209_detdev",self.detdev,0,64)
  webserver.addFormNote("0 means disable this parameter!")
  webserver.addFormNumericBox("Temperature range means heatsource detected","plugin_209_detrange",self.detrange,0,30)
  webserver.addFormNote("0 means disable this parameter!")

  webserver.addFormSubHeader("Snapshot options")
  options = ["Disable","160x160","320x320"]
  optionvalues = [0,160,320]
  webserver.addFormSelector("Output size","plugin_209_psize",len(optionvalues),options,optionvalues,None,int(self.taskdevicepluginconfig[5]))
  options = ["None","Rotate by 90","Rotate by 180","Rotate by 270"]
  optionvalues = [0,90,180,270]
  webserver.addFormSelector("Rotation","plugin_209_rot",len(optionvalues),options,optionvalues,None,int(self.rotateangle))
  webserver.addFormFloatNumberBox("Min temp for color calc","plugin_209_mintemp",self.MinTemp,-20,100)
  webserver.addFormFloatNumberBox("Max temp for color calc","plugin_209_maxtemp",self.MaxTemp,-20,100)
  try:
   if self.initialized and self.enabled and int(self.taskdevicepluginconfig[5])>0:
    webserver.addHtml("<tr><td colspan=2><a href='heatcam.jpg'><img src='heatcam.jpg'></a></td></tr>")
  except:
   pass
  return True
Пример #11
0
 def webform_load(self):  # create html page for settings
     webserver.addFormTextBox("RTSP stream", "plugin_522_url",
                              str(self.taskdevicepluginconfig[0]), 255)
     webserver.addFormNote(
         "Specify the full URL to access stream, with password if needed")
     webserver.addFormCheckBox("Enable resize", "plugin_522_resize",
                               self.taskdevicepluginconfig[1])
     webserver.addFormNumericBox("Width to resize", "plugin_522_w",
                                 self.taskdevicepluginconfig[2], 0, 4096)
     webserver.addFormNumericBox("Height to resize", "plugin_522_h",
                                 self.taskdevicepluginconfig[3], 0, 2160)
     webserver.addFormNote(
         "Resize is a bit resource hungry, use only if really needed")
     try:
         if self.initialized and self.enabled:
             try:
                 pname = self.gettaskname()
             except:
                 pname = ""
             if pname == "":
                 pname = "[NAME]"
             url = "image?name=" + str(pname)
             webserver.addHtml("<tr><td>Output image url:</td>")
             if pname == "[NAME]":
                 webserver.addHtml("<td>http://ipaddress:port/image?name=" +
                                   pname)
             else:
                 webserver.addHtml("<td><a href='" + url + "'>/" + url +
                                   "</a></td></tr>")
     except:
         pass
     return True
Пример #12
0
 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!")
     options = ["BOTH", "RISING", "FALLING"]
     optionvalues = [gpios.BOTH, gpios.RISING, gpios.FALLING]
     webserver.addFormSelector("Event detection type", "p001_det",
                               len(optionvalues), options, optionvalues,
                               None, self.taskdevicepluginconfig[3])
     webserver.addFormNote("Only valid if event detection activated")
     return True
Пример #13
0
    def webform_load(self):  # create html page for settings
        choice1 = str(self.taskdevicepluginconfig[0])  # store display type
        options = [
            '1.54" (200x200)', '1.54"B (200x200)', '1.54"C (150x150)',
            '2.13" (250x122)', '2.13"B (212x104)', '2.7" (264x176)',
            '2.7"B (264x176)', '2.9" (296x128)', '2.9"B (296x128)',
            '4.2" (400x300)', '4.2"B (400x300)', '7.5" (800x480)',
            '7.5"B (800x480)'
        ]
        optionvalues = [
            "154", "154b", "154c", "213", "213b", "270", "270b", "290", "290b",
            "420", "420b", "750", "750b"
        ]
        webserver.addHtml("<tr><td>Display type:<td>")
        webserver.addSelector_Head("p205_type", False)
        for d in range(len(options)):
            webserver.addSelector_Item(options[d], optionvalues[d],
                                       (str(choice1) == str(optionvalues[d])),
                                       False)
        webserver.addSelector_Foot()
        webserver.addFormNote("Enable <a href='pinout'>SPI-0</a> first!")
        webserver.addFormNote(
            "Hardware connection (OLED => Raspberry Pi)<br>VCC->3.3V, GND->GND, SDI->MOSI, SCLK->SCLK, CS-> GPIO8/CE0, D/C->GPIO25 (out), RES->GPIO17 (out), BUSY->GPIO24 (in)"
        )

        choice3 = int(float(
            self.taskdevicepluginconfig[2]))  # store rotation state
        options = ["Normal", "Rotate by 90", "Rotate by 180", "Rotate by 270"]
        optionvalues = [0, 1, 2, 3]
        webserver.addFormSelector("Mode", "p205_rotate", len(optionvalues),
                                  options, optionvalues, None, choice3)

        choice5 = int(float(
            self.taskdevicepluginconfig[4]))  # store line count
        webserver.addHtml("<tr><td>Number of lines:<td>")
        webserver.addSelector_Head("p205_linecount", False)
        for l in range(1, self.P205_Nlines + 1):
            webserver.addSelector_Item(str(l), l, (l == choice5), False)
        webserver.addSelector_Foot()
        webserver.addFormNumericBox("Try to display # characters per row",
                                    "p205_charperl",
                                    self.taskdevicepluginconfig[5], 1, 32)
        webserver.addFormNote("Leave it '1' if you do not care")
        webserver.addFormCheckBox("Clear only used lines", "p205_partialclear",
                                  self.taskdevicepluginconfig[6])
        if choice5 > 0 and choice5 < 9:
            lc = choice5
        else:
            lc = self.P205_Nlines
        for l in range(lc):
            try:
                linestr = self.lines[l]
            except:
                linestr = ""
            webserver.addFormTextBox("Line" + str(l + 1),
                                     "p205_template" + str(l), linestr, 128)

        return True
Пример #14
0
 def webform_load(self): # create html page for settings
  webserver.addFormTextBox("Server","server",self.server,128)
  webserver.addFormNumericBox("Port","port",self.port,1,65535)
  webserver.addFormPasswordBox("Token","passw",self.passw,64)
  webserver.addFormTextBox("Chat-id","chatid",self.chatid,255)
  webserver.addHtml("<TR><TD>Body:<TD><textarea name='body' rows='5' cols='80' size=255 wrap='off'>")
  webserver.addHtml(str(self.body))
  webserver.addHtml("</textarea>")
  return True
Пример #15
0
 def webform_load(self):  # create html page for settings
     webserver.addFormTextBox("Device Address", "plugin_510_itagaddr",
                              str(self.taskdevicepluginconfig[0]), 20)
     webserver.addFormNote(
         "Enable blueetooth then <a href='blescanner'>scan iTag address</a> first."
     )
     webserver.addFormNumericBox("Reconnect time", "plugin_510_reconnect",
                                 self.taskdevicepluginconfig[1], 5, 240)
     webserver.addUnit("s")
     return True
Пример #16
0
 def webform_load(self): # create html page for settings
  webserver.addFormNote("Select an input pin.")
  webserver.addFormNumericBox("Debounce Time (mSec)","p003",self.taskdevicepluginconfig[0])
  choice1 = self.taskdevicepluginconfig[1]
  options = ["Delta","Delta/Total/Time","Total","Delta/Total"]
  optionvalues = [0,1,2,3]
  webserver.addFormSelector("Counter Type","p003_countertype",len(options),options,optionvalues,None,choice1)
  choice2 = self.taskdevicepluginconfig[2]
  options = ["BOTH","RISING","FALLING"]
  optionvalues = [gpios.BOTH,gpios.RISING,gpios.FALLING]
  webserver.addFormSelector("Mode Type","p003_raisetype",len(options),options,optionvalues,None,choice2)
  return True
Пример #17
0
 def webform_load(self): # create html page for settings
  choice1 = str(self.taskdevicepluginconfig[0]) # store display type
  import luma.oled.device
  options = luma.oled.device.__all__
  webserver.addHtml("<tr><td>Display type:<td>")
  webserver.addSelector_Head("p036_type",True)
  for d in range(len(options)):
   webserver.addSelector_Item(options[d],options[d],(choice1==options[d]),False)
  webserver.addSelector_Foot()
  choice2 = int(float(self.taskdevicepluginconfig[1])) # store i2c address
  options = ["0x3c","0x3d"]
  optionvalues = [0x3c,0x3d]
  webserver.addFormSelector("Address","p036_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 = int(float(self.taskdevicepluginconfig[2])) # store rotation state
  options =      ["Normal","Rotate by 180"]
  optionvalues = [0,2]
  webserver.addFormSelector("Mode","p036_rotate",len(optionvalues),options,optionvalues,None,choice3)
  options = ["Default","128x64","128x128","128x32","96x96","96x64","64x48","64x32"]
  choice4 = self.taskdevicepluginconfig[3] # store resolution
  webserver.addHtml("<tr><td>Resolution:<td>")
  webserver.addSelector_Head("p036_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("<tr><td>Lines per Frame:<td>")
  webserver.addSelector_Head("p036_linecount",False)
  for l in range(1,5):
   webserver.addSelector_Item(str(l),l,(l==choice5),False)
  webserver.addSelector_Foot()

  choice6 = int(float(self.taskdevicepluginconfig[5])) # transition speed
  options =      ["Very Slow","Slow","Fast","Very Fast","Instant"]
  optionvalues = [1,2,4,8,32]
  webserver.addFormSelector("Scroll","p036_scroll",len(optionvalues),options,optionvalues,None,choice6)

  for l in range(self.P36_Nlines):
   try:
    linestr = self.lines[l]
   except:
    linestr = ""
   webserver.addFormTextBox("Line"+str(l+1),"p036_template"+str(l),linestr,128)

  choice7 = int(float(self.taskdevicepluginconfig[6])) # contrast
  options = ["Low","Medium","High"]
  optionvalues = [self.P36_CONTRAST_LOW, self.P36_CONTRAST_MED, self.P36_CONTRAST_HIGH]
  webserver.addFormSelector("Contrast","p036_contrast",len(optionvalues),options,optionvalues,None,choice7)
  webserver.addFormNumericBox("Try to display # characters per row","p036_charperl",self.taskdevicepluginconfig[7],1,32)
  webserver.addFormNote("Leave it '1' if you do not care")
  webserver.addFormPinSelect("Display button", "p036_button", self.taskdevicepin[0])
  return True
Пример #18
0
 def webform_load(self):
     webserver.addFormNote("Select an input pin.")
     tol = self.taskdevicepluginconfig[0]
     try:
         tol = int(tol)
     except:
         tol = 0
     if tol == 0:
         tol = 60
     webserver.addFormNumericBox("Signal decoding tolerance",
                                 "p111_tolerance", tol, 1, 200)
     webserver.addUnit("%")
     return True
Пример #19
0
 def webform_load(self):
     choice1 = self.taskdevicepluginconfig[0]
     options = [
         "RAW", "SHA1 encoded", "SHA1 encoded except starting with 0"
     ]
     optionvalues = [0, 1, 2]
     webserver.addFormSelector("Sending format", "p008_format", 3, options,
                               optionvalues, None, choice1)
     webserver.addFormNumericBox("Expected PIN digits", "p008_minlen",
                                 self.taskdevicepluginconfig[1], 0, 10)
     webserver.addFormNumericBox("Maximal card bit length", "p008_maxlen",
                                 self.taskdevicepluginconfig[2], 0, 34)
     return True
Пример #20
0
 def webform_load(self):
     webserver.addFormNote(
         "Please make sure to select <a href='pinout'>pin configured for Output or HPWM!</a>"
     )
     webserver.addFormCheckBox("Preserve state at startup", "p213_preserve",
                               self.taskdevicepluginconfig[0])
     webserver.addFormCheckBox(
         "Response to remote commands for non-Domoticz controllers",
         "p213_report", self.taskdevicepluginconfig[1])
     webserver.addFormNumericBox("Frequency", "p213_freq",
                                 self.taskdevicepluginconfig[2], 0,
                                 19200000)
     return True
Пример #21
0
 def webform_load(self): # create html page for settings
  choice1 = self.taskdevicepluginconfig[0]
  options = ["0x68","0x69"]
  optionvalues = [0x68,0x69]
  webserver.addFormSelector("I2C address","p045_address",len(optionvalues),options,optionvalues,None,int(choice1))
  webserver.addFormNote("Enable <a href='pinout'>I2C bus</a> first, than <a href='i2cscanner'>search for the used address</a>!")
  webserver.addFormPinSelect("Interrupt pin","p045_int_pin",self.taskdevicepin[0])
  webserver.addFormNote("Set an Input-PULLUP pin to INT pin and connect it for fastest results. (optional)")
  choice2 = int(self.taskdevicepluginconfig[1])
  options = ["Movement detection","Acceleration X","Acceleration Y","Acceleration Z","G-force X","G-force Y","G-force Z"]
  optionvalues = [0,4,5,6,7,8,9]
  webserver.addFormSelector("Type","p045_function",len(optionvalues),options,optionvalues,None,choice2)
  if choice2==0:
   webserver.addHtml("<TR><TD><TD>The thresholdvalues (-65535 to 65535, except 0) can be used to set a threshold for one or more<br>")
   webserver.addHtml("axis. The axis will trigger when the range for that axis exceeds the threshold<br>")
   webserver.addHtml("value. A value of 0 disables movement detection for that axis.")
   webserver.addFormNumericBox("Detection threshold X", "p045_threshold_x", self.taskdevicepluginconfig[2], -65535, 65535)
   webserver.addFormNumericBox("Detection threshold Y", "p045_threshold_y", self.taskdevicepluginconfig[3], -65535, 65535)
   webserver.addFormNumericBox("Detection threshold Z", "p045_threshold_z", self.taskdevicepluginconfig[4], -65535, 65535)
   webserver.addFormNumericBox("Min movement time", "p045_threshold_window", self.taskdevicepluginconfig[6], 0, 120)
   webserver.addUnit("s")
  else: # pos
   choice5 = int(self.taskdevicepluginconfig[7])
   options = ["Nothing","Acceleration X","Acceleration Y","Acceleration Z","G-force X","G-force Y","G-force Z"]
   optionvalues = [0,4,5,6,7,8,9]
   webserver.addFormSelector("Type","p045_function2",len(optionvalues),options,optionvalues,None,choice5)
   choice6 = int(self.taskdevicepluginconfig[8])
   webserver.addFormSelector("Type","p045_function3",len(optionvalues),options,optionvalues,None,choice6)
  if self.enabled and self.initialized:
   try:
    webserver.addFormNote("Accel x:"+str(self.mpu.ax)+", y:"+str(self.mpu.ay)+", z:"+str(self.mpu.az))
    webserver.addFormNote("Gyro x:"+str(self.mpu.gx)+", y:"+str(self.mpu.gy)+", z:"+str(self.mpu.gz))
   except:
    pass
  return True
Пример #22
0
def displaytask(taskstr,confstr):
  global pluginparams
  if type(taskstr)==list:
   ts = taskstr
   cs = confstr
  else:
   ts = str(taskstr).split(",")
   cs = str(confstr).split(",")
  pp = -1
  for p in range(len(pluginparams)):
   if int(pluginparams[p]["pluginid"])==int(ts[2]):
    pp = p
    break
  options = []
  optionvalues = []
  for p in range(len(pluginparams)):
    options.append(pluginparams[p]["name"])
    optionvalues.append(pluginparams[p]["pluginid"])
  webserver.addFormSelector("Plugin","pluginid",len(options),options,optionvalues,None,int(ts[2]))
  webserver.addFormNumericBox("Interval","interval",int(ts[7]),0,32768)
  webserver.addFormNumericBox("IDX","idx",int(ts[8]),0,32768)
  if pp>-1:
   try:
    options = []
    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":
       webserver.addFormNumericBox(typedef["name"],"c"+str(i),int(cs[4+i]),0,32768)
   except Exception as e:
    print(e)
Пример #23
0
 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
Пример #24
0
 def webform_load(self):  # create html page for settings
     webserver.addFormNote(
         "1st GPIO is <b>Trigger</b> pin which has to be an output, and 2nd GPIO is the <b>Echo</b> pin which has to be an input!<br>Make sure to set it up at <a href='pinout'>Pinout settings</a> first! <br>And do not forget about 5V->3.3V level shifting when connecting them!"
     )
     webserver.addFormNumericBox("Samples", "p013_samples",
                                 self.taskdevicepluginconfig[0], 1, 30)
     webserver.addFormNote("Number of readings at once, that are averaged.")
     webserver.addFormNumericBox("Cooldown time between samples",
                                 "p013_ctime",
                                 self.taskdevicepluginconfig[1], 10, 1000)
     webserver.addUnit("ms")
     webserver.addFormNote(
         "Waiting before starting the next sample reading. (100ms recommended)"
     )
     return True
Пример #25
0
 def webform_load(self): # create html page for settings
  choice1 = str(self.taskdevicepluginconfig[0]) # store display type
  import luma.oled.device
  options = luma.oled.device.__all__
  webserver.addHtml("<tr><td>Display type:<td>")
  webserver.addSelector_Head("p023_type",True)
  for d in range(len(options)):
   webserver.addSelector_Item(options[d],options[d],(choice1==options[d]),False)
  webserver.addSelector_Foot()
  choice2 = int(float(self.taskdevicepluginconfig[1])) # store i2c address
  options = ["0x3c","0x3d"]
  optionvalues = [0x3c,0x3d]
  webserver.addFormSelector("Address","p023_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 = int(float(self.taskdevicepluginconfig[2])) # store rotation state
  options =      ["Normal","Rotate by 90","Rotate by 180","Rotate by 270"]
  optionvalues = [0,1,2,3]
  webserver.addFormSelector("Mode","p023_rotate",len(optionvalues),options,optionvalues,None,choice3)
  options = ["Default","128x64","128x128","128x32","96x96","96x64","64x48","64x32"]
  choice4 = self.taskdevicepluginconfig[3] # store resolution
  webserver.addHtml("<tr><td>Resolution:<td>")
  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("<tr><td>Number of lines:<td>")
  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 > 0 and choice5<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
Пример #26
0
    def webform_load(self):  # create html page for settings
        choice1 = self.taskdevicepluginconfig[0]
        options = rpiSerial.serial_portlist()
        if len(options) > 0:
            webserver.addHtml("<tr><td>Serial Device:<td>")
            webserver.addSelector_Head("p206_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("Address of the USB-RS485 converter")
        else:
            webserver.addFormNote("No serial ports found")
        webserver.addFormNumericBox("Slave address", "p206_saddr",
                                    self.taskdevicepluginconfig[1], 1, 247)

        webserver.addFormNote(
            "Default address is 1. Use 'pzemaddress,[currentaddress],[newaddress]' command to change it"
        )
        if self.taskname == "":
            choice1 = 0
            choice2 = 1
            choice3 = 3
            choice4 = 5
        else:
            choice1 = self.taskdevicepluginconfig[2]
            choice2 = self.taskdevicepluginconfig[3]
            choice3 = self.taskdevicepluginconfig[4]
            choice4 = self.taskdevicepluginconfig[5]
        options = ["None", "Volt", "Amper", "Watt", "Wh", "Hz", "PwrFact"]
        optionvalues = [-1, 0, 1, 3, 5, 7, 8]
        webserver.addFormSelector("Indicator1", "plugin_206_ind0",
                                  len(options), options, optionvalues, None,
                                  choice1)
        webserver.addFormSelector("Indicator2", "plugin_206_ind1",
                                  len(options), options, optionvalues, None,
                                  choice2)
        webserver.addFormSelector("Indicator3", "plugin_206_ind2",
                                  len(options), options, optionvalues, None,
                                  choice3)
        webserver.addFormSelector("Indicator4", "plugin_206_ind3",
                                  len(options), options, optionvalues, None,
                                  choice4)
        return True
Пример #27
0
 def webform_load(self):  # create html page for settings
     webserver.addFormTextBox("Device Address", "plugin_513_addr",
                              str(self.taskdevicepluginconfig[0]), 20)
     webserver.addFormNote(
         "Enable blueetooth then <a href='blescanner'>scan LYWSD02 address</a> first."
     )
     webserver.addFormNote(
         "This plugin may not work well with ble scanner plugin.")
     webserver.addFormCheckBox("Add Battery value for non-Domoticz system",
                               "plugin_513_bat",
                               self.taskdevicepluginconfig[1])
     webserver.addFormCheckBox("Set LYWSD time at startup", "plugin_513_t",
                               self.taskdevicepluginconfig[2])
     webserver.addFormNumericBox(
         "Force to release BLE queue if blocked for x seconds",
         "plugin_513_free", self.taskdevicepluginconfig[3], 5, 240)
     webserver.addUnit('s')
     return True
Пример #28
0
 def webform_load(self):  # create html page for settings
     webserver.addFormTextBox("Server", "server", self.server, 64)
     options = ["Plain", "SSL"]
     optionvalues = [0, 1]
     webserver.addFormSelector("Protocol", "security", len(options),
                               options, optionvalues, None, self.security)
     webserver.addFormNumericBox("Port", "port", self.port, 1, 65535)
     webserver.addFormTextBox("Sender", "sender", self.sender, 64)
     webserver.addFormTextBox("Receiver", "receiver", self.receiver, 64)
     webserver.addFormTextBox("SMTP login name", "login", self.login, 64)
     webserver.addFormPasswordBox("STMP password", "passw", self.passw, 64)
     webserver.addFormTextBox("Subject", "subject", self.subject, 64)
     webserver.addHtml(
         "<TR><TD>Body:<TD><textarea name='body' rows='5' cols='80' size=512 wrap='off'>"
     )
     webserver.addHtml(str(self.body))
     webserver.addHtml("</textarea>")
     return True
Пример #29
0
    def webform_load(self):
        cmd1 = str(self.taskdevicepluginconfig[0])
        if '"' in cmd1 or "'" in cmd1:
            cmd1 = urllib.parse.quote(cmd1)
        cmd2 = str(self.taskdevicepluginconfig[1])
        if '"' in cmd2 or "'" in cmd2:
            cmd2 = urllib.parse.quote(cmd2)
        webserver.addFormTextBox("Command 0", "plugin_511_cmd0", cmd1, 512)
        webserver.addFormTextBox("Command 1", "plugin_511_cmd1", cmd2, 512)
        webserver.addFormNote(
            "Specify OS commands that has to be executed at the speficied state (0/1)"
        )
        webserver.addFormCheckBox("Use threading to run in background",
                                  "plugin_511_th",
                                  self.taskdevicepluginconfig[2])
        webserver.addFormCheckBox("Enable parsing command line before execute",
                                  "plugin_511_parse",
                                  self.taskdevicepluginconfig[3])

        options2 = ["None"]
        optionvalues2 = ["_"]
        for t in range(0, len(Settings.Tasks)):
            if (Settings.Tasks[t] and (type(Settings.Tasks[t])
                                       is not bool)) and (t != self.taskindex):
                for v in range(0, Settings.Tasks[t].valuecount):
                    options2.append("T" + str(t + 1) + "-" + str(v + 1) +
                                    " / " + str(Settings.Tasks[t].taskname) +
                                    "-" + str(Settings.Tasks[t].valuenames[v]))
                    optionvalues2.append(str(t) + "_" + str(v))
        webserver.addHtml("<tr><td>Trigger variable:<td>")
        webserver.addSelector_Head("p511_trigger", False)
        ddata = str(self.taskdevicepluginconfig[4])
        for o in range(len(options2)):
            webserver.addSelector_Item(options2[o], optionvalues2[o],
                                       (str(optionvalues2[o]) == str(ddata)),
                                       False)
        webserver.addSelector_Foot()
        webserver.addFormNumericBox("Trigger Low value", "p511_low",
                                    self.taskdevicepluginconfig[5], -65535,
                                    65535)
        webserver.addFormNumericBox("Trigger High value", "p511_high",
                                    self.taskdevicepluginconfig[6], -65535,
                                    65535)
        return True
Пример #30
0
 def webform_load(self):  # create html page for settings
     choice1 = self.taskdevicepluginconfig[0]
     options = ["0x3f", "0x4f", "0x5f", "0x6f", "0x7f"]
     optionvalues = [0x3f, 0x4f, 0x5f, 0x6f, 0x7f]
     webserver.addFormSelector("I2C address", "plugin_011_addr",
                               len(optionvalues), options, optionvalues,
                               None, int(choice1))
     webserver.addFormNote(
         "Enable <a href='pinout'>I2C bus</a> first, than <a href='i2cscanner'>search for the used address</a>! 0x7F address is non-standard, so it may not work!"
     )
     choice2 = self.taskdevicepluginconfig[1]
     options = ["Digital", "Analog"]
     optionvalues = [0, 1]
     webserver.addFormSelector("Type", "plugin_011_ptype", 2, options,
                               optionvalues, None, int(choice2))
     webserver.addFormNumericBox("Port number", "plugin_011_pnum",
                                 self.taskdevicepluginconfig[2], 0, 101)
     webserver.addFormNote("Digital ports 0-13, Analog ports 0-7 (20-27)")
     return True