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_517_dev", len(options), options, optionvalues, None, int(self.taskdevicepluginconfig[2])) webserver.addFormTextBox("Device Address", "plugin_517_addr", str(self.taskdevicepluginconfig[0]), 20) webserver.addFormNote( "Enable blueetooth then <a href='blescanner'>scan LYWSD03 address</a> first." ) webserver.addFormCheckBox("Add Battery value for non-Domoticz system", "plugin_517_bat", self.taskdevicepluginconfig[1]) # webserver.addFormCheckBox("Connect only if BLE local device free","plugin_517_free",self.taskdevicepluginconfig[3]) webserver.addFormNote( "Check if you are using multiple devices and interferences occurs between them." ) return True
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
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.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
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
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): 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
def webform_load(self): # create html page for settings choice1 = self.taskdevicepluginconfig[0] options = ["0x4A"] optionvalues = [0x4A] webserver.addFormSelector("I2C address","plugin_153_addr",len(options),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>!") return True
def webform_load(self): # create html page for settings webserver.addFormNote( "1st GPIO=CLK, 2nd GPIO=DT, BOTH of them needs to be INPUT-PULLUP") choice1 = int(float(self.taskdevicepluginconfig[0])) options = ["1", "2", "3", "4"] optionvalues = [1, 2, 3, 4] webserver.addFormSelector("Step", "p059_step", len(options), options, optionvalues, None, choice1) try: minv = int(self.taskdevicepluginconfig[1]) except: minv = 0 webserver.addFormNumericBox("Limit min.", "p059_min", minv, -65535, 65535) try: maxv = int(self.taskdevicepluginconfig[2]) except: maxv = 100 if minv >= maxv: maxv = minv + 1 webserver.addFormNumericBox("Limit max.", "p059_max", maxv, -65535, 65535) try: bt = int(self.taskdevicepluginconfig[3]) except: bt = 10 webserver.addFormNumericBox("GPIO bounce time", "p059_bounce", bt, 0, 1000) webserver.addUnit("ms") return True
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
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) return True
def webform_load(self): # create html page for settings webserver.addFormNote( "Enable <a href='pinout'>I2C bus</a> first, than <a href='i2cscanner'>search for the used address</a>!" ) choice1 = self.taskdevicepluginconfig[0] options = ["1/2T", "1T", "2T", "4T"] optionvalues = [0, 1, 2, 3] webserver.addFormSelector("Refresh Time Determination", "itime", len(options), options, optionvalues, None, int(choice1)) return True
def webform_load(self): # create html page for settings choice1 = self.taskdevicepluginconfig[0] options = ["0x23", "0x5c"] optionvalues = [0x23, 0x5c] webserver.addFormSelector("I2C address", "plugin_010_addr", 2, 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.addFormCheckBox("Oversampling", "plugin_010_over", self.timer2s) return True
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
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_527_dev",len(options),options,optionvalues,None,int(self.taskdevicepluginconfig[4])) webserver.addFormTextBox("Remote Device Address","plugin_527_addr",str(self.address),20) webserver.addFormNote("Supported device types: LYWSD02, CGQ, CGG1, MiFlora") webserver.addFormNote("If you are using Sniffer, its not the best idea to use another BLE plugin at the same time. Although multiple sniffer tasks can be used.") choice1 = self.taskdevicepluginconfig[0] choice2 = self.taskdevicepluginconfig[1] choice3 = self.taskdevicepluginconfig[2] choice4 = self.taskdevicepluginconfig[3] options = ["None","Temperature","Humidity","Light","Moisture","Fertility","Battery","RSSI"] optionvalues = [-1,4,6,7,8,9,10,200] webserver.addFormSelector("Indicator1","plugin_527_ind0",len(optionvalues),options,optionvalues,None,choice1) webserver.addFormSelector("Indicator2","plugin_527_ind1",len(optionvalues),options,optionvalues,None,choice2) webserver.addFormSelector("Indicator3","plugin_527_ind2",len(optionvalues),options,optionvalues,None,choice3) webserver.addFormSelector("Indicator4","plugin_527_ind3",len(optionvalues),options,optionvalues,None,choice4) try: if self.taskdevicepluginconfig[5]<1: self.taskdevicepluginconfig[5] = self.blescanner.scantime except: pass try: if self.taskdevicepluginconfig[6]<1: self.taskdevicepluginconfig[6] = self.blescanner.minsleep except: pass try: if self.taskdevicepluginconfig[7]<1: self.taskdevicepluginconfig[7] = self.blescanner.maxsleep except: pass if self.taskdevicepluginconfig[5]<1: self.taskdevicepluginconfig[5]=5 if self.taskdevicepluginconfig[6]<1: self.taskdevicepluginconfig[6]=10 if self.taskdevicepluginconfig[7]<1: self.taskdevicepluginconfig[7]=30 webserver.addFormNumericBox("Scan time","plugin_527_scantime",self.taskdevicepluginconfig[5],5,60) webserver.addUnit('s') webserver.addFormNumericBox("Minimal pause after scan","plugin_527_minsleep",self.taskdevicepluginconfig[6],5,60) webserver.addUnit('s') webserver.addFormNumericBox("Maximal pause after scan","plugin_527_maxsleep",self.taskdevicepluginconfig[7],10,120) webserver.addUnit('s') return True
def webform_load(self): # create html page for settings choice1 = self.taskdevicepluginconfig[0] options = [ "0x18", "0x19", "0x1a", "0x1b", "0x1c", "0x1d", "0x1e", "0x1f" ] optionvalues = [0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f] webserver.addFormSelector("Address", "plugin_202_addr", len(options), 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>!" ) return True
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
def webform_load(self): # create html page for settings options = ["MCP3008","MCP3208"] optionvalues = [3008,3208] webserver.addFormSelector("ADC type","p210_type",len(options),options,optionvalues,None,int(self.taskdevicepluginconfig[3])) choice3 = self.taskdevicepluginconfig[2] options = [] optionvalues = [] for i in range(8): options.append("CH"+str(i)) optionvalues.append(int(i)) webserver.addFormSelector("Channel number","p210_chan",len(options),options,optionvalues,None,int(choice3)) webserver.addFormCheckBox("Oversampling","p210_over",self.timer1s) return True
def webform_load(self): # create html page for settings webserver.addFormTextBox("Device Address", "plugin_515_addr", str(self.taskdevicepluginconfig[0]), 20) webserver.addFormNote( "Enable blueetooth then <a href='blescanner'>scan 'Flower care' address</a> first." ) choice1 = self.taskdevicepluginconfig[1] choice2 = self.taskdevicepluginconfig[2] choice3 = self.taskdevicepluginconfig[3] choice4 = self.taskdevicepluginconfig[4] options = [ "None", "Temperature", "Brightness", "Moisture", "Conductivity", "Battery" ] optionvalues = [0, 1, 2, 3, 4, 5] webserver.addFormSelector("Indicator1", "plugin_515_ind0", len(options), options, optionvalues, None, choice1) webserver.addFormSelector("Indicator2", "plugin_515_ind1", len(options), options, optionvalues, None, choice2) webserver.addFormSelector("Indicator3", "plugin_515_ind2", len(options), options, optionvalues, None, choice3) webserver.addFormSelector("Indicator4", "plugin_515_ind3", len(options), options, optionvalues, None, choice4) return True
def webform_load(self): # create html page for settings choice1 = self.taskdevicepluginconfig[0] options = ["ADS1015", "ADS1115"] optionvalues = [10, 11] webserver.addFormSelector("Type", "plugin_025_type", 2, options, optionvalues, None, int(choice1)) choice2 = self.taskdevicepluginconfig[1] options = ["0x48", "0x49", "0x4A", "0x4B"] optionvalues = [0x48, 0x49, 0x4a, 0x4b] webserver.addFormSelector("Address", "plugin_025_addr", 4, options, optionvalues, None, int(choice2)) webserver.addFormNote( "Enable <a href='pinout'>I2C bus</a> first, than <a href='i2cscanner'>search for the used address</a>!" ) choice3 = self.taskdevicepluginconfig[2] options = ["2/3", "1", "2", "4", "8", "16"] optionvalues = [(2 / 3), 1, 2, 4, 8, 16] webserver.addFormSelector("Gain", "plugin_025_gain", len(optionvalues), options, optionvalues, None, float(choice3)) choice4 = self.taskdevicepluginconfig[3] options = ["A0", "A1", "A2", "A3"] optionvalues = [0, 1, 2, 3] webserver.addFormSelector("Analog pin", "plugin_025_apin", 4, options, optionvalues, None, int(choice4)) webserver.addFormCheckBox("Oversampling", "plugin_025_over", self.timer1s) return True
def webform_load(self): # create html page for settings try: choice1 = int(self.taskdevicepluginconfig[0]) except: choice1 = 0 try: choice2 = int(self.taskdevicepluginconfig[1]) except: choice2 = 0 try: choice3 = int(self.taskdevicepluginconfig[2]) except: choice3 = 0 try: choice4 = int(self.taskdevicepluginconfig[3]) except: choice4 = 0 try: options = ["None","Uptime","Free RAM", "Wifi RSSI","System load","CPU Temp"] optionvalues = [0,1,2,3,4,5] webserver.addFormSelector("Indicator1","plugin_026_ind0",len(options),options,optionvalues,None,choice1) webserver.addFormSelector("Indicator2","plugin_026_ind1",len(options),options,optionvalues,None,choice2) webserver.addFormSelector("Indicator3","plugin_026_ind2",len(options),options,optionvalues,None,choice3) webserver.addFormSelector("Indicator4","plugin_026_ind3",len(options),options,optionvalues,None,choice4) except Exception as e: misc.addLog(rpieGlobals.LOG_LEVEL_ERROR,"P026 load "+str(e)) return True