def webform_load(self): # create html page for settings bledevs = BLEHelper.find_hci_devices() options = [] optionvalues = [] if bledevs: for bd in bledevs: options.append(bd) try: optionvalues.append(int(bd[3:])) except: optionvalues.append(bd[3:]) webserver.addFormSelector("Local Device", "plugin_520_dev", len(options), options, optionvalues, None, int(self.taskdevicepluginconfig[2])) webserver.addFormTextBox("Remote Device Address", "plugin_520_addr", str(self.taskdevicepluginconfig[0]), 20) webserver.addFormCheckBox("Add RSSI value for non-Domoticz system", "plugin_520_rssi", self.taskdevicepluginconfig[1]) webserver.addFormNote( "For Domoticz it's integrated with online value!") webserver.addFormFloatNumberBox("Timeout", "plugin_520_tout", float(self.taskdevicepluginconfig[3]), 0, 60) webserver.addUnit("s") options = ["State", "State or RSSI"] optionvalues = ["0", "1"] webserver.addFormSelector("Report on change of", "plugin_520_rep", len(options), options, optionvalues, None, int(self.taskdevicepluginconfig[4])) return True
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
def webform_load(self): webserver.addFormTextBox("Remote station address", "plugin_126_addr", str(self.taskdevicepluginconfig[0]), 128) webserver.addFormFloatNumberBox("Timeout", "plugin_126_timeout", float(self.taskdevicepluginconfig[1]), 0, 20) webserver.addUnit("s") webserver.addFormNote("Ping3 icmp will only work with ROOT rights!") return True
def webform_load(self): # create html page for settings 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
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
def webform_load(self): webserver.addFormNote("IP and Port parameter is not used!") webserver.addFormNote("SX127x hardware supported by pyLoRa library") webserver.addHtml("<p>Example sender sketches could be find <a href='https://github.com/enesbcs/EasyLora'>here</a>.") # if self.lora is not None: # webserver.addFormNote("LoRa version: "+str(self.lora.get_version())) try: webserver.addTableSeparator("Hardware settings",2,3) if BOARD.SPI_BUS==0: webserver.addHtml("<tr><td>SPI0 selected<td><i>(MOSI=GPIO10, MISO=GPIO9, SCK=GPIO11, NSS=GPIO8)</i>") spiok = False if gpios.HWPorts.is_spi_usable(BOARD.SPI_BUS): if gpios.HWPorts.is_spi_enabled(BOARD.SPI_BUS): webserver.addHtml(" - <b>SPI0 enabled</b>") spiok = True if spiok==False: webserver.addHtml("<tr><td><td>Enable SPI0 first at hardware <a href='pinout'>pinout page</a>!") else: webserver.addHtml("<tr><td><td>You have modified BOARD constants, so you are an expert!") webserver.addHtml("<tr><td>DIO0 (IRQ)<td>GPIO"+str(BOARD.DIO0)) webserver.addHtml("<tr><td>DIO1<td>GPIO"+str(BOARD.DIO1)) webserver.addHtml("<tr><td>DIO2<td>GPIO"+str(BOARD.DIO2)) webserver.addHtml("<tr><td>DIO3<td>GPIO"+str(BOARD.DIO3)) webserver.addHtml("<tr><td>RST<td>GPIO"+str(BOARD.RST)) webserver.addTableSeparator("LoRa settings",2,3) webserver.addFormFloatNumberBox("Frequency","freq",self.freq,433,928) webserver.addUnit("Mhz") if self.lora is not None: try: afreq = self.lora.get_freq() except: afreq = "UNINITIALIZED" webserver.addFormNote("Current frequency: "+str(afreq)+" Mhz") webserver.addFormNote("Please check local regulations for your selected frequency!") options = ["10%","1%","0.1%"] optionvalues = [10,100,1000] webserver.addFormSelector("Duty cycle","duty",len(optionvalues),options,optionvalues,None,self.duty) webserver.addFormNote("Please check your local Duty cycle regulations for your selected frequency!") webserver.addFormNumericBox("Spreading factor","spreading",self.sf,6,12) options = ["7.8","10.4","15.6","20.8","31.25","41.7","62.5","125","250","500"] optionvalues = [BW.BW7_8, BW.BW10_4, BW.BW15_6, BW.BW20_8, BW.BW31_25, BW.BW41_7, BW.BW62_5, BW.BW125, BW.BW250, BW.BW500] webserver.addFormSelector("Bandwidth","bw",len(optionvalues),options,optionvalues,None,self.bw) webserver.addUnit("khz") options = ["CR4/5","CR4/6","CR4/7","CR4/8"] optionvalues = [CODING_RATE.CR4_5,CODING_RATE.CR4_6,CODING_RATE.CR4_7,CODING_RATE.CR4_8] webserver.addFormSelector("Coding rate","coding",len(optionvalues),options,optionvalues,None,self.coding) webserver.addFormNumericBox("Sync Word","sync",self.sync,0,255) webserver.addHtml("( 0x"+format(self.sync, '02x')+" )") webserver.addFormNote("Default 0x12, LoRaWAN is 0x34. Nodes can only communicate each other if uses same sync word!") webserver.addFormCheckBox("Enable Sending","sender",self.enablesend) webserver.addFormNumericBox("Default destination node index","defaultnode",self.defaultunit,0,255) webserver.addFormNote("Default node index for data sending") except Exception as e: misc.addLog(rpieGlobals.LOG_LEVEL_ERROR,str(e)) return True
def webform_load(self): # create html page for settings webserver.addFormCheckBox("Use standard HTML head", "p212_head", self.taskdevicepluginconfig[2]) try: sp = Settings.AdvSettings["startpage"] except: sp = "/" webserver.addFormCheckBox("Set as startpage", "p212_start", (sp == "/dash")) webserver.addHtml("<tr><td>Columns:<td>") webserver.addSelector_Head("p212_cols", False) for o in range(7): webserver.addSelector_Item( str(o), o, (str(o) == str(self.taskdevicepluginconfig[0])), False) webserver.addSelector_Foot() webserver.addHtml("<tr><td>Rows:<td>") webserver.addSelector_Head("p212_rows", False) for o in range(16): webserver.addSelector_Item( str(o), o, (str(o) == str(self.taskdevicepluginconfig[1])), False) webserver.addSelector_Foot() if int(self.taskdevicepluginconfig[0]) > 0 and int( self.taskdevicepluginconfig[1]) > 0: if self.enabled: webserver.addHtml( "<tr><td>Dashboard address:</td><td><a href='dash'>/dash</a></td></tr>" ) options1 = [ "None", "Text", "Binary input", "Switch output", "Meter", "Gauge", "Slider output", "Select output" ] optionvalues1 = [-1, 0, 1, 2, 3, 4, 5, 6] 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)) for r in range(int(self.taskdevicepluginconfig[1])): for c in range(int(self.taskdevicepluginconfig[0])): offs = (r * int(self.taskdevicepluginconfig[0])) + c try: adata = self.celldata[offs] except: adata = {} dtype = -1 if "type" in adata: dtype = int(adata["type"]) webserver.addHtml("<tr><td><b>Cell" + str(offs) + " (y" + str(r) + "x" + str(c) + ")</b><td>") dname = "" if "name" in adata: dname = str(adata["name"]) webserver.addFormTextBox("Name overwrite", "p212_names_" + str(offs), dname, 64) webserver.addFormSelector("Type", "p212_type_" + str(offs), len(options1), options1, optionvalues1, None, dtype) webserver.addHtml("<tr><td>Data source:<td>") ddata = "_" if "data" in adata: ddata = str(adata["data"]) webserver.addSelector_Head("p212_data_" + str(offs), False) for o in range(len(options2)): webserver.addSelector_Item( options2[o], optionvalues2[o], (str(optionvalues2[o]) == str(ddata)), False) webserver.addSelector_Foot() if dtype in (0, 4): try: udata = str(adata["unit"]) except: udata = "" webserver.addFormTextBox("Unit", "p212_unit_" + str(offs), udata, 16) if dtype in (3, 4, 5): try: umin = float(adata["min"]) except: umin = 0 try: umax = float(adata["max"]) except: umax = 100 webserver.addFormFloatNumberBox( "Min value", "p212_min_" + str(offs), umin, -65535.0, 65535.0) webserver.addFormFloatNumberBox( "Max value", "p212_max_" + str(offs), umax, -65535.0, 65535.0) elif dtype == 6: try: uon = str(adata["optionnames"]) except: uon = "" try: uopt = str(adata["options"]) except: uopt = "" webserver.addFormTextBox( "Option name list", "p212_optionnames_" + str(offs), uon, 1024) webserver.addFormTextBox("Option value list", "p212_options_" + str(offs), uopt, 1024) webserver.addFormNote( "Input comma separated values for selector boxes!") return True