Hopefully someone has done this before so can answer.
I have a SolaX inverter which I want to connect to via Modbus and get realtime data, control the inverter vis Home Assistant, etc.
I have seen a really great guide (JW Solar) on building a Waveshare Modbus interface and have bought all the bits, so I’m ready to go.
However, I’ve just checked by inverter and have noticed that the RS485 port is already in use as it’s connected to my “Social Energy” box, which allows the company to trade my energy, grid balance etc.
So my question is, how can I split the Modbus signal to I can connect my Waveshare Modbus interface to allow me to monitor and control via Home Assistant?
Is this possible? I’ve been looking around and some of the equipment you can buy to allow for this seems really expensive, so I want to make sure I do the right thing to split this signal.
Any help or advice would be greatly appreciated.
It depends. RS485 is a multi-drop communications bus. However unless you can coordinate which master unit is in control of the bus you can only have one master on the bus. Also you need to be careful where the termination resistors are placed.
Modbus at the physical wire technically permits many slaves but only one master. Inverters present as slaves to the connecting master, so your ‘Social Energy’ box is going to be a master which does the talking on the bus - slaves don’t initiate they just respond.
That said, you can connect whatever you like to the pair of wires, as long as you deal with the terminating resistors correctly. Most master-devices expect to be at one physical end so have terminating resistors built in. In my inverter the RS485 comms port has the resistors, and the ‘expected’ data logger has them at the other end of the 2cm bus when plugged in. When I removed the data logger and added a wire off to my master-based adapter to talk to HA, I had to add in terminating resistors myself.
Two masters on a Modbus bus are not good news - but yes it can be done. It will almost certainly result in collisions and dropped messages. If one master asks for something, the other may think the response is for it. Worse, if one sends a write and the other does a read at the same time, it gets a bit messy, usually a failed write at the very least.
There are ways around this. From working personal experience I know dual-master interfaces are available. I have one as a tri-port RS485 device (no longer used, as I gave up on the official data-logger in the end) which connects to two masters and one bus, managing the different master-bus conversations by software. It worked.
I have read in this forum of setups with a self-written software solution that manages this. However, a quick Google check just now shows dual-master Modbus interfaces available very cheaply. (whether they work is another matter of course)
The real issue comes when you do connect two masters. At least I knew what my data logging stick was doing (not much, and only every 15 minutes) so I could read and write to my inverter safely around that conversation. I would like to know what my ‘Social Energy’ box was actually doing first, just so I could try and avoid trying to talk to the inverter at the same time!
Thanks very much for the reply.
Not sure about terminating resistors, etc - this would be a bit beyond my understanding at the moment.
All I know is that the current RS485 cable goes from my inverter directly into the “Social Energy” controller, and that I have bought a WaveShare Modbus device. So configuring how the two masters communicate would be very difficult for me I think.
Thank you for the information, this has helped my understanding a little.
I understand that having two masters could prove difficult due to requests being sent from both etc. However, all I currently want to do with the WaveShare module is interrogate the inverter to collect the various entities for Home Assistant, so I can show realtime usage from my solar panels, battery etc.
So, does capturing this data constitute being a master device? or can the WaveShare be setup purely to passively collect this data. Apologies if this is a dumb question but I really have no idea if this is possible.
You also mentioned cheap dual master modbus devices being available (very cheap, which I like ).
Do you have any examples / recommended devices?
Would the be just plug and play with the cables from both Modbus connections?
As mentioned above, I don’t currently intend to try and control the Inverter yet, only collect the data it’s sending so I can display it in HA.
Incidentally, I’m in a dispute with Social Energy (now called Levelise) about their use of my equipment, as their hardware does not take my variable tariff into account, so the money they pay me for the power trade / grid balancing service is probably less than what I would save if I could control the inverter myself (and charge / discharge depending on my tariff amounts).
So if they cannot resolve my dispute, I will be cancelling this service which will ultimately let me disconnect their box from my inverter, meaning that my WaveShare would be the only master - however this is for the future.
Thanks again for the information. I’m learning a lot from you and others on this forum, so I’m grateful for that.
Yes, afraid it does.
Modbus is, simply put, just a pair of wires with lots of things connected. One is the ‘master’ (in this case your WaveShare adapter) and the rest (in this just just the one inverter) are the ‘slaves’. Only the master can initiate conversations on the bus. The master ‘shouts’ down the wires, with a package that contains a slave ID and a request to read/write and the register addresses. The slave that matches the ID responds, either by replacing a register value with the new value (write) or by reading the register value(s) and sending them back down the wires (read) by shouting back.
So, in order to get anything out of the inverter (as a slave) you have to shout at it and listen for the response. The problem: your WaveShare shouting and listening at the same time as the Social Energy doing the same.
That said, I don’t know much about your SolaX inverter, but a search suggests that it supports ‘pocket dongles’. These look as if they plug into a dongle port, separate to the RS485 port. My inverter only has RS485 as output comms, however if your inverter supports RS485 (for the SocialEnergy) and it can support a LAN/WiFi port via a dongle at the same time, then you may (I say may) just be able to read/write to the inverter that way at the same time (the conflicts being managed internally by the inverter).
Worth looking into just what the dongles can do perhaps?
Inverters and Modbus is really not ‘plug and play’ I’m afraid. The best you get is cannibalising a LAN cable and wiring one end in to an adaptor with screw terminals (and if you are lucky - one that has switchable terminating resistors built in).
I have used one tri-port device successfully, but it was a) expensive and b) needed configuration and experimentation to set it up. My search yesterday found stuff on aliexpress (try two master one slave Modbus hub) but I would not have high expectations myself.
TBH, the Pocket Dongles look like a much better route. These apparently support direct Modbus TCP, so you could get direct to the inverter without needing any other adapter.
You would have to find out just what these dongles can do, but I note that the documentation suggests a 10 second real-time lag, so I am kind of guessing that the inverter will buffer the registers, which is how it manages to avoid issues with other RS485 devices talking at the same time.
Thanks so much for the information, that’s really useful.
Understand that the connectivity from RS485 to Modbus is via a rewired Cat5 - that’s not a problem for me as I can do all that.
If t’s too much of a fiddle / technically difficult to use two Masters with one slave, then it looks like my WaveShare won’t be used (yet).
Regarding the SolaX dongle (Pocket WiFi), the generation of my inverter supports this, but it’s an older version (ver 2). I currently have a Pocket LAN dongle connected (providing ethernet connection for my SolaX inverter) which I can remove and replace with the WiFi dongle. However, I have read that the Modbus via WiFi interface for my inverter isn’t very reliable for HA, which is a shame. However I might have to revert to this approach if I’m leaving the Social Energy box connected.
Once again, many thanks for your help, really appreciate it.
If you have a pocket LAN, then I would investigate researching and trying Modbus over TCP directly into the inverter.
With my Solis, when I had a working LAN data stick (they are all made by the same company…) it had Modbus TCP exposed on one port that could be used directly. That is actually much easier (if it works) than using RS485 adaptors!
Modbus over Pocket LAN isn’t possible (which is why I’ve started on this quest). Extract from the page:
" SolaX - PocketLAN & PocketWiFi Readme
(Pocket LAN does not provide a Modbus connection at all and the Pocket WiFi v1 & v2 does not provide a reliable Modbus connection! Trouble shooting for Pocket WiFi v1 or v2 will not be provided)
Pocket WiFi 3.0 with Firmware V3.004.03 and above is only officially supported. SolaX only mentions Gen4 Hybrid, other inverters may work?"
So I’m a bit stuck really…
The annoying thing is that the data I’m after is getting sent to two locations - The Social Energy Website (via the Modbus) and the SolaX website - but I can’t access any of it in realtime. Really frustrating.
Given the drive for renewable energy, and the number of domestic solar PV systems being installed globally, I am personally very surprised at how difficult it is to get anything out of these inverters, and that there is apparently nothing on the commercial market that can do the job you and I want.
I ended up ditching the Solis data logging stick (unreliable) and just plugging in my own RS485 to ethernet adapter (Modbus enabled). My HA does all the work, using Node-RED, and I keep the data to myself.
Being in the UK, in the past I would expect manufacturers to provide connectivity and information and support, designed in from the start. Today these things are now being designed, made, and supported elsewhere, and I do wonder.
It really should not be this difficult!
The idea of buying a stick, paying for a service, to send my inverter data from my home to ***** just so I can pay again to get it back, 20 minutes later, is both ridiculous and dangerous. Frankly.
I might try the Pocket WiFi (2) to see if I can get anything meaningful from it, but I’m trying to keep my costs down as I’ve already paid out for a WaveShare that I can’t currently use.
If I can get one cheap enough (and get it working) I’ll let you know.