Louisvdw / dbus-serialbattery

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

Device "Name" resetted after system reboot #425

Closed chiefjoejj closed 1 year ago

chiefjoejj commented 1 year ago

The changeable "Name" of the bms-instance is resetted after a system reboot. Would be great if this could be fixed somehow...

Maxwell27321 commented 1 year ago

I see the same behavior. As I have 4 battery banks, each with an BMS, I would like to which BMS correspond to which bank.

pos-ei-don commented 1 year ago

As a workaround, I set the Name in the incl des NodeRed at startup (over mqtt)

teefixx commented 1 year ago

Hi Pos-ei-don That's in general a good idea, but be careful if the VRM instances change... see https://github.com/Louisvdw/dbus-serialbattery/discussions/481

pos-ei-don commented 1 year ago

Why? Mai "Main" battery is a generic mqtt device, filled by NodeRed. So no Problem with this.

teefixx commented 1 year ago

for the generic device it's no problem. I assume, you always assign the same VRM instance to the generic battery. I thougt, you name your real batteries as well, and there the VRM instance can change...

pos-ei-don commented 1 year ago

Yes, but NodeRed can "detect" the New id and assign the Name I prefer. So the id doesn't matter...

teefixx commented 1 year ago

is this done automatically? or do I need to have a special node for that?

pos-ei-don commented 1 year ago

I scripted this. I just read all the values so i know which battery it is. Every Pack has a little difference so i can distinguish them. One EVE Pack hast 304Ah, one CATL Pack knly 302Ah. This is a simple mqtt-in Filter I apply before setting and publushing the corrected name again to mqtt at startup

mr-manuel commented 1 year ago

This is a duplicate of an already existing issue and can be closed.

Reference to existing issue https://github.com/Louisvdw/dbus-serialbattery/issues/100

For the Node-RED node this is a new feature of node-red-contrib-victron since v1.4.25. Probably it work with one BMS, but I don't think that it will work with multiple BMS, when the DeviceInstance is changing.

If @pos-ei-don is using another driver for a virtual battery, than the DeviceInstance is not handled the same way as in the dbus-serialbattery. In this driver the DeviceInstance is based on the serial to USB adapter and will change, when the ID of the adapter changes. In this case also the saved names will be messed up. Before this issue can be addressed I think that the DeviceInstance has to be assigned by BMS serial number, so it doesn't matter, if the ID of the adapter changes. To achieve this, every existing battery class has to be extended with this information.

teefixx commented 1 year ago

As a workaround, I set the Name in the incl des NodeRed at startup (over mqtt)

@pos-ei-don

With which topic do you set the battery name? I assume you use an MQTT out node? could you share the node red flow please?

pos-ei-don commented 1 year ago

@teefixx

Yes, MQTT-OUT. Just write the name you wish at startup to the topic "W/[...]/CustomName" as string. As the (at least the non ble driver) did not sent the custom field text you can enter in the BLE-APP and save on the bms, I used other values to "indentify" a BMS. Like Capacity. One CellPack got 280Ah, the other 281Ah. If someone finds a better method please share.

So if is subscribe via mqtt-in to ""N/[vrm-id]/battery/+/InstalledCapacity", I get all my batteries in a seperate payload-message. I then can easyle set the name as shown above.

teefixx commented 1 year ago

@pos-ei-don Thank you Tried this, changed the capacity in one battery in the BMS. This value is not read out, instead VictronGX takes the value from the serial driver... What kind of BMS do you have? I have a Daly 16S

pos-ei-don commented 1 year ago

Ah OK, i have JK-BMS. I stopped using daly as I had way too much Problems.

So you need to find a different value you can use. USB Port, serial number... I bet there is something usable

teefixx commented 1 year ago

@pos-ei-don sorry for bothering you again. I found a way to distinct the batteries and write the values via MQTT out. When I check it with MQTT Explorer the values are there.

image

Still, if I have a look at the remote console of VenusOS, the names did not change. They are still "SerialBattery (Daly)"

I tried both, publish at N and W...

pos-ei-don commented 1 year ago

VenusOS requires a json object with value. {value: "newName" }

teefixx commented 1 year ago

that worked, thank you!