USB battery serial connection handling in Victron D-Bus driver

Hi,

I am working on a custom battery driver for Victron Venus OS.

The driver reads battery data through a USB serial connection and publishes the battery values to D-Bus paths.

I want to know the recommended way to handle the USB serial connection.

Should the driver keep the serial port open as long as the battery is connected, or should it open the port, read the battery data, publish the values to D-Bus, and then close the port after each read?

Thank you

There already are third party drivers for this.
Coupling with virtual battery devices in nodered also negates a lot of the need to modify the OS.