setup the serial device from the command line and update the venus start script

This commit is contained in:
Tobi177 2020-07-26 00:08:10 +02:00
parent a6fe61c37c
commit 5c042aa56f
2 changed files with 4 additions and 5 deletions

View file

@ -39,10 +39,12 @@ parser = argparse.ArgumentParser(description = 'Chargery BMS driver')
parser.add_argument('--version', action='version', version='%(prog)s v' + str(driver['version']) + ' (' + driver['serial'] + ')')
parser.add_argument('--test', action="store_true", help='test some stored examples network packets')
parser.add_argument('--victron', action="store_true", help='enable Victron DBUS support for VenusOS')
requiredArguments = parser.add_argument_group('required arguments')
requiredArguments.add_argument('-d', '--device', help='serial device for data (eg /dev/ttyUSB0)', required=True)
args = parser.parse_args()
serial_port = serial.Serial('/dev/ttyUSB0', 115200, timeout=1)
serial_port = serial.Serial(args.device, 115200, timeout=1)
serial_port.flushInput()
logging.info(serial_port.name)

View file

@ -10,7 +10,4 @@
. /opt/victronenergy/serial-starter/run-service.sh
app="/usr/bin/python /opt/victronenergy/chargerybms/chargerybms.py"
verbose="--victron -v --log-before 25 --log-after 25"
timeout=3
start $verbose -t $timeout --banner -s /dev/$tty
start -d /dev/$tty --victron