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): choice1 = self.taskdevicepluginconfig[0] options = rpiSerial.serial_portlist() if len(options) > 0: webserver.addHtml("<tr><td>Serial Device:<td>") webserver.addSelector_Head("p082_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" ) else: webserver.addFormNote("No serial ports found") webserver.addHtml("<tr><td>Fix:<td>") time.sleep(2) #wait to get reply webserver.addHtml(str(self.validloc)) if self.initialized and self.validloc != 0: webserver.addHtml("<tr><td>Satellites in use:<td>") webserver.addHtml(self.GPSDAT["numSat"]) webserver.addHtml("<tr><td>HDOP:<td>") webserver.addHtml(self.GPSDAT["horDil"]) webserver.addHtml("<tr><td>UTC Time:<td>") gpstime = self.GPSDAT["fixTime"][0:2] + ":" + self.GPSDAT[ "fixTime"][2:4] + ":" + self.GPSDAT["fixTime"][4:6] webserver.addHtml(self.GPSDATE["year"] + "-" + self.GPSDATE["mon"] + "-" + self.GPSDATE["day"] + " " + gpstime) return True
def webform_load(self): misc.addLog(rpieGlobals.LOG_LEVEL_DEBUG_DEV, "Webform Loading") choice1 = self.taskdevicepluginconfig[0] try: options = rpiSerial.serial_portlist() except: options = [] if len(options) > 0: webserver.addHtml("<tr><td>Serial Device:<td>") webserver.addSelector_Head("p082_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( "If using GPIO UART on the RaspberryPi, use 'sudo raspi-config' at the terminal: Select P3- Interface Options, then P6- Serial Port. /n Say NO to Login Shell, then YES to Serial Port, then reboot." ) else: webserver.addFormNote("No serial or USB ports found") webserver.addFormCheckBox("Enable time decoding", "p082_time", self.taskdevicepluginconfig[1]) webserver.addHtml("<tr><td>Fix:<td>") time.sleep(2) # wait to get reply webserver.addHtml(str(self.validloc)) if self.initialized and self.validloc != 0: try: webserver.addHtml("<tr><td>Satellites in use:<td>") webserver.addHtml(self.GPSDAT["numSat"]) webserver.addHtml("<tr><td>HDOP:<td>") webserver.addHtml(self.GPSDAT["horDil"]) except: misc.addLog( rpieGlobals.LOG_LEVEL_ERROR, f"webserver GNSS info failed, initialized {self.initialized}, validloc {self.validloc}" ) pass webserver.addHtml("<tr><td>UTC Time:<td>") notime = True try: webserver.addHtml(f"{str(self.gnssdate)} {str(self.gnsstime)}") notime = False except: pass if notime: #fallback try: gpstime = self.GPSDAT["fixTime"][0:2] + ":" + self.GPSDAT[ "fixTime"][2:4] + ":" + self.GPSDAT["fixTime"][4:6] webserver.addHtml(self.GPSDATE["year"] + "-" + self.GPSDATE["mon"] + "-" + self.GPSDATE["day"] + " " + gpstime) except: pass return True
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
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("p053_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" ) else: webserver.addFormNote("No serial ports found") sensortypes = [ "PMSx003", "PMS3003", "PMS5003S", "PMS5003ST", "PMS5003T", "SDS01x", "SDS198", "HPMA115S0", "HPMA115C0", "SPS30", "MCU680" ] webserver.addHtml("<tr><td>Sensor type:<td>") webserver.addSelector_Head("p053_sensor", False) for o in range(len(sensortypes)): webserver.addSelector_Item( sensortypes[o], sensortypes[o], (str(sensortypes[o]) == str(self.taskdevicepluginconfig[5])), False) webserver.addSelector_Foot() options = [ "None", "PM01", "PM25", "PM04", "PM10", "PM100", "Temperature", "Relative humidity" ] optionvalues = [ "None", "pm01", "pm25", "pm04", "pm10", "pm100", "temp", "rhum" ] for os in range(1, 5): webserver.addHtml("<tr><td>Value" + str(os) + ":<td>") webserver.addSelector_Head("p053_ind" + str(os), False) for o in range(len(options)): webserver.addSelector_Item(options[o], optionvalues[o], (str( optionvalues[o]) == str(self.taskdevicepluginconfig[os])), False) webserver.addSelector_Foot() return True
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
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
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("Input Data format", "p201_fmt", len(optionvalues), options, optionvalues, None, int(choice6)) else: webserver.addFormNote("No serial ports found") return True