-
Notifications
You must be signed in to change notification settings - Fork 83
Description
Summary
The vesmart-server service (/opt/victronenergy/vesmart-server/) disconnects all BLE devices known to BlueZ when its internal 60-second keepalive timer expires — regardless of which adapter the devices are connected to, and regardless of whether the devices are VE.Smart Networking participants.
This makes it impossible to maintain persistent BLE connections to third-party devices (e.g., BLE battery management systems) on a Cerbo GX, even when using a separate USB Bluetooth adapter (hci1).
Environment
- Device: Cerbo GX
- Venus OS: v3.x (observed on current firmware)
- vesmart-server version: 0.5.9 (
/opt/victronenergy/vesmart-server/vesmart_server.py) - Bluetooth adapters: Built-in
hci0+ USB donglehci1
Root Cause
The keepalive timer in /opt/victronenergy/vesmart-server/gattserver.py fires every 60 seconds when no VE.Smart device has written to the GATT service. When it fires, the timeout handler:
- Calls
bluezutils.get_devices(self.bus)— which returns all devices across all adapters - Iterates through every device and calls
device_interface.Disconnect()on each one
There is no filtering by:
- Adapter — devices on
hci1are disconnected even thoughvesmart-serverwas started with-i hci0 - Device type — non-VE.Smart devices (BMS units, sensors, etc.) are disconnected even though they never interacted with the VE.Smart GATT service
How to Reproduce
- Connect any BLE device to the Cerbo GX on any adapter (including a USB adapter on
hci1) - Ensure no VE.Smart devices are connected (so the keepalive timer is never reset)
- Monitor with
dbus-monitor --systemfiltering fororg.bluez.Device1.Disconnect - After exactly 60 seconds, observe the
Disconnect()call being made on your device by thevesmart_server.pyprocess
Confirmed via btmon traces showing Disconnect Complete events with reason Connection Terminated By Local Host at exactly 60-second intervals, and via dbus-monitor tracing the D-Bus Disconnect() calls back to the vesmart_server.py PID.
Expected Behavior
vesmart-server should only disconnect devices that it is managing — i.e., devices that have connected to and are participating in the VE.Smart Networking GATT service. Devices that were connected by other processes (other Venus OS services, third-party drivers, etc.) should not be affected by the VE.Smart keepalive lifecycle.
Non-VE.Smart devices, and devices on other adapters, should never be touched.
Impact
This bug affects anyone running persistent BLE connections alongside vesmart-server, including:
- Third-party BLE battery management systems (via projects like
dbus-serialbattery) - BLE sensors connected through a secondary adapter
- Any future Venus OS feature that maintains long-lived BLE connections
The current workaround is to disable vesmart-server entirely, which also disables Victron Connect BLE access and VE.Smart Networking.