Louisvdw / dbus-serialbattery

Battery Monitor driver for serial battery in VenusOS GX systems
MIT License
539 stars 165 forks source link

BMS / driver disconnected after reboot #456

Closed teefixx closed 1 year ago

teefixx commented 1 year ago

Describe the bug When I reboot the GX device (RBpi) Node Red does not find the source which I chose in the node. I need to reconnect manually all node in node red. It is odd, as the name is exactly the same:

The error in the debug window: "TypeError: Cannot read property 'XXXXX' undefined"

So far I do not use custom naming as it is known, that the name is lost during reboot

To Reproduce Steps to reproduce the behavior:

  1. Reboot the GX device
  2. Go to Node Red
  3. All Connections to the BMS Nodes (Victron Battery Monitor) are red
  4. Open each Node and reconnect it

Expected behavior No necessity to recconnect nodes

VenusOS (please complete the following information):

Battery/BMS (please complete the following information):

Additional context Add any other context about the problem here.

mr-manuel commented 1 year ago

What is the version of the @victronenergy/node-red-contrib-victron node?

With v1.4.25 they did a big change:

This release features a big change in how all of the nodes are found on the underlying dbus. Instead of looking at the fourth field of the dbus service to identyfiy the device, it now looks at the first three fields of the dbus service path, in combination with the the /DeviceInstance. This allows the device to be re-found when the USB or VE.Direct ports change (eg at reboot). It also means that all existing flows need to be migrated. This is implemented by a blue 'please migrate' dot next to the nodes. As long as the user has not migrated and the path still exists on the dbus, the flows remain backwards compatible and thus functional.

Probably your DeviceInstance is changing as it's fetched from the order of your serial to USB adapters.

https://github.com/Louisvdw/dbus-serialbattery/blob/6471152bf701eb46beaa9ba4d11d93ffd1559dd4/etc/dbus-serialbattery/dbushelper.py#L42-L84

I think someone can have luck and connect the adapters in the same order as the USB ports are referenced in the OS, which let them appear probably every time in the same order.

If you have a Raspberry Pi with USB2.0 and USB3.0 and only two serial to USB adapters, you can try to remove both adapters, reboot, connect one to the USB2.0, wait a few seconds, connect the other to the USB3.0.

mr-manuel commented 1 year ago

@teefixx can I close this?