We want to monitor our consumption of electricity, which means we want to look at data from the power meter at the same time as the inverter. This isn't how the Modbus protocol works though. Only one Reader (not the term used in the spec but I'm struggling to find something more apt that's suitable in the current climate) is permitted. Adding a second reader results in chaos with lots of missed and incomplete packets being seen.
However, after a bit of research there are solutions available!
The first one I tried was this neat wee box from Measurement Systems. It allows for multiple readers to exist and acts as a gatekeeper to the device bus to keep things orderly. It certainly looked promising. After ordering I carefully installed it and powered it via PoE. All looked good and configuring it via the web interface was simplicity itself. After doing all this I was a little stumped as there was no data available and the inverter was unhappy with it's now familiar "No Meter" warning. Hmmm...
After much experimentation I found that the latency introduced by the box was too high for the inverter when used with caching enabled. Disabling the cache allowed the inverter to operate and all seemed fine.
However, a few days later the inverter started suffering from periods where it had the same old meter fault :-( I started looking at the data from the port sharer on the interface in more detail and soon realised the rate of requests from the inverter was just too high. It was swamping the unit and after any reasonable period of use it was failing. Resetting the port sharer restored things for a time, but soon the inevitable happened.
I should note that I reached out to MSI for help and their responses and support were first class. Sadly, the product just isn't up to this task.
This is a much cheaper option and in some ways feels neater with less cabling required, but involves more components. Installation took only a few minutes as I was able to reuse the existing wiring.
Of course I also needed software to read, store and respond to the requests, so a quick session with VSCode and some Go code later and data was starting to flow. Adding a database goroutine and suddenly we were logging all the data we needed. Simples!
The system has been running for a few weeks now and seems to be stable enough. The code could do with a review and some tidying up, but so far it's doing what was needed without too much effort.