home_assistant_solarman icon indicating copy to clipboard operation
home_assistant_solarman copied to clipboard

Switched from wireless lan logger LSW-3 to cable logger LSE-3

Open hasant73 opened this issue 1 year ago • 47 comments

I first tried the LSW-3 logger and I could connect with home assistant to the logger and get data. But I don't have good WLAN in the cellar where the inverter is installed. So I switched from the wireless version to the LAN cable version called LSE-3. LSE-3 is reporting to solarmanpv website successfully. But Home Assistant doesn't want to connect anymore. Does somebody know if there is a setting I need to change or have any other idea what's wrong.

I have changed the serial number of the logger in the config. Otherwise I use the deye_sg04lp4.yaml file. I entered the IP address of the logger and setup the network that it is always the same IP address. I can also reach the configuration web page of the logger.

The number of the serial number starts with 21...

hasant73 avatar Mar 20 '23 08:03 hasant73

Hi, I second this - got LSE3 wired logger and so far was unable to connect it to HASS at all. I Will gladly serve as a sandbox for LSE3 integration testing :) (SN 21xxxxxxxx...) firmware MW4C_14_CSIP_1.14

LOG: (recurring messages) Logger: custom_components.solarman.solarman Source: custom_components/solarman/solarman.py:173 Integration: Solarman ([documentation] First occurred: 19. března 2023 v 19:34:43 (1104 occurrences) Last logged: 15:04:20

Querying registers [3 - 89] failed, aborting.

MartinNeurol avatar Mar 20 '23 13:03 MartinNeurol

It looks like the stick has port 8899 open:

`Starting Nmap 7.80 ( https://nmap.org ) at 2023-03-20 15:43 CET

Nmap scan report for solarman-logger.fritz.box (192.168.178.125)

Host is up (0.0029s latency).

Not shown: 998 closed ports

PORT STATE SERVICE

80/tcp open http

8899/tcp open ospf-lite`

hasant73 avatar Mar 20 '23 14:03 hasant73

I read in other issues that this integration supports only the WiFi dongles, some had success with the beta version, but most not. Search for "ethernet" in the issues. If you find a way, please tell me!

Matz88 avatar Mar 29 '23 07:03 Matz88

I have the same issue :(

sanderbaks avatar Apr 03 '23 18:04 sanderbaks

I still did not get it to work? Did anyone find a solution?

sanderbaks avatar May 07 '23 12:05 sanderbaks

If you have the LAN adapter, just try the SolaX Power Modbus custom_component

Matz88 avatar May 07 '23 14:05 Matz88

Ow, Ok, lets try that!! I'll let y'all know the results

sanderbaks avatar May 07 '23 14:05 sanderbaks

I have the same logger LAN and I cannot as well use this integration, values always unknown. right now the only solution I found, as reported also above, is with SolaX Power modes integration.

McLP11 avatar May 15 '23 20:05 McLP11

I have the same problem. I cannot read Modbus from Deye SUN 5K sg03lp1 inverter with a LSE-3 Stick logger. The LAN LSE-3 logger (s/n 21xxxxxxxx) works well with Solarman website but returns incorrect data from local requests based on Solarman V5 protocol.

For example, a request for battery voltage (reg:0x00B7) gives me :

        Tx Packet: a5 1700 1045 ad00 [s/n] 02 0000 00000000 00000000 00000000 01 03 00b7 0001 342c bc 15
	Rx Packet: a5 1700 1045 03 00 bc 02

The return packet is way too short , should have 1015 instead of 1045 and length-byte is wrong.

With LSW-3 logger the response is :

      Rx Packet:  a5 1500 1015 ab3d [s/n] 02 01 5d510000 04070000 00000000  01 03 02 14c7 f6d6 e4 15

where 0x14C7=5319 is exactly my battery voltage x0.01 (53.19V)

Does anyone have any idea where to look?

adnovea avatar May 19 '23 20:05 adnovea

McLP11, could you tell more about the use of SolaX Power modes integration with LSE-3 and Deye ? Thanks

adnovea avatar May 28 '23 18:05 adnovea

@adnovea right now SolaX Inverter Modes looks like the only integration I was able to connect with my LSE-3 LAN dongle. It exposes 159 sensors, including also some switches or specific tools for configuration but not tested yet at all. It's pretty stable, I've just noticed that sometimes is not back online when you restart HA, new restart and back again

McLP11 avatar May 28 '23 21:05 McLP11

Thanks McLP11 for your reply. I'm trying to understand what is different between SolaX and Solarman to make the LSE-3 working. Is SolaX using a portal and an API ? What I'm looking for, is local communicate with my Inverter using the LSE-3 on my local network only (not using the Solarman Cloud portal API). This was possible with the LSW-3. Which version of SolaX have you installed, the one I used with HAC is SolaX Inverter Modbus and expose only 4 sensors and I cannot connect to my Deye using the SolaX Power integration.

adnovea avatar May 29 '23 06:05 adnovea

I can communicate with the inverter using the LSE-3 Stick Logger and the GModbus RTU/TCP tester (free) application (https://www.gineers.com/media/downloads/GModbus.zip). The LSE-3 supports RAW Modbus RTU/TCP without the V5 Solarman encapsulation.

Device tested on DEYE Sun-5K-SG03LP1-EU:

LSE-3 Stick Logger S/N: 21xxxxxxxx F/W: MW4C_14_CSIP_1.14 Extended system version: ME_0D_5406_4.07

GModbus log:

	Connected TCP/IP, at 08:54:01
	Send: 03 E8 00 00 00 06 01 03 00 55 00 02 
	Received: 01 03 04 01 03 00 00 0B CF 
	Disconnected TCP/IP connection at 08:54:10

LSE-3 support "raw" Modbus RTU/TCP (I ran a small PHP script to do my tests)

Example: FC3 read Single Register: REG=85 NB=2

Status: Connected
Tx Packet: 03e800000006010300550002d41b
Rx Packet: 03e80000000701030401030000

Request for Total Load Consumption register reading :
	03E8: Transaction identifier
	0000: Protocol identifier
	0006: Message length 
	  01: Slave ID
	  03: Read function (Holding)
	0055: 1st register address
	0002: Number of register to read
	D41B: CRC-16 ModBus with little Endian

Answer from Total Load Consumption register :
	03E8: Transaction identifier
	0000: Protocol identifier
	0006: Message length 
	0103: Value LSB
	0000  Value MSB  ==> 25.9 kWh

Example: FC3 read Multiple Registers 3-112: REG=0003 NB=110

    Request send: 
            03e8: Transaction identifier
            0000: Protocol identifier
            0006: Message length (w/o CRC)
              01: Slave ID
              03: Read function
            0003: 1st register address
            006e: Nb of registers to read 
            3426: CRC-16 ModBus
    
    Received data: 
            03e8: Transaction identifier
            0000: Protocol identifier
            00df: Message length 
              01: Slave ID
              03: Read function
              dc: Number of bytes read (220)
            3232: Inverter ID [reg 0003] - ASCII values (22......)
            ....

adnovea avatar Jun 13 '23 08:06 adnovea

This is great to hear. I am following this development!

sanderbaks avatar Jun 13 '23 09:06 sanderbaks

[SOLVED] I have modified the Solarman code to reflect the LSE-3 protocol changes.
As mentioned above, the Ethernet LSE-3 Stick Logger does not implement the V5 encapsulation (probably used as an additional security in the Wifi transmission protocol of the LSW-3).

To use the LSE-3 (version S/N: 21xxxxxxxx) with the Stephane's component, you may first backup the 2 files solarman.py & parser.py located in the config\custom_components\solarman folder and then apply the modifications below using the File Editor.

parser.py:


(line 5)
#ADNOVEA FIX begin
# OFFSET_PARAMS = 28
OFFSET_PARAMS = 9
#ADNOVEA FIX end

solarman.py

(line 15)
# ADNOVEA FIX begin
# SERIAL_NO = [0x00, 0x00]
SERIAL_NO = [0x03, 0xE8]
PROTOCOL_BYTE = [0x00, 0x00]
#ADNOVEA FIX end

(line 66)
    def generate_request(self, start, length, mb_fc):
#ADNOVEA FIX begin
#        packet = bytearray([START_OF_MESSAGE])
        packet = []
        packet.extend(SERIAL_NO)

        packet_data = []
        packet.extend(PROTOCOL_BYTE)
#        packet_data.extend (SEND_DATA_FIELD)
        buisiness_field = self.get_read_business_field(start, length, mb_fc)
        packet_data.extend(buisiness_field)
#        length = packet_data.__len__()
        length = packet_data.__len__() - 2
#        packet.extend(length.to_bytes(2, "little"))
        packet.extend(length.to_bytes(2, "big"))
#        packet.extend(CONTROL_CODE)
#        packet.extend(SERIAL_NO)
#        packet.extend(self.get_serial_hex())
        packet.extend(packet_data)
        #Checksum
#        checksum = 0
#        for i in range(1,len(packet),1):
#            checksum += packet[i]
#        packet.append(checksum & 0xFF)
#        packet.append(END_OF_MESSAGE)
#ADNOVEA FIX end

        del packet_data
        del buisiness_field
        return packet

(line 164)
    def send_request(self, params, start, end, mb_fc, sock):
        result = 0
        length = end - start + 1
        request = self.generate_request(start, length, mb_fc)
        try:
#ADNOVEA FIX begin
            # log.debug(request.hex())
            # log.debug('[send_request] send data: %s', bytes(request).hex())
            # sock.sendall(request)
            sock.sendall( bytes(request) )
            raw_msg = sock.recv(1024)
            # log.debug(raw_msg.hex())
            # log.debug('[send_request] received data: %s', bytes(raw_msg).hex())
#            if self.validate_packet(raw_msg) == 1:
#                result = 1
#                params.parse(raw_msg, start, length)
#            else:
#                log.debug(f"Querying [{start} - {end}] failed, invalid response packet.")
#ADNOVEA FIX end
            result = 1
            params.parse(raw_msg, start, length)
            del raw_msg
        finally:
            del request
        return result

    @Throttle (MIN_TIME_BETWEEN_UPDATES)
    def update (self):
        self.get_statistics()
        return

adnovea avatar Jun 14 '23 07:06 adnovea

Dear Stephane, Would you mind to add this protocol to your component in order to support the Ethernet LSE-3 (S/N 21xxxxxxxx) with a selectable "V5 Encapsulation" option. We will be grateful for this update and again a big thank you for your great work. Par avance, Merci.

adnovea avatar Jun 14 '23 18:06 adnovea

I have an zcs azzurro 80 ktl-v3 and the lse-3 Ethernet adapter, but I can't connect. can you help me, I tried your solution but it dosent work.

gmbh07 avatar Jun 20 '23 18:06 gmbh07

Is your LSE-3 S/N in 21xxxxxxxx ? Do you have a LSW-3 module and is it working ?

Python indentation is very critical and you better replace Tabs by Spaces. You can enable the HA debug mode and check the log to see if there is problem with the Solarman modified code

To check if the LSE-3 communication is working download the GModbus application (https://www.gineers.com/media/downloads/GModbus.zip) and run :

  • Enter inverter IP address and port (8899) and press Connect TCP
  • Check "Holding", set Address to "1156" (0x484) and Count to "1" to read Grid Frequency x0.01
  • Press Read registers Few seconds later you have the result in the Grid on the right. In decimal column you should read a value around 5000

If this fails, my mods cannot work for you.

adnovea avatar Jun 21 '23 08:06 adnovea

My LSE-3 S/N is in 21xxxxx, I don't have a LSW-3 module because there is no WLAN at this place. I tried the GModbus application with your settings and get something back, look at the picture.

Screenshot 2023-06-21 142624

gmbh07 avatar Jun 21 '23 15:06 gmbh07

The GModbus results are encouraging. Your communication to the inverter using the LSE-3 stick logger is successful. If you found in the HA log errors such as "Querying [0x0400 - 0x042B] failed..." it's probably a typo issue. Check the code indentation.

adnovea avatar Jun 21 '23 16:06 adnovea

I checked the code and make it all new, now it works for me, thanks for you solution. is there a way to read the modbus register? In the azzurro.yaml there are only two sensors of the strings, and the 80ktl-v3 have some more. By google I didn't found the full modbus register for zcs azzurro

gmbh07 avatar Jun 22 '23 17:06 gmbh07

Great ! I'm glad the mods works. You can read any Azzuro Modbus Register using the GModbus application:

  • Connect, select Holding, enter start address and the number of register to read (max 30 otherwise it could fail repetitively)

Your string sensors are registers are :

  • 0x0584: PV1 Voltage
  • 0x0585: PV1 Current
  • 0x0586: PV1 Power
  • 0x0587: PV2 Voltage
  • 0x0588: PV2 Current
  • 0x0589: PV2 Power

You can try to read register from 0x058A (1418) to 0x58F (1423) and check if the data pattern looks like the PV1/PV2 ones. Often, strings data are next to each other. Sorry, I cannot help you more about the Azzurro.

adnovea avatar Jun 23 '23 07:06 adnovea

Modification for LAN LSE-3 Stick Logger module using raw Modbus RTU protocol I failed to make the mods working because I have no experience in Python coding. In config_flow.py I added the following line:

 vol.Optional(CONF_LOOKUP_PROTOCOL, default=data.get(CONF_LOOKUP_PROTOCOL)): vol.In(LOOKUP_PROTOCOL),

but I cannot correctly retrieve the protocol radio-button value in the Solarman code. Could someone help ? Thanks.

image

adnovea avatar Jun 30 '23 13:06 adnovea

I have the same issue. I can't communicate in any way, all parameters remain at "Unknown". I tried to follow different configurations but I can not solve.

My configuration is:

  • Inverter "ZCS HYD-6000-HP" with firmware "V40022_2023-05-22".
  • Ethernet logger "LSE-3" with firmware "ME_0D_270A_1.09" and SN "21xxxxxxxx".

Does anyone have an idea how to fix it?

michaelcorradi avatar Aug 06 '23 19:08 michaelcorradi

folder and then apply the modifications below using

@adnovea Does this solution work?

michaelcorradi avatar Aug 06 '23 19:08 michaelcorradi

May I suggest you to follow the steps below:

  1. Find the Modbus register list (Internet search) corresponding to your Inverter (https://github.com/StephanJoubert/home_assistant_solarman/files/10187824/solarman-ZCS_HYD-6000.txt)
  2. Use GModbus utility to test some registers and validate the list.
  3. Check if the file zcs_azzurro-ktl-v3.yaml has the correct register values. If not, update the YAML file according to your Inverter registers (you can create a copy of the zcs_azzurro-ktl-v3.yaml file into a file named custom_parameters.yaml and select this file in the HA Solarman module configuration).
  4. Modify the Solarman module files parser.py and solarman.py as I mentioned above (create backup files to roll back if needed).

If you succeed in the steps above, you'll be able to retrieve data from your inverter.

N.B. If you encounter some troubles connecting with GModbus, may be your stick logger F/W need to be updated. You can email the customer service at Solarman [email protected] and they will do the update remotely.

see also https://github.com/StephanJoubert/home_assistant_solarman/discussions/148

adnovea avatar Aug 06 '23 19:08 adnovea

Yes my mods works with Deye and has been used with Azzuro inverter by gmbh07. Copy the solarman-ZCS_HYD-6000.txt above into custom_parameters.yaml, apply the modifications, then select the custom_parameters.yaml_file in HA Solarman module and full reboot HA.

adnovea avatar Aug 06 '23 19:08 adnovea

the solution from adnovea for my azzurro and LSE-3 is still working with no problems

gmbh07 avatar Aug 07 '23 05:08 gmbh07

@adnovea with your suggestion my configuration is working.

My configuration is:

  • Inverter "ZCS HYD-6000-HP" with firmware "V40022_2023-05-22".
  • Ethernet logger "LSE-3" with firmware "ME_0D_270A_1.09" and SN "21xxxxxxxx".

I'm using the configuration "zcs_azzurro-ktl-v3.yaml" is the only one that works, but I see only few values updated.

What is the best configuration I can use? Since your code works, can't the developer @StephanJoubert upload it to the official library?

michaelcorradi avatar Sep 02 '23 12:09 michaelcorradi

Hi Michael,

Glad to see that the mods is working with your config. I hope @StephanJoubert will update the code for supporting the LSE-3.

Have you tried to download the configuration file at https://github.com/StephanJoubert/home_assistant_solarman/files/10187824/solarman-ZCS_HYD-6000.txt ? Did it expose more values ?

adnovea avatar Sep 02 '23 12:09 adnovea