Explaining changing VRM instance numbers

Can someone explain how VRM instance numbers work, or point me at the relevant document?

My system gained two instances of the VE.Bus device last night (288 and 289) and there is only one device in the system really (an MPII). Some searching found that the name for that grey number in square brakcets is ‘VRM instance number’, and that led to some relevant posts on the old forum:
https://communityarchive.victronenergy.com/questions/116226/vrm-instance-number-changed.html

I’m fairly sure my issue is covered in that 116226 thread (my Pi GX was powered on AC-out when an update of the ESS assisstant caused the multiplusII to reset and power down, and this seems to cause that VE.Bus-MK3-conected device to get a new number).

My question is how exactly does this work and what are the implications? I understand that the logged data on VRM is associated with the instance number, so presumably today’s data is coming from ‘289’, and all previous data is associated with ‘288’. Is there a way to concatenate them?

Is the VRM instance number generated by venus OS or VRM? Where is the association stored? On VRM, or in VenusOS, or both?

Why does a new one get generated for a device with the same serial number? Is there a plan to try and stop this happening in future? If coding on the open parts of the system can fix this I’m happy to help, as it affects me until/unless I upgrade to a non-USB Ve.bus connection.

What else is the instance number used for - it presumably exists to deal with multiple instances of the same device being in one installation?

Does it need to match between devices (e.g. my MPPT device is now 289 as well as the ‘new’ MPII instance). Is that just because it was a device added after the MPII (originally 288) so it got the next number (289), or has it been changed to 289 to match the 289 of the ‘new’ MPII instance? I think this is just co-incidence and doesn’t matter (i.e MPPT is just numbered 289), BICBW.

The 12679 thread notes that there is now a settings item to change the instance number. However in my settings only my MPPT device appears. neither of the VE.Bus MPII instances appear. Does that make sense?

116226 explains that this used to happen for VE.Direct devices but no longer does (and that seems to be true, my VE.Serial MPPT has not changed its number (or at least there is only one showing).

But clearly it can still happen for VE.Bus devices, probably only when connected over USB, not directly to real GX devices. Is that right?

Has anyone worked out exactly what the issue is in terms of changing USB interfaces?

Is there a way to see which data is associated with which instance number (then I could tell exactly when the new one was created).

And is my best course of action to try the ‘keep resetting your PI and deleting the ‘new’ instance in VRM until you manage to get the system to understand that there is only one device’ process (and will doing that lose me all the data associated with the new instance number), or is there a better way to a) persuade the system that there is only one device and b) not lose history if possible (but it’s quite a new install so this wouldn’t be the end of the world).

Or is the easiest thing to just delete the old one, (which I think means losing data from 22nd to 28th Dec)?

I found the diagnostics page for my installation which shows the first messages from VE.Bus device 289 messages appeared at 4:08 this morning, which is when I was changing the settings.

Thanks for any pointers you can give and apologies if this is all explained in the docs somewhere. I did search and the only instance I found was in https://www.victronenergy.com/media/pg/GX_Tank_140/en/configuration.html

Also why do numbers start with 288? I have
Gateway: 0
Original MPII: 288
‘new’ MPII: 289
MPPT: 289
Battery: 512
Is there any significance to these numbers?

I can’t offer you too much explanation other than to say that the main thing the VRM instance numbers do in my world is map a device on my RPI Venus box to the various Victron devices and third party sensors I have attached to it, to the corresponding devices on VRM.

They seem to change a lot more than you would think. I would have thought the serial number of the device would be a unique ID that would link things up, but swapping a device from one serial/USB port to another, or having to do maintenance on the Pi due to corrupted SD cards etc seems to generate new VRM IDs, and that means that set of charts etc are produced in VRM instead of a nice continuous one. It also means you have to re-create any custom/advanced charts as you can’t simply update the device ID they refer to.

All very annoying!

Anyway - it happend this week that I rebuilt my Pi, due to corruption, and got new VRM IDs assigned for all the Victron kit (Ruuvi tags, Mopeka etc had no problem).

Someone on the old forums said that if you remove the ‘new’ devices from VRM, and reboot the Pi with connection to VRM live, it should check there and assign the same VRM IDs based on the serials of the devices. It didn’t work for me, the Pi might or might not be connected to the Internet at boot (depending how fast Wifi/3g powers up), or maybe it doesn’t work at all.

What did work was opening the configuration file in /data/conf/settings.xml and editing the lines there. There is a line like this for each device:

com.victronenergy.solarcharger:290

The last number in the line (290 in this example) is the ‘new’ unwanted VRM ID, I just changed it back to match what was shown in VRM online for the device with all my historical data attached, and rebooted the Pi… and all was well.

Not sure if this will help you but it would have helped me, so I figured I’d post it!

Regards

Aaron

That is very useful info. Thanks.

I just upgraded to a real cerboGX from my Pi4. Moved the connections across and did the ‘replace the GX device on this installation’ thing in the VRM interface.

That all worked nicely, except that I got new instance numbers for my Multiplus (288->276) and for my MPPT (289->288).

Changing the MPPT could in fact be done in the UI. It’s editable under ‘VRM device instances’.

But the VE.Bus (multiplus) device did not appear here with an editable number, so I had a look in the /data/conf./settings.xml file

Mine had this:

<com_victronenergy_vebus>
          <_276>
            <Enabled type="i" min="0" max="1" default="0" silent="False">0</Enabled>
            <Name type="s" default="" silent="False"></Name>
            <Service type="s" default="" silent="False">com.victronenergy.vebus/276</Service>
          </_276>
</com_victronenergy_vebus>

With no entry for 288, except this:

<vedirect_HQ23394M9VG>
      <ClassAndVrmInstance type="s" default="solarcharger:288" silent="False">solarcharger:289</ClassAndVrmInstance>
</vedirect_HQ23394M9VG>

Changing all 3 276s to 288s and rebooting, did not have the desired effect: both instances still exist, but now it has added an explicit entry for 288 as well:

<com_victronenergy_vebus>
          <_276>
            <Enabled type="i" min="0" max="1" default="0" silent="False">0</Enabled>
            <Name type="s" default="" silent="False"></Name>
            <Service type="s" default="" silent="False">com.victronenergy.vebus/276</Service>
          </_276>
          <_288>
            <Enabled type="i" min="0" max="1" default="0" silent="False">0</Enabled>
            <Name type="s" default="" silent="False"></Name>
            <Service type="s" default="" silent="False">com.victronenergy.vebus/288</Service>
          </_288>
        </com_victronenergy_vebus>

So I’m not quite sure what to make of that. I can mess about some more but breakage would be less likely if there were some docs for this. I presume I can break things quite badly by hand-editing this file, which appears to be regenerated on reboot, and there is also a settings service.
(which apparently I should stop before trying to edit a settings file?)

Is there some info on how this works?
(I also just discovered dbus-spy which is really handy for seeing what’s going on at the dbus level, but I’m not sure how the architecture fits together)

Changing ID’s was something that seemed to be Pi specific on older versions.
It should not occur again after moving to a cerbo, on a current release and without modifications.

Right. I was hoping to get away from this issue due to a) using official/supported kit (yes, updated to current firmware and so far entirely stock), and b) it being powered from the battery, not AC, so it doesn’t get random resets from firmware/ESS Assistant updates.

I notice that my VE-Bus-related widgets under ‘advanced’ in the VRM now show ‘no data’ because they are still pointing at the old MPII instance number. e.g. VE.Bus State [288]. So I’ve enabled those widgets for the new instance number and disabled the ones for the old instance number. I guess that all makes sense (given a changed instance number).

Unfortunately the charts will track ID’s. But once stable that won’t be a problem again.

The only thing that really matters is losing history. Is there a way to tell which instance/device logs are associated with?
Right now all my history is there, but I can’t tell whether it’s associated with the Cerbo, The Old MPII instance or the new MPII instance.
The ‘associate a new GX device’ process says it copied all my logs over (but I also got an error/warning message about ‘can’t copy data to same installation’ which may or may not have been important). It seems to have worked anyway,
And I can’t tell if deleting the old MPII instance will lose any history before I do it.

I guess I should read up on where the data is stored (on the GX, on local SD, on VRM), and how to take backups, but if anyone has hints on how to check nothing important will be lost (or which doc to read) that would be welcome.

Stale devices usually remain listed in the VRM device list.