def __init__(self, portname='/dev/USB0', slaveaddress=247, baudrate=9600, timeout=0.5):
    minimalmodbus.Instrument.__init__(self, portname, slaveaddress)
    self.serial.baudrate = baudrate
    self.serial.timeout = timeout
    self.address = slaveaddress
    self.amps = 0
    self.unitVolts = 0
    self.cellVolts = []
    self.numCells = 4
    self.capacity = 0
    self.maxCapacity = 0
    self.percentage = 0
    self.state = 'Error'
    self.heater = False
    self.cellTemp = []
    self.cycles = 0
    self.batSerial = ''
    try:
        self.numCells = self.read_register(5000)
    except Exception as e:
        print('Error getting number of cells')
    try:
        self.batSerial = self.read_registers(5110, 6)
    except Exception as e:
        print('Error reading the serial number')
def __init__(self, portname='/dev/USB0', slaveaddress=247, baudrate=9600, timeout=0.5):
    minimalmodbus.Instrument.__init__(self, portname, slaveaddress)
    self.serial.baudrate = baudrate
    self.serial.timeout = timeout
    self.address = slaveaddress
    self.amps = 0
    self.unitVolts = 0
    self.cellVolts = []
    self.numCells = 4
    self.capacity = 0
    self.maxCapacity = 0
    self.percentage = 0
    self.state = 'Error'
    self.heater = False
    self.cellTemp = []
    self.cycles = 0
    self.batSerial = 
    try:
        self.numCells = self.read_register(5000)
    except Exception as e:
        print('Error getting number of cells')
    try:
        self.batSerial = self.read_registers(5110, 6)
    except Exception as e:
        print('Error reading the serial number')