Exemplo n.º 1
0
 def webform_load(self):
     if Settings.SoundSystem["usable"] == False:
         webserver.addHtml(
             "<tr><td><td><font color='red'>The sound system can not be used!</font>"
         )
     else:
         if len(self.languages) < 1:
             try:
                 self.languages = gtts.lang.tts_langs()
             except Exception as e:
                 misc.addLog(rpieGlobals.LOG_LEVEL_ERROR, str(e))
         options = []
         optionvalues = []
         if len(self.languages) > 0:
             for l in self.languages:
                 options.append(l + " " + self.languages[l])
                 optionvalues.append(l)
         webserver.addHtml("<tr><td>Language:<td>")
         webserver.addSelector_Head("p521_lang", False)
         for o in range(len(options)):
             try:
                 webserver.addSelector_Item(
                     options[o], optionvalues[o],
                     (str(optionvalues[o]) == str(self.lang)), False)
             except Exception as e:
                 print(e)
         webserver.addSelector_Foot()
         webserver.addFormNote(
             "Either taskvalueset or say command can be used to speak text."
         )
     return True
Exemplo n.º 2
0
 def webform_load(self):
     choice1 = self.taskdevicepluginconfig[0]
     try:
         options = utemper.get_select_list()
     except:
         options = []
     if len(options) > 0:
         webserver.addHtml("<tr><td>Device:<td>")
         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
Exemplo n.º 3
0
 def webform_load(self): # create html page for settings
  global analogpins,realanalog,rpiok
  if realanalog:
   self.taskdevicepluginconfig[0] = 0
   webserver.addHtml("<tr><td>Analog input pin:<td>")
   webserver.addSelector_Head("p002_ain",False)
   for d in range(len(analogpins)):
    webserver.addSelector_Item(analogpins[d][1],analogpins[d][0],(self.taskdevicepluginconfig[1]==analogpins[d][0]),False)
   webserver.addSelector_Foot()
  elif rpiok:
   webserver.addFormNote("Pin1 is A, Pin2 is B, for wiring, see <a href='https://github.com/simonmonk/pi_analog'>https://github.com/simonmonk/pi_analog</a>")
   choice0 = self.taskdevicepluginconfig[0]
   options = ["Analog","Resistance","Thermistor"]
   optionvalues = [0,1,2]
   webserver.addFormSelector("Result Type","p002_type",len(options),options,optionvalues,None,choice0)
   webserver.addFormFloatNumberBox("C1 capacitor", "p002_c1", self.taskdevicepluginconfig[1], 0, 1000000.0)
   webserver.addUnit("uF")
   webserver.addFormNumericBox("R1 resistor","p002_r1",self.taskdevicepluginconfig[2])
   webserver.addUnit("Ohm")
   webserver.addFormFloatNumberBox("Vt voltage (digital HIGH level)", "p002_vt", self.taskdevicepluginconfig[3], 0, 3.3)
   webserver.addUnit("V")
   webserver.addFormNote("Settings below are only valid for thermistor type!")
   webserver.addFormNumericBox("Thermistor resistance","p002_tr",self.taskdevicepluginconfig[4])
   webserver.addUnit("Ohm")
   webserver.addFormNumericBox("Thermistor Beta","p002_tb",self.taskdevicepluginconfig[5])
  return True
Exemplo n.º 4
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
Exemplo n.º 5
0
    def webform_load(self):
        choice0 = self.taskdevicepluginconfig[0]
        options0 = self.serial_portlist()
        if len(options0) > 0:
            webserver.addHtml("<tr><td>Serial Device:<td>")
            webserver.addSelector_Head("p514_addr", False)
            for o in range(len(options0)):
                webserver.addSelector_Item(options0[o], options0[o],
                                           (str(options0[o]) == str(choice0)),
                                           False)
            webserver.addSelector_Foot()

            choice1 = self.taskdevicepluginconfig[1]
            options1 = self.find_dsb_devices()
            if len(options1) > 0:
                webserver.addHtml("<tr><td>Device Address:<td>")
                webserver.addSelector_Head("p514_id", True)
                for o in range(len(options1)):
                    webserver.addSelector_Item(
                        options1[o], options1[o],
                        (str(options1[o]) == str(choice1)), False)
                webserver.addSelector_Foot()
            else:
                webserver.addFormNote("No DS18B20 found on bus!")
        else:
            webserver.addFormNote("No serial port found!")
        webserver.addFormNote(
            "You have to connect the Ds18B20 through an USB-Serial adapter!")
        return True
Exemplo n.º 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
Exemplo n.º 7
0
 def webform_load(self):  # create html page for settings
     options = [
         'MCP3422', 'MCP3423', 'MCP3424', 'MCP3426', 'MCP3427', 'MCP3428'
     ]
     webserver.addHtml("<tr><td>Type:<td>")
     webserver.addSelector_Head("plugin_215_type", False)
     for o in range(len(options)):
         webserver.addSelector_Item(
             str(options[o]), str(options[o]),
             (str(options[o]) == str(self.taskdevicepluginconfig[0])),
             False)
     webserver.addSelector_Foot()
     choice2 = self.taskdevicepluginconfig[1]
     options = [
         "0x68", "0x69", "0x6A", "0x6B", "0x6C", "0x6D", "0x6E", "0x6F"
     ]
     optionvalues = [0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F]
     webserver.addFormSelector("Address", "plugin_215_addr",
                               len(optionvalues), 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_215_gain", len(optionvalues),
                               options, optionvalues, None, float(choice3))
     choice4 = self.taskdevicepluginconfig[3]
     options = ["CH1", "CH2", "CH3", "CH4"]
     optionvalues = [0, 1, 2, 3]
     webserver.addFormSelector("Channel", "plugin_215_apin", 4, options,
                               optionvalues, None, int(choice4))
     return True
Exemplo n.º 8
0
    def webform_load(self):
        choosendev = self.taskdevicepluginconfig[0]
        choosenrel = self.taskdevicepluginconfig[1]
        try:
            relaynum = vusb.usbrelay.getrelaynum()
        except:
            relaynum = 0
        try:
            relayids = vusb.usbrelay.getcompatibledevlist()
        except:
            relayids = []
        if relaynum > 0 and len(relayids) > 0:
            webserver.addHtml("<tr><td>Device ID:<td>")
            webserver.addSelector_Head("p501_relayname", True)
            for i in range(len(relayids)):
                webserver.addSelector_Item(relayids[i][2], relayids[i][2],
                                           (relayids[i][2] == choosendev),
                                           False)
            webserver.addSelector_Foot()

            webserver.addHtml("<tr><td>Relay number on device:<td>")
            webserver.addSelector_Head("p501_relaynum", True)
            for r in range(1, relaynum + 1):
                webserver.addSelector_Item(r, r, (r == int(choosenrel)), False)
            webserver.addSelector_Foot()

        return True
Exemplo n.º 9
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
Exemplo n.º 10
0
 def webform_load(self):
  if Settings.SoundSystem["usable"]==False:
   webserver.addHtml("<tr><td><td><font color='red'>The sound system can not be used!</font>")
  else:
   webserver.addFormNote("Download <a href='https://github.com/badaix/snapcast/releases/latest'>latest snapclient</a> manually and install to your system! (armhf=Raspberry, amd64=x64 PC)")
   webserver.addFormNote("Enable/disable snapclient receiver - if snapclient started its blocking Alsa from other PyGame based sound plugins!")
   optionvalues = [0,1,2]
   options = ["No change","Stop","Start"]
   webserver.addFormSelector("Change state at plugin init","p525_stat",len(options),options,optionvalues,None,self.taskdevicepluginconfig[0])
  return True
Exemplo n.º 11
0
 def webform_load(self):
  if Settings.SoundSystem["usable"]==False:
   webserver.addHtml("<tr><td><td><font color='red'>The sound system can not be used!</font>")
  else:
   maxlevel = rpieGlobals.PLUGIN_CONFIGVAR_MAX
   if maxlevel>10:
    maxlevel = 10
   for c in range(1,maxlevel+1):
    webserver.addFormTextBox("Level "+str(c*10),"p505_lvl_"+str(c*10),str(self.taskdevicepluginconfig[c]),180)
    webserver.addBrowseButton("Browse","p505_lvl_"+str(c*10),startdir=str(self.taskdevicepluginconfig[c]))
   webserver.addFormNote("Specify file names/network URI for every level, that is needed!")
  return True
Exemplo n.º 12
0
 def webform_load(self):
  choice1 = self.taskdevicepluginconfig[0]
  options = self.get_evdevs()
  if len(options)>0:
   webserver.addHtml("<tr><td>EvDev Device:<td>")
   webserver.addSelector_Head("p509_addr",False)
   for o in range(len(options)):
    webserver.addSelector_Item(options[o],options[o],(str(options[o])==str(choice1)),False)
   webserver.addSelector_Foot()
  else:
   webserver.addFormNote("/dev/input/event* not found")
  return True
Exemplo n.º 13
0
 def webform_load(self): # create html page for settings
  choice1 = str(self.taskdevicepluginconfig[0]) # store display type
  options = ["PCF8574","MCP23008","MCP23017","MCP23017/B"]
  webserver.addHtml("<tr><td>I2C chip type:<td>")
  webserver.addSelector_Head("p012_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
  optionvalues = []
  for i in range(0x20,0x28):
   optionvalues.append(i)
  for i in range(0x38,0x40):
   optionvalues.append(i)
  options = []
  for i in range(len(optionvalues)):
   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("<tr><td>Resolution:<td>")
  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)
  webserver.addFormPinSelect("Display button","taskdevicepin0",self.taskdevicepin[0])
  return True
Exemplo n.º 14
0
 def webform_load(self):
     if Settings.SoundSystem["usable"] == False:
         webserver.addHtml(
             "<tr><td><td><font color='red'>The sound system can not be used!</font>"
         )
     else:
         webserver.addFormTextBox("Directory", "p503_dir",
                                  str(self.taskdevicepluginconfig[0]), 120)
         webserver.addBrowseButton("Browse",
                                   "p503_dir",
                                   startdir=str(
                                       self.taskdevicepluginconfig[0]))
         webserver.addFormNote(
             "Specify directory where .MP3 files located!")
     return True
Exemplo n.º 15
0
 def webform_load(self):
     choice1 = self.taskdevicepluginconfig[0]
     options = self.find_dsb_devices()
     if len(options) > 0:
         webserver.addHtml("<tr><td>Device Address:<td>")
         webserver.addSelector_Head("p004_addr", True)
         for o in range(len(options)):
             webserver.addSelector_Item(options[o], options[o],
                                        (str(options[0]) == str(choice1)),
                                        False)
         webserver.addSelector_Foot()
     webserver.addFormNote(
         "You have to setup one pin (at least) for <b>1WIRE</b> type at <a href='pinout'>pinout settings page</a> before use!"
     )
     return True
Exemplo n.º 16
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
Exemplo n.º 17
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
Exemplo n.º 18
0
 def webform_load(self):
     if Settings.SoundSystem["usable"] == False:
         webserver.addHtml(
             "<tr><td><td><font color='red'>The sound system can not be used!</font>"
         )
     else:
         maxlevel = rpieGlobals.PLUGIN_CONFIGVAR_MAX
         if maxlevel > 10:
             maxlevel = 10
         for c in range(1, maxlevel + 1):
             webserver.addFormTextBox("Level " + str(c * 10),
                                      "p502_lvl_" + str(c * 10),
                                      str(self.taskdevicepluginconfig[c]),
                                      120)
             webserver.addBrowseButton("Browse",
                                       "p502_lvl_" + str(c * 10),
                                       startdir=str(
                                           self.taskdevicepluginconfig[c]))
         webserver.addFormNote(
             "Specify file names with relative pathname for every level, that is needed!"
         )
         optionvalues = []
         options = []
         for i in range(-1, 20):
             optionvalues.append(i)
             if i == -1:
                 options.append("Forever")
             else:
                 options.append(str(i))
         try:
             loop = int(self.loopcount)
         except:
             self.loopcount = -1
             loop = -1
         webserver.addFormSelector("Loop count", "p502_loop",
                                   len(optionvalues), options, optionvalues,
                                   None, loop)
         webserver.addFormNote(
             "Default is Forever in this mode sound will repeat until LEVEL 0 asked. As it is running in background there is no way you know if playing is ended actually if using specific loop count!"
         )
     return True
Exemplo n.º 19
0
 def webform_load(self):
  choice1 = self.taskdevicepluginconfig[0]
  options = rpiSerial.serial_portlist()
  if len(options)>0:
   webserver.addHtml("<tr><td>Serial Device:<td>")
   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("<tr><td>Parity:<td>")
   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
   webserver.addUnit("byte")
   choice6 = self.taskdevicepluginconfig[6]
   options = ["Hex values","String"]
   optionvalues = [0,1]
   webserver.addFormSelector("Data format","p201_fmt",len(optionvalues),options,optionvalues,None,int(choice6))
  else:
   webserver.addFormNote("No serial ports found")
  return True
Exemplo n.º 20
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
Exemplo n.º 21
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
Exemplo n.º 22
0
 def webform_load(self):  # create html page for settings
     webserver.addFormTextBox("Teams channel Webhook URL", "fullurl",
                              self.fullurl, 512)
     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
Exemplo n.º 23
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
Exemplo n.º 24
0
 def webform_load(self):  # create html page for settings
     try:
         options2 = ["None"]
         optionvalues2 = ["_"]
         for t in range(0, len(Settings.Tasks)):
             if (Settings.Tasks[t]
                     and (type(Settings.Tasks[t]) is not bool)):
                 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.addFormNumericBox("Number of relays", "p216_relays",
                                     self.taskdevicepluginconfig[0], 1, 8)
         webserver.addFormNote(
             "Basic fake Tasmota HTTP command API for Android apps: Tasmota Remota, Tasmota Control, HomeSwitch"
         )
         webserver.addFormNote(
             "Select tasks below which you need to access from Android app. Only On/Off supported!"
         )
         for r in range(8):
             webserver.addFormSubHeader("Relay " + str(r + 1))
             webserver.addHtml("<tr><td>Controlled task:<td>")
             ddata = self.datas[r][0]
             webserver.addSelector_Head("p216_tv_" + str(r), False)
             for o in range(len(options2)):
                 webserver.addSelector_Item(
                     options2[o], optionvalues2[o],
                     (str(optionvalues2[o]) == str(ddata)), False)
             webserver.addSelector_Foot()
             webserver.addFormTextBox("Relay friendly name",
                                      "p216_tvn_" + str(r),
                                      self.datas[r][1], 64)
     except Exception as e:
         return False
     return True
Exemplo n.º 25
0
    def webform_load(self):
        choice1 = self.taskdevicepluginconfig[0]
        options = rpiSerial.serial_portlist()
        webserver.addFormNote(
            "For RPI use 'raspi-config' tool: 5- Interfacing Options-P6 Serial- (Kernel logging disabled + serial port hardware enabled) before enable this plugin"
        )
        if len(options) > 0:
            webserver.addHtml("<tr><td>Serial Device:<td>")
            webserver.addSelector_Head("p049_addr", False)
            for o in range(len(options)):
                webserver.addSelector_Item(options[o], options[o],
                                           (str(options[o]) == str(choice1)),
                                           False)
            webserver.addSelector_Foot()

            choice2 = self.taskdevicepluginconfig[1]
            options = ["Enabled (Normal)", "Disabled"]
            optionvalues = [0, 1]
            webserver.addFormSelector("Auto Base Calibration", "p049_abc",
                                      len(optionvalues), options, optionvalues,
                                      None, int(choice2))
        else:
            webserver.addFormNote("No serial ports found")
        return True
Exemplo n.º 26
0
 def webform_load(self):
     try:
         choice1 = self.taskdevicepluginconfig[0]
         options = find_lirc_devices()
         if len(options) > 0:
             webserver.addHtml("<tr><td>LIRC device<td>")
             webserver.addSelector_Head("p016_dev", False)
             for o in range(len(options)):
                 webserver.addSelector_Item(
                     options[o], options[o],
                     (str(options[o]) == str(choice1)), False)
             webserver.addSelector_Foot()
         else:
             webserver.addFormNote("/dev/lirc* not found")
             return False
         webserver.addFormNote(
             "Select a receiver LIRC device (lirc-rx)! Do not forget to set the Data pin to IR-RX <a href='pinout'>at pinout settings</a>!"
         )
     except Exception as e:
         print(e)
     try:
         supprot = get_ir_supported_protocols()
         enprot = get_ir_enabled_protocols()
         webserver.addRowLabel("Enabled protocols")
         for s in range(len(supprot)):
             webserver.addHtml(
                 "<label class='container' style='height:30px'>" +
                 supprot[s] + " <input type='checkbox' id='")
             webserver.addHtml("_" + supprot[s] + "' name='_" + supprot[s] +
                               "'")
             if (supprot[s] in enprot):
                 webserver.addHtml(" checked")
             webserver.addHtml("><span class='checkmark'></span></label>")
     except Exception as e:
         print(e)
     return True
Exemplo n.º 27
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("p208_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 FPM serial port")
  else:
   webserver.addFormNote("No serial ports found")
  options = ["None", "Valid", "Position","SHA2"]
  optionvalues = [0, 1, 2,3]
  webserver.addFormSelector("Indicator1","plugin_208_ind0",len(options),options,optionvalues,None,self.taskdevicepluginconfig[1])
  webserver.addFormSelector("Indicator2","plugin_208_ind1",len(options),options,optionvalues,None,self.taskdevicepluginconfig[2])
  webserver.addFormSelector("Indicator3","plugin_208_ind2",len(options),options,optionvalues,None,self.taskdevicepluginconfig[3])
  if self.enabled and self.initialized:
   try:
    webserver.addFormNote("Stored fingerprints: "+ str(self.fp.getTemplateCount())+"/"+str(self.fp.getStorageCapacity()))
   except:
    pass
  webserver.addHtml("<tr><td><a href='/finger'>Management page</a>")
  return True
Exemplo n.º 28
0
 def webform_load(self):
     try:
         choice1 = self.taskdevicepluginconfig[0]
         options = find_lirc_devices()
         if len(options) > 0:
             webserver.addHtml("<tr><td>LIRC device<td>")
             webserver.addSelector_Head("p035_dev", False)
             for o in range(len(options)):
                 webserver.addSelector_Item(
                     options[o], options[o],
                     (str(options[o]) == str(choice1)), False)
             webserver.addSelector_Foot()
         else:
             webserver.addFormNote("/dev/lirc* not found")
             return False
         webserver.addFormNote(
             "Select a transceiver LIRC device (lirc-tx)! Do not forget to set the Data pin to IR-PWM or IR-TX <a href='pinout'>at pinout settings</a>!"
         )
         webserver.addFormNote(
             "According to documentation, only GPIO18 or GPIO12 is supported as IR-PWM!"
         )
     except Exception as e:
         print(e)
     return True
Exemplo n.º 29
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
Exemplo n.º 30
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