I am trying to change the order of the devices on my Venus GX. No idea how to do. Can anybody help me?
Tanks in advance.
Rainer
This site is now in read-only archive mode. Please move all discussion, and create a new account at the new Victron Community site.
The code responsible for this page is /opt/victronenergy/gui/qmlPageMain.qml
The function addService is called from a loop in Component.onCompleted when the the GUI switches to the DeviceList page.
You would need to insert code in Component.onCompleted so that addService is called in the order in which you want to see services in the list. I would run the loop and build an array of active services, then recursively look through the list for the first desired service, then the second, etc. each time calling addService.
Notifications and Settings are handled differently and you'd need to play with the VisualItemModel to see if it can be modified to place them in your desired order.
addService is also called from the Connections object. if a new service comes on line after the page was initially built, that service will be appended to the end of the list, bypassing your rearrangement. However, switching to a different page then returning to the Device List page will rebuild the list from scratch, restoring your desired order.
Hi @Kevin,
I'm familiar with quite a few programming languages but unfortunately not with QML nor Qt.
I have the same request as @Rainer, in my case I'd be very happy with a device list that is sorted alphabetically: that way I can create the order I would like by choosing the device names. Is that just a matter of adding a few lines? Would you be able to show us how? Once done, does the qml file needs to be processed/compiled? Your help is much appreciated :-) !
I looked at the existing code and it is already sorting the list by name. One catch, it apparently builds the list when the system boots so the device's name must be changed then the GUI restarted (or Venus rebooted).
Notifications and Settings are always added at the end of the list.
The code that sorts the list is at the end of /opt/victronenergy/gui/qml/PageMain.qml. There are three options with the first two commented out so option 3 (sort) handles adding devices in alphanumeric order.
If you want devices sorted in another order, this is the place to change the code. Forgive me but I'm not an expert on QML nor do I have visibility into the methods associated with the objects used in that code.
You can simply rename devices by starting each one as a number--e.g. "1-BMV712" , "2-Phoenix Charger," "3-Solar Controller" . They will appear in that order.
Victron Venus OS Open Source intro page
Venus OS GitHub (please do not post to this)
16 People are following this question.