arrow1800 / Victron-VirtualBattery

8 stars 2 forks source link

Is reboot a problem? #7

Closed morres83 closed 1 year ago

morres83 commented 1 year ago

I just read in some serialbattery issues that on reboot USB port, device instance or so can be changing, affecting the NodeRed implementation (i.e. data cannot be read anymore unless newly "connected" in NodeRed). In fact it is known that the custom name in serialbattery is not saved upon reboot.

I just tested rebooting and in NodeRed the custom name "Jkbms1" and "Jkbms2" disappeared and was set back to the generic one (in fact I do not know right now which BMS is which one, and I think I can only find out when connecting my cell phone via bluetooth app and find some "maching" parameters).

The data readout however seems to be okay. But can we rely on that?

arrow1800 commented 1 year ago

that is indeed a problem (changing device-id's on reboot). i have solved this in node-red. i have 2 bms-es and on a reboot the device-ids are changing between 0,1,2 and 3.

i fixed this in node-red by doing the following:

  1. querying bms through modbus nodes(not using the victron nodes here) on all 4 addresses.
  2. checking that i receive 2 messages using join 2a. sometimes i only receive one message instead of the expected two, due to bms comms temporary failing -> fixed in 'get smallest node'
  3. using this data to set parameters of virtual battery.

screenshot:

image

image

morres83 commented 1 year ago

Ah this sounds interesting, anyhow I was currently using the CVL, CCL and DCL from the serialbattery, which could not be acquired by the MODBUS nodes. (Can you still show how this MODBUS node is configured and which register table you used? I found several Chinese documents with different versions but I am unsure what is the latest one)

morres83 commented 1 year ago

Additional note, when I switch to MQTT (which I will, I have already started on this topic) I think I will acquire all the required data from the BMSes also from Victrons MQTT. Everything we need should be available there, and the deviceID should not be a problem.

image

arrow1800 commented 1 year ago

i found this document a while ago, published by victron. most if not all parameters can be queried through modbus.

CCGX-Modbus-TCP-register-list-2.90.xlsx

sample for getting max cell voltage:

image

arrow1800 commented 1 year ago

Additional note, when I switch to MQTT (which I will, I have already started on this topic) I think I will acquire all the required data from the BMSes also from Victrons MQTT. Everything we need should be available there, and the deviceID should not be a problem.

image

you are implementing MQTT on the data gathering side as well? i dont think that is necessary. modbus gives us all we need.

We can benefit the most from MQTT by using it for the comms between node-red and virtual-battery itself

morres83 commented 1 year ago

Ok I missunderstood. I thought you would take the data directly from the JKBMSes internal registers rather than the Victron-Modbus "emulation".

I will think about this as well, however I might like more to receive the data by subscribing to the interesting topics instead of polling cyclically. However, this is "only" NodeRed stuff and normally won't affect how the virtual battery python driver is written.

arrow1800 commented 1 year ago

subscribing to topics sounds better then polling.. i agree with that. shall we continue our conversation in a rather more fitting place? -> #6