NotMario Posted September 7, 2022 Share Posted September 7, 2022 (edited) I wrote a module to create a GenetrySolar Inverter device on Victron's GX units. As it is, the product has infrastructure to do modbus, so i've used that for now. As the GS doesn't have modbus support yet, this means that a proxy is needed to map the status.js to the modbus space. The genetrysolar.py file goes in /opt/victronenergy/dbus-modbus-client You have to add an import clause for it [after the one for smappee] in the dbus-modbus-client.py file in that same directory. (Unfortunately, they didn't make it pick it up automatically) The gsproxy.py can run anywhere. But you have to point your GX unit to it as a Modbus TCP device. It is invoked as: ./gsproxy.py <port> <fakeserial> Important to note that the proxy is only a simulator right now. I am not able to use my unit to test out the actual mapping from a real inverter. The code is trivial, so someone here could probably modify it before i get my equipment in order. Naturally, the ideal case would be for the GS to support Modbus natively - or for Victron to make infrastructure for JSON devices. I wasn't going to try and write that infrastructure for Victron. I wouldn't want the additional UI work so you could add a "json device". gsproxy.py genetrysolar.py Edited September 7, 2022 by NotMario Quote Link to comment Share on other sites More sharing options...
Sid Genetry Solar Posted September 7, 2022 Share Posted September 7, 2022 By "supporting MODBUS natively", I presume you are referring to MODBUS TCP? Or are you referring to a hardwired MODBUS serial connection? Quote Link to comment Share on other sites More sharing options...
NotMario Posted September 7, 2022 Author Share Posted September 7, 2022 (edited) Yes - though i believe the only difference is how the data is transceived. Though there's no reason it couldn't also be done with rs232. Just that you already have Wifi support, might as well use it for SCADA. Edited September 7, 2022 by NotMario Quote Link to comment Share on other sites More sharing options...
NotMario Posted September 9, 2022 Author Share Posted September 9, 2022 Might i get a stats.json file from a running inverter? Ideally with a few descriptors thrown in. I can get all the mapping done in the proxy ahead of time. Quote Link to comment Share on other sites More sharing options...
Sid Genetry Solar Posted September 9, 2022 Share Posted September 9, 2022 A "stats.json" is attached here, from a test bench inverter running 1.2r0. No loads, no thermistors, but most of the info should be pretty easy to determine from the tagnames. stats.json Quote Link to comment Share on other sites More sharing options...
NotMario Posted September 10, 2022 Author Share Posted September 10, 2022 A working version of the proxy is attached... Invoked as: # ./gsproxy.py <bindip> <port> <stats.json url> EG... # ./gsproxy.py 0.0.0.0 5021 http://192.168.1.101/stats.json There's a pretty good chance the polarity of some fields might be backwards. We'll find out later and i'll update it so. Anyone else got a Victron GX, or am i the only one that cares? lol gsproxy.py Quote Link to comment Share on other sites More sharing options...
NotMario Posted September 18, 2022 Author Share Posted September 18, 2022 (edited) Alright... so here's a much cleaner version that doesn't rely on their modbus infrastructure, which incidentally also makes exposing temperatures and fan values a lot easier. Exposes AC-Input/Output Information Exposes DC Information, however, it calculates the DC amps assuming 100% efficiency - DC Amps are not exposed in JSON file. Exposes highest probe temperature. Exposing all of them is probably too much... Allows changing charge modes, though i've explicitly disabled turning inverter mode off. Invoked as so: # /opt/gs/gsdevice.py http://<inverterip> It must be run on the GX device itself. This requires a rooted GX. Install it, and create an @reboot crontab for it. gsdevice.py Edited September 18, 2022 by NotMario Quote Link to comment Share on other sites More sharing options...
NotMario Posted September 22, 2022 Author Share Posted September 22, 2022 (edited) Went ahead and added alarm support and a few other fixes... Cleaned up some mode switching... Off, On, and Charge-Only are all passthru modes - No Charge, Float Charge, and Bulk Charge, respectively. Inverter-Only is actual inverter mode. Victron's modes aren't exactly 1:1 with the GS, and the UI isn't versatile enough to enable me to customize the options without modifying the UI code. If Sid adds grid-tie or "power-assist" functionality, that will be what "On" sets the inverter to. gsdevice.py Edited September 22, 2022 by NotMario Quote Link to comment Share on other sites More sharing options...
NotMario Posted October 25, 2022 Author Share Posted October 25, 2022 ... And a version that utilizes atomic DBUS updates... Mainly to reduce spamming the bus... Some small updates that pave the way for additional functionality. gsdevice.py Quote Link to comment Share on other sites More sharing options...
InPhase Posted October 26, 2022 Share Posted October 26, 2022 I'm following but I don't have any equipment yet. I figured I'd just use some Victron ET112 meters to monitor the inverter output on the Cerbo. Is there an advantage to writing the module like you did? Quote Link to comment Share on other sites More sharing options...
NotMario Posted October 26, 2022 Author Share Posted October 26, 2022 Less equipment, plus direct control of the GS. My first attempt at this actually used the GS data to mimic 2 Meter devices. (sort of the programmatic version of what you intend to do) The UI didn't really work properly with both an input and output meter. Plus it doesn't work very well with a distinct DC system. ("Has DC system" config option) Victron's smart shunts have an Inverter DC Load option, but it doesn't play well with the UI. (The feature is still kinda incomplete) It might work better with the meters if you don't have the "Has DC System" option turned on. But i have a distinct DC system, so i must have it on to monitor my DC equipment. IMO, Victron's GX system leaves much to be desired. If you're not working with hardware they specifically support, it doesn't really work quite right. So, this module adds explicit support for the GS. The big negative to this approach is that it's custom code that requires root access - fortunately, this is hardly the first example of this, and is directly supported by their community. 1 Quote Link to comment Share on other sites More sharing options...
InPhase Posted October 26, 2022 Share Posted October 26, 2022 Since I posted about the ET112, I learned that it won't work anyway. For one, the meters would only read 240 or 120 volts, but not 120/240 split phase. Besides that, they are intended to be used in conjunction with a Victron inverter. So your module will be the way to go. I really like the look of the GX interface. There's nothing else on the market that I have found that is as clean and configurable. Quote Link to comment Share on other sites More sharing options...
NotMario Posted October 26, 2022 Author Share Posted October 26, 2022 Yeah, they really have a bit of a monopoly on a decent consumer-grade monitoring system. Here's the GX's Node-Red feature set up to programatically control the GS. Charges when batt gets very low or close to freezing. Will switch to inverter mode when enough solar to take the full load demand, and back to passthrough when the sun goes down. Sky's the limit. Quote Link to comment Share on other sites More sharing options...
InPhase Posted October 26, 2022 Share Posted October 26, 2022 Since I don't yet have the equipment, I'll ask you is it possible use it with more than one battery? My intended use case is two batteries feeding two inverters each. Basically two independent systems. Can the single Cerbo GX monitor them both? I think it can, but that's far from conclusive. Quote Link to comment Share on other sites More sharing options...
NotMario Posted October 26, 2022 Author Share Posted October 26, 2022 Officially, no. One GX per independent system. Unofficially... you can add as many Shunts as the physical hardware will let you. They will be visible in the Menu screen. However, the pretty graphical system will only display one of them. This particular module i made for this page would need a slight modification to be run more than once (once for each inverter). That's a trivial change, just haven't done it yet 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.