kbialek / deye-inverter-mqtt

Reads Deye solar inverter metrics and posts them over mqtt
Apache License 2.0
215 stars 50 forks source link

timeouts in logger #66

Closed kptkip closed 1 year ago

kptkip commented 1 year ago

I get the following info in the log-file:

2023-04-22 23:25:56,760 - DeyeDaemon - INFO - Reading registers [metrics group: deye_sg04lp3_battery, range: 0202-022e] 2023-04-22 23:26:46,807 - DeyeConnector - WARNING - Too many connection timeouts 2023-04-22 23:26:46,807 - DeyeModbus - ERROR - No response frame 2023-04-22 23:26:46,807 - DeyeModbus - ERROR - Modbus frame is too short or empty

finfin82 commented 1 year ago

more information missing... what is your refreshrate? etc. same wifi? the logger seems to be pretty laggy anyway

kptkip commented 1 year ago

The docker container runs on a NAS in the same Network but connected via LAN.

Here is my config.env: `DEYE_LOGGER_IP_ADDRESS=192.168.33.X DEYE_LOGGER_PORT=8899 DEYE_LOGGER_SERIAL_NUMBER=[Serial] DEYE_METRIC_GROUPS=deye_sg04lp3_battery DEYE_FEATURE_SET_TIME=true

MQTT_HOST=192.168.33.Y MQTT_PORT=1884 MQTT_USERNAME= MQTT_PASSWORD= MQTT_TOPIC_PREFIX=SmartHome/Deye

LOG_LEVEL=INFO DEYE_DATA_READ_INTERVAL=30 `

kbialek commented 1 year ago

hi @kptkip , please follow the instructions here https://github.com/kbialek/deye-inverter-mqtt#network-connectivity-issues

kptkip commented 1 year ago

Connection works like a charm (s. screenshot attached) Logs look like this (also attached)

Bildschirm­foto 2023-04-24 um 11 30 58 Bildschirm­foto 2023-04-24 um 11 41 18
kbialek commented 1 year ago

That's interesting. @kptkip Could you fill in this information?

kptkip commented 1 year ago

Inverter model: SUN-8K-SG04LP3-EU Logger firmware version: LSW3_15_FFFF_1.0.96 deye-inverter-mqtt version: 2023.04.1

kbialek commented 1 year ago

@edvandreas @hackepeterOli you own similar inverters. What is the logger firmware version at your devices? I suspect that @kptkip logger has incompatible firmware or is not properly configured. Maybe modbus/tcp must be enabled or something.

edvandreas commented 1 year ago

Here are the details from my working wifi stick: Logger Firmware: LSW3_15_FFFF_1.0.92R Inverter: SUN-12K-SG04LP3-EU

hackepeterOli commented 1 year ago

Here is my logger Firmware: LSW3_15_FFFF_1.0.9E you can contact the Support (in solarman app) for an update. Maybe the wifi signal is to bad?! Works a ping-t?

kptkip commented 1 year ago

According to the numbers it seems, that I have the newest FW of us three, right? Or is the last digit HEX? WiFi is brillant - no hazzle.

hackepeterOli commented 1 year ago

Last week i get a Firmware-Update from Deye…

kptkip commented 1 year ago

OK, I'll ask them, Do you have a special Contact adress or simply the info@...?

hackepeterOli commented 1 year ago

[service@deye.com.cn], you must tell the SN from the stick.

kptkip commented 1 year ago

This is the response from service@deye.com.cn:

Hello, it is not recommended to update the firmware of the collector. If you need it, I can update your inverter firmware

Update is done by deye - still the same effect here - no connect.

kbialek commented 1 year ago

@kptkip Sad to hear it. If you are in contact with deye support, you may ask them if modbus/tcp needs to be enabled at the logger Also let's check some basic stuff:

  1. Please make sure that you've set logger S/N in the config. Some ppl set inverter S/N. That will not work.
  2. Have you tried to run it with deye_sg04lp3 metric group?
gwest7 commented 1 year ago

Probably a different timeout from the above:

DeyeConnector - DEBUG - Connection timeout
Traceback (most recent call last):
  File "/opt/deye_inverter_mqtt/deye_connector.py", line 48, in send_request
    data = client_socket.recv(1024)
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/opt/deye_inverter_mqtt/./deye_docker_entrypoint.py", line 43, in <module>
    main()
  File "/opt/deye_inverter_mqtt/./deye_docker_entrypoint.py", line 39, in main
    daemon_main()
  File "/opt/deye_inverter_mqtt/deye_daemon.py", line 97, in main
    daemon.do_task()
  File "/opt/deye_inverter_mqtt/deye_daemon.py", line 66, in do_task
    regs |= self.modbus.read_registers(reg_range.first_reg_address, reg_range.last_reg_address)
  File "/opt/deye_inverter_mqtt/deye_modbus.py", line 47, in read_registers
    resp_frame = self.connector.send_request(req_frame)
  File "/opt/deye_inverter_mqtt/deye_connector.py", line 60, in send_request
    self.__log.warn("Connection error", e.message)
AttributeError: 'ConnectionResetError' object has no attribute 'message'

Inverter SUN-5K-SG01LP1-EU Logger firmware LSW3_15_FFFF_1.0.96 Image 2023.05.2 and 2023.05.3-beta-1

It runs smoothly for about an hour until the error occurs.

kbialek commented 1 year ago

@gwest7 thanks for reporting. This is a pretty stupid bug in the error handling. It's not related to the original problem reported in this issue.

kptkip commented 1 year ago

tried both - SN is from the logger - not from the inverter.

I asked deye tech support - but they don't understand, what I want from them

kbialek commented 1 year ago

@kptkip Can we check if there are response frames being sent by the logger? Could you record the network traffic at port 8899? E.g. using tcpdump or wireshark?

@palto42 I'm tagging you here, because of your network connectivity expertise.

palto42 commented 1 year ago

No other idea right now, agree that a packet capture may help.

kptkip commented 1 year ago

to be honest - I#m not familiar with tcpdump... THis is the output:

Bildschirmfoto 2023-06-05 um 22 07 40

not really valuable...

kbialek commented 1 year ago

Here is a sample from my server. It captures the traffic on port 8899 that goes in/out docker0 network interface. My inverter is now off, so there are no responses.

$ sudo tcpdump -i docker0 port 8899 
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on docker0, link-type EN10MB (Ethernet), capture size 262144 bytes
20:17:11.546308 IP 172.17.0.3.45966 > 192.168.2.90.8899: Flags [S], seq 88988022, win 64240, options [mss 1460,sackOK,TS val 894213265 ecr 0,nop,wscale 7], length 0
20:17:12.579498 IP 172.17.0.3.45966 > 192.168.2.90.8899: Flags [S], seq 88988022, win 64240, options [mss 1460,sackOK,TS val 894214299 ecr 0,nop,wscale 7], length 0
20:17:14.659721 IP 172.17.0.3.45966 > 192.168.2.90.8899: Flags [S], seq 88988022, win 64240, options [mss 1460,sackOK,TS val 894216379 ecr 0,nop,wscale 7], length 0
kptkip commented 1 year ago

so you are running this command inside the docker container on port 8899?

kbialek commented 1 year ago

No, at the host

kbialek commented 1 year ago

An example of bidirectional communication

$ sudo tcpdump -i docker0 port 8899 
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on docker0, link-type EN10MB (Ethernet), capture size 262144 bytes
06:12:11.545722 IP 172.17.0.3.37174 > 192.168.2.90.8899: Flags [S], seq 3718790533, win 64240, options [mss 1460,sackOK,TS val 929913265 ecr 0,nop,wscale 7], length 0
06:12:11.552095 IP 192.168.2.90.8899 > 172.17.0.3.37174: Flags [S.], seq 11502, ack 3718790534, win 4380, options [mss 1460], length 0
06:12:11.552243 IP 172.17.0.3.37174 > 192.168.2.90.8899: Flags [.], ack 1, win 64240, length 0
06:12:11.552413 IP 172.17.0.3.37174 > 192.168.2.90.8899: Flags [P.], seq 1:37, ack 1, win 64240, length 36
06:12:11.717820 IP 192.168.2.90.8899 > 172.17.0.3.37174: Flags [.], ack 37, win 4344, length 0
06:12:28.382301 IP 192.168.2.90.8899 > 172.17.0.3.37174: Flags [P.], seq 1:149, ack 37, win 4344, length 148
06:12:28.382613 IP 172.17.0.3.37174 > 192.168.2.90.8899: Flags [.], ack 149, win 64092, length 0
06:12:28.383057 IP 172.17.0.3.37174 > 192.168.2.90.8899: Flags [F.], seq 37, ack 149, win 64092, length 0
06:12:28.385099 IP 192.168.2.90.8899 > 172.17.0.3.37174: Flags [.], ack 38, win 4343, length 0
06:12:28.385811 IP 192.168.2.90.8899 > 172.17.0.3.37174: Flags [F.], seq 149, ack 38, win 4343, length 0
06:12:28.385906 IP 172.17.0.3.37174 > 192.168.2.90.8899: Flags [.], ack 150, win 64092, length 0
06:17:11.545843 IP 172.17.0.3.37324 > 192.168.2.90.8899: Flags [S], seq 2868053599, win 64240, options [mss 1460,sackOK,TS val 930213265 ecr 0,nop,wscale 7], length 0
06:17:11.549402 IP 192.168.2.90.8899 > 172.17.0.3.37324: Flags [S.], seq 14190, ack 2868053600, win 4380, options [mss 1460], length 0
06:17:11.549577 IP 172.17.0.3.37324 > 192.168.2.90.8899: Flags [.], ack 1, win 64240, length 0
06:17:11.549730 IP 172.17.0.3.37324 > 192.168.2.90.8899: Flags [P.], seq 1:37, ack 1, win 64240, length 36
06:17:11.640422 IP 192.168.2.90.8899 > 172.17.0.3.37324: Flags [.], ack 37, win 4344, length 0
06:17:11.783443 IP 192.168.2.90.8899 > 172.17.0.3.37324: Flags [P.], seq 1:149, ack 37, win 4344, length 148
06:17:11.783597 IP 172.17.0.3.37324 > 192.168.2.90.8899: Flags [.], ack 149, win 64092, length 0
06:17:11.784566 IP 172.17.0.3.37324 > 192.168.2.90.8899: Flags [F.], seq 37, ack 149, win 64092, length 0
06:17:11.786367 IP 192.168.2.90.8899 > 172.17.0.3.37324: Flags [.], ack 38, win 4343, length 0
06:17:11.787127 IP 192.168.2.90.8899 > 172.17.0.3.37324: Flags [F.], seq 149, ack 38, win 4343, length 0
06:17:11.787286 IP 172.17.0.3.37324 > 192.168.2.90.8899: Flags [.], ack 150, win 64092, length 0
kptkip commented 1 year ago

Now, it works (don't ask me why).

Do I need two docker instances (with different metric groups) if I want inverter data and battery data?

kbialek commented 1 year ago

Now, it works (don't ask me why).

:+1:

Do I need two docker instances (with different metric groups) if I want inverter data and battery data?

No, just list the metric groups you want. This is documented https://github.com/kbialek/deye-inverter-mqtt#configuration

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 14 days since being marked as stale.