question

kazetsukai avatar image
kazetsukai asked

VE.Direct Java Library (USB)

Hello all,


Using the technical details provided by Victron Energy in one of their PDFs, I was able to create a small Java library to discover VE.Direct USB devices and read data from them. I needed this for my MPPT Charge controller but it should be usable with more or less any VE.Direct device.

https://github.com/kazetsukaimiko/victron-java


This library uses Java 9+ Streams. It has a single dependency of JSSC, although there is an abstraction layer built in so that can be removed if necessary. It can also be used to read events from the command line, and has nice helper code to convert electrical units.


I wanted to put this out there and get an idea of how useful it might be to others. It is well tested with 80%-90% code coverage. I organized it to support more protocols than VE.Direct, but as I currently don't have any Victron devices that use other protocols I have omitted writing in support for them, but feel free to submit feature requests via the GitHub Issue tracker.


I intend to maintain this library and eventually get it into Maven central for easy import into Maven/Gradle projects. To test it you will need git, maven, and Java 11+. You can then checkout the code:

git clone https://github.com/kazetsukaimiko/victron-java.git && cd victron-java

And run the CLI Monitor:

mvn exec:java -Dexec.mainClass="kaze.app.ShowDevices"


MPPT ControllersVE.Direct
2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Warwick Bruce Chapman avatar image Warwick Bruce Chapman commented ·

Thank you for sharing!

0 Likes 0 ·

Very cool. nice to see this come full circle for you :)

0 Likes 0 ·
2 Answers
kazetsukai avatar image
kazetsukai answered ·

I intend to build an entire web stack to watch and manage devices, at least for any hardware I have. The hex protocol is next on my list to implement.


@Guy Stewart (Victron Community Manager) To that end I hope you guys either have available, or release information pertaining to the bluetooth protocols in use by your products. The VE.Direct protocol PDFs are pretty excellent, if you look at the VictronProduct and VEDirectColumn enums ( https://github.com/kazetsukaimiko/victron-java/blob/master/src/main/java/kaze/victron/VictronProductType.java and https://github.com/kazetsukaimiko/victron-java/blob/master/src/main/java/kaze/victron/VEDirectColumn.java ) you can see I was able to very comprehensively handle all possible fields and their values.


This kind of documentation sets you apart from other vendors, I don't see anyone else doing this. This allows me to build integrations between energy management and device control, remote monitoring solutions. I intend to support any hardware I can get my hands on.


One question- I'm thinking of recreating the entire style (blue/orange/white theme), using CSS, for an open source/non-commercial web application equivalent of VictronConnect. Will this land me in trouble?

3 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ commented ·

As long as its victron oriented, no problem. But if you’re making a nice Victron look alike to then manage a chinese set of battery monitors or solar charger hardware, we’d be less happy with it ofcourse; as I am sure you’ll understand.

Btw to make sure: you are familiar with Venus OS (see wiki pages on github), and also the html5 app we host within Venus OS?

https://github.com/victronenergy/venus-html5-app

0 Likes 0 ·
Show more comments
mvader (Victron Energy) avatar image
mvader (Victron Energy) answered ·

Thumbs up @kazetsukai !

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.