By my mistake, you discovered another way to get data from the inverter. You were supposed to see this: https://github.com/pawelka/sofarsolar_esp_rs485_logger. I will try to collect all data acquisition methods in the next post.
I entered this address: https://github.com/pawelka/sofarsolar_esp_rs485 logger after my colleague @Stiv32's entry from April 24. (Forum remove underscores) Unfortunately, I did not guess that you can send data from ESP to MQTT on another machine, and hence my later questions. In this area of programming, I am unfortunately green as grass outside the window.
Unfortunately, I did not guess that you can send data from ESP to MQTT on another machine
MQTT, NR and HA you can put each on a different machine. That's why I was chasing you towards MQTT Anticipating your appetite that someday you will want to make some extra money for your automation, you already have the platform ready. ESP is a grateful "pizdryk", many of them produce their IoT devices. See e.g.: https://tasmota.github.io/docs/ https://www.letscontrolit.com/wiki/index.php?title=Main_Page
Added after 21 [minutes]:
On the net, there are many descriptions of how to obtain data from the inverter. For some readers I will write about obvious matters, and for others I will skim the topic shallowly.
The only thing that remains unchanged is that the inverter has serial ports for communication. Communication takes place via Modbus, regardless of whether it is a "factory" datalogger or a device of its own design. From this moment, multi-variant begins and it depends only on the will of the user what to do with them.
A non-invasive method based on the so-called "scraping": 1. Reading the status page and reading the values from the html code. The amount of information read in this method is poor. Apparently this is illegal.
2. Capturing data sent to the solarmanpv.com server The factory logger will send data every 5 minutes to the server whose address is permanently stored in the device. The trick is to redirect the data to another own server and decode it. This can be done, for example, by having an appropriate router by creating a redirection rule. I found many solutions based on this method on the net.
3. People say that you can set any additional server address to which data will be sent. There is such an option in my logger, but I haven't been able to observe any traffic on this port.
DIY method: From the hardware side, you will definitely need a "device" that has an RS485 iterface to connect to the inverter side - because the inverter only has one. From the software side, a piece of code for Modbus communication is sewn somewhere because of the above. For the acquisition of data, it's just that, what we do with it is another pair of wellingtons.
I've reached the point where the possibilities for solutions are endless and I can't describe them (...) so I'll stop for now. Depending on your purpose and the equipment you have, it will be easier to answer specific questions.
I had the opportunity to pull the wire to Sofar, so I took advantage of it. I pressed RJ-45, and on the other side I plugged in 2 wires to the simplest adapter USBRS-485 and connected for testing to a PC with Node-RED installed. The tests were successful, and eventually it will be connected to the RPi. This thread is very helpful to anyone who wants to read data from Sofar.
A non-invasive method based on the so-called "scraping": 1. Reading the status page and reading the values from the html code. The amount of information read in this method is poor. Apparently this is illegal.
2. Capturing data sent to the solarmanpv.com server The factory logger will send data every 5 minutes to the server whose address is permanently stored in the device. The trick is to redirect the data to another own server and decode it. This can be done, for example, by having an appropriate router by creating a redirection rule. I found many solutions based on this method on the net.
3. People say that you can set any additional server address to which data will be sent. There is such an option in my logger, but I haven't been able to observe any traffic on this port.
Depending on your purpose and the equipment you have, it will be easier to answer specific questions.
I'm looking on the net, but I can't find anything specific, can you provide some links to forums, or details on how to extract some data from this original logger and process it in the internal network? I have set data to be sent every 60s (not every 5min), but it doesn't change much anyway because on the website or app, sofara downloads data somehow randomly, once every 5min, other times every 10 ... etc.
As you can see, the inverters behave differently; for me, the script from my friend @klon111 reads the power value over LAN with 11-KTL-x every minute. Back to Modbus - the Micrologix 1200 controller reads data from Sofar through the adapter RS-232 to RS-485.
In the description ...../pawelka/sofarsolar esp rs485 logger you can see the logger configuration page - you fill it with your data and according to this they go to the MQTT broker (you probably have Mosquitto?)
Gentlemen, colleagues, please tell me if the above logger based on esp can be easily converted into a cable version, because the Wifi range is very poor, there is no more than appears, and the ethernet cable is literally in place.
I connected the inverter via RS485 and the available programs that I was able to download talk to it nicely, but only 10 registers are visible ... Probably a software issue, because I did not go into the details of their configuration.
Ultimately, I would like the data obtained (from the inverter, from the solar controller, from the Tauron meter and, if possible, from the heat pump in the future, and from the water meter and several other sensors, if it is possible) to the server (rather SQL) and there freely manipulate as desired.
As of today, I only have access to the inverter, tomorrow they are supposed to replace the meter from Tauron, so I will get a reading from it, but I would like to handle the inverter first ...
UPDATE: Tauron replaced my meter with a Chinese S34U18, which has a P1 port for communication ... Unfortunately, it was sealed with a sealed cap. I was terribly disappointed. Tauron talks to him via GSM... Is there any other way to read data from this meter? The specification also includes RF (the possibility of radio reading, as with water meters) and an optoport - I don’t know what a miracle it is and how it works.
I tested a ready Eth - RS485 adapter called Elfin-EE11A.
Is the adapter worth buying or do you combine something with "Arduino" with some eth-module and send it to the server? If I buy this adapter, will my colleague be able to help me with possible start-up or configuration, so that the data is somehow uploaded to my SQL?
I changed the concept of how the system works and I don't use EE11A anymore because it didn't want to work when Slave is on Eth side. The master is Micrologix; Node-RED is a Slave for it and also listens to RS485 communication with the inverter and meter. Node-RED puts the received data into MQTT; throwing them into SQL shouldn't be a big problem.
I changed the concept of how the system works and I don't use EE11A anymore because it didn't want to work when Slave is on Eth side. The master is Micrologix; Node-RED is a Slave for it and also listens to RS485 communication with the inverter and meter. Node-RED puts the received data into MQTT; throwing them into SQL shouldn't be a big problem.
So what won't it work for me? Damn, I've already ordered the module :/ When a man gets hot for something, it's a massacre I need to take a closer look at this MQTT, if it can be used locally and not online then maybe I'll get around to it.
Hmm... Generally, I want to read data from the inverter and send them to the server in the simplest way. Whether it will be Node-RED or something "other", I don't know yet. He's just learning about it. What does the colleague understand more precisely by SLAVE and MASTER? I'm asking to make sure we're thinking the same thing.
MQTT works locally when you set up your own server. Write something more, what do you want to do with these measurements?
I have a server at home, mainly as an Internet gateway, NAS and WWW SQL server, but I would like to connect the emerging amateur iHome system to it. Why all together? That’s how it turned out, but I want to change it - Split it into 2 devices - to make it "safer"
What do I want to achieve? Mainly to collect measurement data for statistical purposes on the SQL server, so that I can then present them in a specific way that comes to my mind - whether it’s on a dedicated website or in my own application, it’s a matter of software that I will create. But why reinvent the wheel, I would like to get to know MQTT, maybe it will be enough for my needs at the beginning, and then I will think about what can be modified / changed, or maybe create something of my own. Ultimately, apart from the Inverter, I also want to query other devices, sensors and meters (electricity with a bit of luck, because they gave me some Chinese S34U18 with a plugged P1 port and the water one as they will replace it with a smart one).
I have a server at home, mainly as an internet gateway, NAS and WWW + SQL server ...
Depending on what it "stands" you can find a way to install additional MQTT on your server, e.g. Mosquito as an additional service.
OktawiuszZ wrote:
What do I want to achieve? Mainly collect measurement data for statistical purposes on SQL server
However, you don't need MQTT for this - unless you want to "play around". The easiest way to do it is by adding to the Node-Red server. On the one hand, NR would deal with Modbus communication with the inverter, process the received data and place it in SQL. However, in my opinion, a set of Node-red, Grafana and Influx is more suitable for this task. The advantage of NR is that it has a UI panel for visualizing states and read parameters can be accessed through a browser and the ability to create automation.
OktawiuszZ wrote:
I want to query also other devices, sensors and counters
Depending on the method of communication, NR can handle this more or less easily. There are ready-made nodes in the library to support many devices, there are also "tools" to create your own.
Not knowing anything about your server at this stage, I can't write much more. Look for a way on the net how to "play it" for you, have fun and evaluate if it suits you.
OktawiuszZ wrote:
electricity with a bit of luck, because they gave me some Chinese S34U18 with a plugged P1 port and the water one if they exchange it for a smart one).
I didn't deal with this, but somewhere in the network I flashed that they read the toto using the DVBT SDR tuner. You have to search on your own and create your own topic in "Home Automation".
I have a server at home, mainly as an internet gateway, NAS and WWW SQL server ...
Depending on what it "stands" you can find a way to install additional MQTT on your server, e.g. Mosquitto as an additional service.
I only use Linux, both for everyday work and for the server. I'll get to know MQTT and this Mosquitto.
starob wrote:
OktawiuszZ wrote:
What do I want to achieve? Mainly collect measurement data for statistical purposes on SQL server
However, you don't need MQTT for this - unless you want to "play around". The easiest way to do it is by adding to the Node-Red server. On the one hand, NR would deal with Modbus communication with the inverter, process the received data and place it in SQL. However, in my opinion, a set of Node-Red, Grafana and Influx is more suitable for this task. The advantage of NR is that it has a UI panel for visualizing states and read parameters can be accessed via a browser and the ability to create automation.
It sounds interesting. Saved, in my free time I will read what my colleague wrote.
starob wrote:
OktawiuszZ wrote:
electricity with a bit of luck, because they gave me some Chinese S34U18 with a plugged P1 port and the water one if they exchange it for a smart one).
I didn't deal with this, but somewhere in the network I flashed that they read the toto using the DVBT SDR tuner. You have to search on your own and create your own topic in "Home Automation".
In fact, when it comes to my electricity meter, I found little about it ... I have a TVBT SDR tuner myself. For now, I want to handle the inverter, then the solar panels, then the electricity meter ... one by one, not all at once, because nothing will happen.
I tested a ready Eth - RS485 adapter called Elfin-EE11A.
Does your friend remember exactly how he had it set up?
I'm already struggling with this one evening in a row, and due to Sofar's auto-sleep at night, there's not much time ... As for the speed, I have set 9600/8/N/1, RTU, DTR and RTS, on the rs485- usb works fine and reads data from the inverter nicely.
The problem starts when I set the same parameters on EE11A - it does not read anything. As for the electrical connection, it's pretty much everything I connected it well, because the power is on, the ethernet part works, the RS cable is ok, because the USB adapter works. There may be a problem with a key parameter in the configuration or something related to the RS from the EE11A side ... That's why I'm asking my friend for information about the configuration of his Elfinka.
What tool do you want to read it with? You have Modbus TCP set up
Working settings on the picture, circled what to pay attention to. I have port 503 - set it properly Check the status to find out if the problem is in Eth or RS485. IP set means someone is connected
I have port 503 - set it properly Check the status to find out if the problem is in Eth or RS485. IP set means someone is connected
Both electrically and software is correctly done. I was able to connect to EE11A on my phone, which I confirm in the attached screenshot.
I also tried to fight with MQTT, but something went wrong and the server said that it did not want to start this system. I need to clean it up, mostly with 15-year-old drives, as well as with the system on the main computer.
If anyone is interested, I managed to get to Sofar (K-TLX) by IP via the WiFi module (LSW-3 S/N 17xxxxxxx). The solution allows you to download all data normally sent to the cloud and made available on the MODBUS bus. If necessary, it can also send them to the MQTT server.
If anyone is interested, I managed to get to Sofar (K-TLX) by IP via the WiFi module (LSW-3). The solution allows you to download all data normally sent to the cloud and made available on the MODBUS bus. If necessary, it can also send them to the MQTT server.
Sure!!! Don't brag, just give it a go Which firmware version do you have in LSW.. or is it a DNS trick?
No trick with DNS The solution polls the inverter directly via the LSW-3. Tested on LSW-3 version: LSW3_15_FFFF_1.0.57 Sofcik is written in python3 for Linux (tested on Raspberry), download here: https://github.com/MichaluxPL/Sofar_LSW3
The protocol was figured out exactly by this man: https://github.com/jlopez77 I just adapted his solution to Sofar and made some improvements. Generally, having a list of MODBUS registers for a given inverter, you can easily adapt its solution to almost every inverter that communicates with the world via LSW-3
The discussion revolves around integrating the Sofar Solar KTL-X inverter with Domoticz via RS485 Modbus, addressing issues related to communication, configuration, and data retrieval. Users share experiences with various setups, including the use of Ethernet-to-RS485 converters and the LSW-3 logger. Key points include the need for correct transmission parameters (9600 baud, 8 data bits, no parity, 1 stop bit), the importance of proper wiring, and the challenges faced when using different firmware versions. Participants also discuss the mapping of Modbus registers for accurate data reading and the potential for using Node-RED for automation. Solutions for common problems, such as timeouts and data retrieval errors, are provided, along with suggestions for configuring Home Assistant for monitoring. Summary generated by the language model.