InfernoEmbedded / PowerScraper

A scraper for power devices to feed data to OpenEnergyMonitor
GNU General Public License v3.0
36 stars 17 forks source link

Add support for RS485 Solax X3 #16

Closed barche closed 3 years ago

barche commented 3 years ago

This adds a new Input module to read the Solax X3 registers directly from the RS485 interface. Note that I connected to the built-in RJ45 sockets on pins 4 and 5 as described in the "meter connection" in the manual:

Screenshot 2021-06-03 at 01 00 03

What seems really strange to me is that the register addresses are completely off compared to the TCP Modbus input. I had to loop over all possible addresses to find them. I also can't find any documentation on them, hence the many unlabeled registers (the ones I labeled are deduced from the values shown when dumping raw values). These 53 registers are the only ones that don't return an "illegal address" error.

deece commented 3 years ago

Hmm, the registers in the docs don't align with your code. I wonder if you've stumbled across some other interface designed for the master/slave (parallel control) feature.

With the above docs, I think you may be better off looking at the TCP modbus registers, which hopefully will align.

Side note: the meter pinout in https://www.solaxpower.com/wp-content/uploads/2021/04/X3-Hybrid-User-Manual.pdf seems quite different to what you've posted, which inverter do you have?

deece commented 3 years ago

Hmm, I wonder if those docs might only be applicable for the inverters & chargers that support batteries, but not the standalone inverters.

If that's the case, I would suggest reaching out to your local Solax engineer (call them, rather than email), explain that you are trying to implement some monitoring, and see if they can provide you with the documentation for the read-only registers. They should be able to do this without any NDA (they are a bit tighter with access to the write registers).

barche commented 3 years ago

Yes, it seems to me the hybrid inverters are quite different, here is the user manual for mine: https://www.europe-solarstore.com/download/solax/solax-X3-4.0-T-X3-10.0-T-user-manual.pdf

I had already seen that modbus protocol document, but no luck at all trying to read those registers (Illegal Address for all). And if I use 115200 baud (or braud as Solax call it ;) it won't connect at all. I wonder if it's possible that the "engineer settings tool" and the meter use different pins of the RJ45 socket? I've tried a few, but randomly connecting pins makes me a bit nervous.

barche commented 3 years ago

Update: having no hope or expectation of any kind, I followed your suggestion and called the nearest Solax service desk. Literally 30 seconds later I had a modbus protocol document in my mailbox that is different from the one for the hybrids, with addresses that match my findings. I'll update this PR accordingly.

Kudos to Solax for their willingness to help.

deece commented 3 years ago

Oh that's wonderful news! If you could please send the doc to me too, it will make it easier to review your patches.

You can find my email in the commit history

barche commented 3 years ago

I have updated the PR with the proper register names. Note that I left the last few about fault codes out, these seem less useful.

deece commented 3 years ago

Thanks for your efforts :)

aeroboy86 commented 2 years ago

te: having no hope or expectation of any kind, I followed your suggestion and called the nearest Solax service desk. Literally 30 seconds later I had a mod

@barche : Hello, i know this is a bit of an old topic, however I was wondering if you were able to share the modbus rtu protocol definition you got from the team. I have a X3-MIC/PRO and I would like to tinker with writing a driver for it. Tia

barche commented 2 years ago

Hello, i know this is a bit of an old topic, however I was wondering if you were able to share the modbus rtu protocol definition you got from the team. I have a X3-MIC/PRO and I would like to tinker with writing a driver for it. Tia

Not publicly, but I can email it to you. You should be able to find my email in the git commit log, send me a mail and I will reply with the document.

aeroboy86 commented 2 years ago

Hello, i know this is a bit of an old topic, however I was wondering if you were able to share the modbus rtu protocol definition you got from the team. I have a X3-MIC/PRO and I would like to tinker with writing a driver for it. Tia

Not publicly, but I can email it to you. You should be able to find my email in the git commit log, send me a mail and I will reply with the document.

Thanks @barche , I'll go have a look for your email now. Cheers

rand12345 commented 2 years ago

Hello, i know this is a bit of an old topic, however I was wondering if you were able to share the modbus rtu protocol definition you got from the team. I have a X3-MIC/PRO and I would like to tinker with writing a driver for it. Tia

Not publicly, but I can email it to you. You should be able to find my email in the git commit log, send me a mail and I will reply with the document.

Hi, @barche just a courtesy message to say I've also sent an email to you regarding those documents.

CristiXP commented 2 years ago

Hello, did anyone try to fix the Solax Modbus integration for the homeassistant? I am using an X3 Pro and stil cannot manage to work with it. If I try to read anything from the inverter, I am receiving only Illegal adress exception error. Can anyone mail to me also the pdf from solax for this inverter? Thank you! cristian.goian.cg[at]gmail.com

barche commented 2 years ago

I haven't looked into direct HA integration, it's best to open an issue there. I have the X3 PDF, no idea if that is the same as the X3 Pro, I get the feeling Solax builds a new Modbus protocol for each variant.

DanielVacha0 commented 1 year ago

Hello,

I have a smart meter Solax Eastron SDM630-Modbus V2 3F with adapted firmware directly for Solax. Is it possible to communicate with that smart meter via modbus like you do it with X3 series inverter? If yes, could you provide me some kind of example or send me a link with such exmaple? I found documentation with commands and meaning of bits, but I cannot find how to create a connection and send those commands in script.

Thank you, Daniel.

barche commented 1 year ago

Yes, you would need to add a new input, pretty much like I did in this PR. See the "Files changed" tab for what kind of changes are needed.