logo elektroda
logo elektroda
X
logo elektroda

Sofar Solar KTL-X Inverter: RS485 MODBUS Integration with Domoticz - Setup & Tips [90]

starob 100521 318
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #271 20546464
    starob
    Level 29  
    xury wrote:
    how to clear production data in Sofar


    I can't give you an exact answer, but it might give you a clue.

    Sofar Solar KTL-X Inverter: RS485 MODBUS Integration with Domoticz - Setup & Tips [90]

    Sofar Solar KTL-X Inverter: RS485 MODBUS Integration with Domoticz - Setup & Tips [90]

    I do not know how to interpret this information, because, for example, one register 0x6000 can contain 48 bytes ;) ...and does this apply to your inverter?
  • ADVERTISEMENT
  • #272 20547066
    xury
    Automation specialist
    Well, that's what I saw, there is no info on which register to send FC33 to
  • #274 20592477
    putas
    Renewable energy sources specialist
    Does anyone have a map of RS485 Modbus registers for Sofara 50KTLX-G3
    I say right away, it is different from the 50KTLX version
  • #276 20598056
    dejanmarkovic28
    Level 2  
    Hello all,
    I have a strange case with SOFAR 5KTLX-G3. When there is no production (sun is down) the inverter does not send information about consumption (goes to sleep I guess). Is there a setting to disable that behavior?
    Thanks!
  • #277 20601285
    acorbetta
    Level 1  
    >>20130871
    spin722 wrote:
    Modbus TCP, as usual, will use port 502. Therefore, packets will not go through port 8899 to the inverter. But better check it out.

    I set the SOFAR 60000TL inverter power via RS485 port, Modbus RTU protocol. I hope this will be important for other SofarSolar inverters.
    For example, you need to set the power to 57%. Therefore, you send to port 01 06 90 00 39 D9 77 (hex meaning).

    Here
    01 - ID (Modbus address) of the inverter
    06 - function number
    90 00 - starting register
    00 39 - power meaning (57 dec = 39 hex) Power unit here 1%. 100% corresponds to 64 hex
    D9 77 - CRC (check sum)

    You can submit a different package for yourself, CRC can be counted online https://www.lammertbies.nl/comm/info/crc-calculation
    Sofar Solar KTL-X Inverter: RS485 MODBUS Integration with Domoticz - Setup & Tips [90]

    CRC in Sofar go Lo byte, Hi byte - not standard. Therefore, the bytes in the counted CRC must be changed by place.

    Hi, do you know what is the corresponding register in 8.8KTL? I tried with FC 06 and register start address 90 00, but it doesn't work.
    Direct connection to RS485 tirh Ethernet-to-RS485 adapter, that works well when reading other registers (ex. total production, etc).

    My inverter has Modbus ID = 2, so to set the power rating to 91% the command is:

    02 - ID (Modbus address) of the inverter
    06 - function number
    90 00 - starting register
    00 5B - power meaning (91 dec = 5B hex)
    E5 02 - CRC (check sum)

    When I send the command, the inverter doesn't answer and the power rate on the inverter doesn't change. Any ideas?
    Many thanks!
  • ADVERTISEMENT
  • #279 20602073
    lopr_pol
    Level 32  
    dejanmarkovic28 wrote:
    Hello everyone,
    I have a strange case with SOFAR 5KTLX-G3. When there is no production (sun sets) the inverter does not send information about consumption (probably goes to sleep). Is there a setting to disable this behavior?
    Thanks!

    Virtually every inverter takes power from DC, also after sunset it does not work and does not send any information.
  • #280 20602379
    dejanmarkovic28
    Level 2  
    lopr_pol wrote:
    dejanmarkovic28 wrote:
    Hello everyone,
    I have a strange case with SOFAR 5KTLX-G3. When there is no production (sun sets) the inverter does not send information about consumption (probably goes to sleep). Is there a setting to disable this behavior?
    Thanks!

    Virtually every inverter takes power from DC, also after sunset it does not work and does not send any information.


    Is there any work around this? I need information about consumption.
    Thanks!
  • #281 20608715
    Robuś
    Level 11  
    >>20602022
    @ArosS95
    How do you read these registers. I also got this file but I can't communicate with the inverter for any treasures.
  • #282 20610806
    michalmrereiter
    Level 1  
    >>20338668
    Helped me!
    register works on Sofar HYD 10KTL-3PH
  • ADVERTISEMENT
  • #283 20613865
    ArosS95
    Level 2  
    >>20608715
    The slave address is set on the inverter
    parameters 9600/8/n/1
    Plug the terminator into the inverter
  • #284 20653347
    tmesaros77
    Level 1  

    Hi,
    Does anyone have experience with writing values into a holding register? For example, I need to change BatConfig_Depth_of_Discharge, which is at address 0x104D. Does it need to be written in some blocks?

    Writing a single holding register with 06 does not work :(. I'm able to change some parameters, but it looks like I need to write multiple holding registers at once, but I'm not sure how the blocks of them work...
    Thanks,
    Tomas.
  • #285 20664927
    kosiarz1978
    Level 2  
    Hi. I've been struggling with this code for a long time, can anyone help me? I have this answer:
    Connecting to logger... connected successfully !
    *** Chunk no:  0
    Sent data:  bytearray(b'\xa5\x17\x00\x10E\x00\x00\x0b\x8a\xd1\xa1\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x03\x00H\x00!\x05\xc4\x00\x15')
    Received data:  b'\xa5U\x00\x10\x15\x00\x8e\x0b\x8a\xd1\xa1\x02\x01\x80pw\x00y\x16\x00\x00\xd5\xd1Ed\x01\x03B\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x86\xf5\x1e\x15'
    *** Chunk no:  1
    Sent data:  bytearray(b'\xa5\x17\x00\x10E\x00\x00\x0b\x8a\xd1\xa1\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x03\x00i\x00\x04\x94\x15\x00\x15')
    Received data:  b'\xa5\x1b\x00\x10\x15\x00\x8f\x0b\x8a\xd1\xa1\x02\x01\x80pw\x00y\x16\x00\x00\xd5\xd1Ed\x01\x03\x08\x00\x00\x00\x00\x00\x00\x00\x00\x95\xd7\x96\x15'
    Traceback (most recent call last):
      File "./InverterData.py", line 250, in 
        jsonoutput=json.loads(output)
      File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
        return _default_decoder.decode(s)
      File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
        raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)


    Added after 3 [hours] 44 [minutes]:

    >>20362752
    This code spits out data for me, but it's a pity that it doesn't send, for example, to Domoticz. And the main one from MichaluxPL unfortunately does not work as you can see above.
  • #286 20701869
    lukasz_prz
    Level 11  

    Hi,

    Will there be a good soul here who, for a fee, would do the reading via Modbus with ktl-x G3 for me? For the time being, I am sucking data from ledger via Node-RED, but I would like to eliminate the node and go straight to MQTT to zap the data.

    Thank you
  • #287 20763330
    skrut355
    Level 13  
    Hello colleagues. Does anyone perhaps have a breakdown of modbus addresses for inverter. 4.4ktlx-g3? All found on the electrode and on the internet do not match.

    Ports scanned.
    Only addresses DEC 1862 to DEC1865 give voltage and current data from string 1.
  • #288 20950238
    Ma_k
    Level 11  

    dejanmarkovic28 wrote:
    Hello everyone,
    I have a strange case with SOFAR 5KTLX-G3. When there is no production (the sun is setting), the inverter does not send information about consumption (it probably goes to sleep). Is there a setting to disable this behavior?
    Thanks!


    Cool simple will try to run on 30KTLX-G3 and LSE-3 USB
    now it's dark and there's sleep mode
    for now it reports error on line 100 NameError: name `prometheus` is not defined
  • #289 20954668
    LordZiemniak
    Level 15  
    I have mastered the controller for ESP32 and RS585 to TTL on HA, it sends me data to HA and it works, reporting on an ongoing basis every 5 seconds, bypassing the cloud :) for the KTLX G3 sofar (I previously tried to read data from the logger using scripts, but it didn`t work)

    Now the question is whether anyone has data on modbus for the Sofar DTSD422-D3 counter because I want to go to the energy tab in HA
  • #290 20983289
    prose
    Level 35  
    @xury Format the SD or set production to zero in the menu.
  • ADVERTISEMENT
  • #291 20993833
    LordZiemniak
    Level 15  
    and I made an integration reading data straight from the DTSD422-D3 meter, it works in HA, I also have all the registers for this meter straight from Majfrend
  • #292 21005841
    Zigus
    Level 14  
    Hello,
    I won`t hide the fact that I want to communicate via Modbus from the website


    https://github.com/pawelka/sofarsolar_esp_rs485_logger


    But there is one problem, I think the registers don`t match because I have empty entities...
    Has anyone started this project or has a similar one working with the Sofar 8.8 Ktl-x model? software version 3.0
  • #293 21005844
    LordZiemniak
    Level 15  
    I started it and it works, but on ktlx g3 check if you have the right registers :)
  • #294 21005852
    Zigus
    Level 14  
    Well, I`m looking for any tips because I`ve been wasting 3 days on this, I don`t want it to work.

    The project is 3 years old, the software is newer
    in the documentation from Pawelek he writes that it works with the KTL-X series without G
    just a question whether something has changed in the new software ;/
    documentation for Modbus 8.8 KTL-X is also not easily available
  • #296 21005871
    Zigus
    Level 14  
    maybe it`s stupid what I`m writing, but I`ve already tried all possible combinations of tx/rx from esp to the converter, as well as converting A and B to Rs485, only in one combination, tx/rx lights up on the converter alternately and the rs485 message appears on the inverter, which indicates that the connection it`s ok (I guess) ;/
  • #297 21005875
    LordZiemniak
    Level 15  
    In the link I gave you, it does it for ktlx, so you have to do it exactly the same way, to the same pins, and it should work. :)
  • #298 21005882
    Zigus
    Level 14  
    I have one thing that is not consistent with the guides above
    I have a nodemcuv3 board but when I enter it in the board it does not compile, the connections are the same in terms of pins
    maybe I`m doing something wrong here? but why would it matter so much?
  • #299 21012034
    GP007
    Level 8  

    [InverterData.py]

    I changed the server to a newer one and something changed with the paho mqtt API because I get this error after running the script while sending mqtt:

    Traceback (most recent call last):
    File "/root/domoticz/scripts/python/Sofar_LSW3-main/InverterData.py", line 315, in
    client=paho.Client("inverter")
    File "/usr/local/lib/python3.10/dist-packages/paho/mqtt/client.py", line 766, in __init__
    raise ValueError(
    ValueError: Unsupported callback API version: version 2.0 added a callback_api_version, see migrations.md for details

    Can anyone help?

    EDIT:
    I read it :)
    replacement needed: client=paho.Client("inverter") to client=paho.Client(paho.CallbackAPIVersion.VERSION1,"inverter")
  • #300 21012952
    LordZiemniak
    Level 15  
    >>21005882

    Haven`t you written on github about the same problem?

Topic summary

The discussion focuses on integrating the Sofar Solar KTL-X inverter with Domoticz via RS485 Modbus communication due to instability issues with the WiFi logger. Key technical details include the RS485 connection using RJ45 connectors with pins 2,3,4 shorted as A+ and pins 1,5,6 shorted as B-, and a communication speed of 9600 baud, 8 data bits, no parity, 1 stop bit (9600/8/N/1). Users shared experiences reversing RS485 wires to establish connection and scanning registers with various tools. The Sofar inverter’s Modbus register map is partially undocumented and varies by firmware and model, complicating integration. Solutions involve using ESP-based loggers (e.g., sofarsolar_esp_rs485_logger) that send data via MQTT to Domoticz or Node-RED, with some users developing Python plugins and Node-RED subflows for data parsing and visualization. Additional hardware like SDM72D-M or MEW-01 meters are used for accurate energy measurement and self-consumption calculation. Some users employ LAN controllers (e.g., TinyControl LK3.8) to aggregate Modbus data and forward via MQTT or HTTP. Challenges include handling different firmware versions (V4, V5 protocols), register addressing differences, and reading real-time inverter clock data, which appears unavailable. The community also discusses integrating other devices like Tauron meters and heat pumps, using MQTT brokers (e.g., Mosquitto), and visualization tools like Grafana and InfluxDB. The overall approach emphasizes custom, local data acquisition and processing to overcome limitations of official cloud services and proprietary protocols.
Summary generated by the language model.
ADVERTISEMENT