logo elektroda
logo elektroda
X
logo elektroda

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

starob 98043 318
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #151 19809502
    ofi
    Level 10  
    I will add to the topic because I recently implemented a similar solution and maybe someone will find it useful. I tried to connect the Solar Sofa 12KTL-X (branded as ZCS Azzurro) to Home Assistant. Firmware v2.90. I tried to query the logger directly (LSE-3, firmware ME_0B_2701_5.06), but it didn't work - I couldn't get tired of it despite dumps of communication with solarmanpv. Finally, I used the USR-TCP232-304 from the Chinese (I had it in the closet for another project), plugged it into one of the free RS485 connectors of the inverter and connected directly via ethernet with HASS via Modbus RTU. There was no need to write any additional software. HASS has a dedicated module for this, so all you had to do was carve YAML with register configuration. If anyone needs more info, please write. I'm not publishing YAML at the moment, because I'm a novice in HASS and I don't know how good-way my solution is. The data compared with solarmanpv are identical.

    I also wanted to thank you - the data with registers posted in this thread helped me a lot in configuration, and the soft from https://github.com/MichaluxPL/Sofar_LSW3.git was able to dump and display data via Modbus RTU after a slight modification.

    Pros: USR-TCP232-304 - it's relatively cheap (< 30USD) and looking at the amount of work involved in assembling, for example, ESP - it pays off for me. I also wanted cable, not WiFi.
    Cons: No authorization in TCP communication. It would be nice to have a separate VLAN for this.
  • ADVERTISEMENT
  • #152 19849137
    acros82
    Level 10  
    Could someone write what exactly needs to be done to integrate the Sofar KTL-X 8.8 inverter with Home Assistant?
  • ADVERTISEMENT
  • #153 19849186
    ofi
    Level 10  
    acros82 wrote:
    Could someone write what exactly needs to be done to integrate the Sofar KTL-X 8.8 inverter with HomeAssistant?


    The question is how do you want to do it? Because there are at least three:
    1) downloading data from solarmanpv or other service to which you connected the logger via their API or parsing the page
    2) downloading data from the logger directly (LSW/LSE) and here it is different - I couldn't get it to work
    3) downloading data directly from the inverter via RS485 (or via ethernet/wifi) and via ModBus
  • #154 19849228
    acros82
    Level 10  
    ofi wrote:
    acros82 wrote:
    Could someone write what exactly needs to be done to integrate the Sofar KTL-X 8.8 inverter with HomeAssistant?


    The question is how do you want to do it? Because there are at least three:
    1) downloading data from solarmanpv or other service to which you connected the logger via their API or parsing the page
    2) downloading data from the logger directly (LSW/LSE) and here it is different - I couldn't get it to work
    3) downloading data directly from the inverter via RS485 (or via ethernet/wifi) and via ModBus



    Preferably 2, possibly 3, only here I know that you need an RS485 converter
  • #155 19849243
    ofi
    Level 10  
    In that case, it's best to start by downloading this software: https://github.com/MichaluxPL/Sofar_LSW3.git and try to run it so that InverterData.py spits out data from the inverter. In short - you need to correct the config for your network, possibly install the missing python modules and start. There is a description in the repo. If you succeed, you will be "almost home".

    One more thing - it all depends on what version of the LSW or LSE module you have. This firmware should work with newer ones. You can also google something for older versions.
  • #156 19849457
    acros82
    Level 10  
    Dodatek w HA wywala błąd

    Every 60.0s: python3 ./Sofar_LSW3/InverterData.py 2022-01-28 22:37:37
    Traceback (most recent call last):
    File "/data/./Sofar_LSW3/InverterData.py", line 85, in
    DomoticzSupport=configParser.get('Domoticz', 'domoticz_support')
    File "/usr/lib/python3.9/configparser.py", line 781, in get
    d = self._unify_values(section, vars)
    File "/usr/lib/python3.9/configparser.py", line 1149, in _unify_values
    raise NoSectionError(section) from None
    configparser.NoSectionError: No section: 'Domoticz'

    Mój moduł to LSW3_15_FFFF_1.0.57
  • #157 19850210
    ofi
    Level 10  
    The "[Domoticz]" section is missing from the configuration file. Sure of this:

    [Domoticz]
    domoticz_support=0 # 0: disabled, 1: enabled
  • #158 19892746
    xury
    Automation specialist
    Hello, I am a new owner of Sofar 4.4 ktl-x, I have read the whole topic and I have a request to my colleagues for a short summary and answers to a few questions, because I am a bit confused after reading six subpages of the topic.
    Is it possible to collect exactly the same amount of data as via rs485 when collecting data via LSW-3?
    So you just have access to exactly the same registers as after rs485?
    I mean, of course, access to data through the local address of the data logger, not through some clouds.
    I see that buddy starob mastered node-red pretty well (greetings, we've already written to each other a few times). I too am going to use NR for integration. If it is not possible to get to all the data through the LSW-3, I will probably do the same as I did with the integration of the Riden RD6018 power supply, i.e. I deleted the original firmware from the esp8266 dongle and uploaded the esp-link to it. Here it is enough to do the same, i.e. convert rs485 to USART lvTTL and send it via wifi, doing as if converting modbus rtu to modbus tcp.
    Regards, Xury

    Added after 7 [hours] 52 [minutes]:

    All right. I was writing at night and couldn't test then. I couldn't wait for the morning. Colleague flow starob is all I need.
  • #159 19892854
    krawietz
    Level 16  
    You can read some information from the logger normally by IP, but I have not found anywhere documentation that would 100% correspond to the data returned by the logger.
    While the information about power, currents and voltages overlap, e.g. the reading of reactive power is terribly strange.
    I made a simple self-monitoring on node-red that collects data every 30 seconds and visualizes them.

    Krawietz
  • #160 19892978
    starob
    Level 29  
    Regards @xury...yes. yes it's because of you :)
    There is already a corrected version for checking the correctness of the data. For unknown reasons, lsw periodically returns data from d..y despite correct CRC. This reading is practically modbus, only encapsulated with additional data overhead. Test what is for now, in my free time I will give you a newer version ... maybe you can improve something more ... chief :please:
  • #161 19898633
    Michalux
    Level 10  
    I haven't been here for a while :)
    On the subject of Domoticz support, I have uploaded the latest version (1.66) to GIT.
    Support for MQTT/Domoticz has been improved (proposed fixes a few posts above are not entirely in line with the art :) ).
    Currently, the solution works as it should and there is no problem with publishing all messages to MQTT.
  • #162 19901037
    nedel124
    Level 10  
    Hello,
    Someone may have tested it on the Sofar Solar 8.8KTL-X G3 LSW-3. I'm going to buy it and I'm looking for information if the modbus has remained the same as in G2.
  • #163 19901306
    Nixen241
    Level 1  
    Hi,
    I'll throw in my 2 cents as well. I made a home boiler controller, which, based on the data taken from the inverter temperature probe, turns the heaters on and off, just like a colleague a little above. I came across the thread a lot after making the board and writing the software, but the list of registers was very helpful.

    I collect data through the MAX485 module for esp32, which manages the heaters plus spits data to HTTP endpoints. There, the data is aggregated by Prometheus and then read by Grafana.

    If anyone would like to see the code, please visit my GitHub (nixenos/solar-heater-controller). Unfortunately I can't share links yet, I've never posted on an electrode.

    Perhaps someone will find my writings useful and find something interesting there ;)
  • #164 19902609
    xury
    Automation specialist
    I have a question about inverter temperature.
    Right now my sofar 4.4 ktl-x is running at full power. I have 12 405W panels.
    I didn't expect it to produce so well.
    There is nothing in the documentation about temperatures. The inverter is mounted inside the house and I am concerned about its temperatures. I currently have Inner 52 degrees, module 45 degrees. Is it too much or can it be?
  • #165 19902689
    Michalux
    Level 10  
    I uploaded another version of the monitoring solution (1.8) to my GIT - this time support for HomeAssistant was added (the code was provided by pablolite, I just optimized ;) ) and generally reworked support for MQTT.
    If anyone wants to test it, it's here: https://github.com/MichaluxPL/Sofar_LSW3
  • ADVERTISEMENT
  • #166 19902740
    starob
    Level 29  
    @xury it's ok for now. at 70 degrees will start to reduce power.
  • #167 19904181
    nedel124
    Level 10  
    I confirm working on Sofar Solar 8.8KTL-X G3. In this version, the LSW-3 is via USB. In the attachment, I attach the Modbus documentation for the G3 series, it may be useful to someone.

    Rectification:
    If anyone wants to use the @Michalux script with G3 version inverters, please adapt the configuration file with the documentation in the attachment.

    Test done:
    - LSW3_15_270A_1.32
    inverter
    Software version:
    - MasterSoft: V000006
    - Vice Soft version: V000003
    - Hardware: V203
    - Standard 0507
    - Communication processor software version: V00005

    Important code changes include
    businessfield= binascii.unhexlify('0104' + pos_ini + pos_fin) # Modbus data to count crc
    

    on
    businessfield= binascii.unhexlify('0003' + pos_ini + pos_fin) # Modbus data to count crc
    


    Customized for your own needs link
  • #168 19918021
    lukascpu
    Level 6  
    Hello, I tested the solution from @Michalux - MQTT influxdb HA (version 1.8.3) and the KTL-X 11 LSW3 inverter - everything works fine, crontab, reads everything every 1 minute.
    @Michalux sorry for poisoning but can you tell me what are string 1-8 voltage and string 1-8 current? Because in my case these data are from the cap - String voltage 8 = PV1 voltage, I don't know where they come from - 1-2 is over 20 A, then nothing until 7-8 - here 62 A and 50 A respectively ( -); then PV1 current tested by the CPU - over 500A - I understand that you can remove what is unnecessary by editing XML?
  • #169 19922846
    Michalux
    Level 10  
    And this question is not for me, but for the manufacturer, i.e. Sofar :)
    I only download what is issued by MODBUS on individual registers.
  • #170 19923746
    kumaPL
    Level 5  
    Hello and welcome.

    I'm new to the forum and wanted to say hello :)
    Good morning.

    Taking this opportunity, could I ask for more or less guidance on how to run this integration for Sofar on HA? It's the one from @Michalux
    I have a Home Assistant installation downloaded from the official website for rpi4, plus working mqtt and I don't know what to do next.
    I had several integrations for Sofar on HA, but none work properly and I wanted to test another one.
    I read the thread, maybe you need to install something to HA?
    I understand that on HA you need to add config.cfg somewhere and here is the problem because I do not know where and how to run it ...
    Can I count on your help and understanding?

    Regards
  • #171 19923840
    xury
    Automation specialist
    Have you read Readme.md on github? Everything is described there and how.
    Install python modules
    You need to determine the IP of your LSW3 and enter it in config.cfg
    Unlock MQTT and HA by typing 1 instead of 0
    Set MQTT in configuration.yaml
    Autodiscovery should show the entities by themselves if everything is configured correctly.
  • #172 19923858
    kumaPL
    Level 5  
    xury wrote:
    Have you read Readme.md on github? Everything is described there and how.

    Yes of course.
    I have all ip,sn and mqtt data.

    However, I do not know how to install the necessary components mentioned in the readme.
    I know it's easy for some, but unfortunately I don't know how to do it, that's why I asked for help....
  • #173 19924065
    xury
    Automation specialist
    What type of HA installation do you have?
    Native, or HA in Docker or HA in Proxmox VM?
    If you have ssh access then simply:
    pip -m install libscrc paho-mqtt influxdb
  • ADVERTISEMENT
  • #174 19924071
    kumaPL
    Level 5  
    xury wrote:
    What type of HA installation do you have?
    Native, or HA in Docker or HA in Proxmox VM?


    Quote:
    core-2022.3.3 version
    Home Assistant OS installation type

    This is probably the native version.
    I downloaded the iso file from the HA website, uploaded it to the memory card and it works.

    I have access to HA via ssh, but after entering pip -m install libscrc paho-mqtt influxdb I get information that it does not recognize the pip command. It is most likely not installed.
    How to install pip?
  • #175 19924081
    xury
    Automation specialist
    On the native Home Assistant OS, unfortunately, I do not know. You have to search online.
  • #176 19936805
    lukascpu
    Level 6  
    kumaPL wrote:
    xury wrote:
    What type of HA installation do you have?
    Native, or HA in Docker or HA in Proxmox VM?


    Quote:
    core-2022.3.3 version
    Home Assistant OS installation type

    This is probably the native version.
    I downloaded the iso file from the HA website, uploaded it to the memory card and it works.

    I have access to HA via ssh, but after entering pip -m install libscrc paho-mqtt influxdb I get information that it does not recognize the pip command. It is most likely not installed.
    How to install pip?


    It is not possible to install the required python modules on HASSOS - you have two options - either you will run it on some raspberry or something that has linux or reinstall Home Assistant - on debian - then you have a working linux underneath and all HA including the supervisor, etc.
  • #177 19936814
    kumaPL
    Level 5  
    That's what I did, but it turns out that my version of sofar doesn't support it :(
  • #178 19936826
    starob
    Level 29  
    kumaPL wrote:
    but it turns out that my sofar version doesn't support it

    Can you specify the types and versions of the software?
    I have already encountered the fact that in new equipment there is a soft that does not work.
  • #179 19936853
    kumaPL
    Level 5  
    starob wrote:
    Can you specify the types and versions of the software?
    I have already encountered the fact that in new equipment there is a soft that does not work.


    Version information from the solarman website
    Hardware Version:V202
    Master Software Version:V000005
    Vice Software Version:V000003
    Standard Main Version:0507
    Communication processor firmware version:V000004

    I bought it in February, but the distributor probably at the end of December because that's the date of purchase on the sofara website.
    I have a SOFAR 11 KTL-X G3.
    From what I found out, there is some difference in modbus
  • #180 19936860
    starob
    Level 29  
    kumaPL wrote:
    From what I found out, there is some difference in modbus

    For now, forget about integration other than through the RS485 converter and modbus.
    They changed the protocol and LAN versions don't work yet.
    Didn't we already rewrite this topic as "ArturHome"? :)
    Could you show a screenshot of the inverter status page?

Topic summary

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.
ADVERTISEMENT