bohdan-s / SunGather

GNU General Public License v3.0
148 stars 61 forks source link

WARNING No data returned for read, 4999:1 - DEBUG Modbus Error: [Connection] HTTP Request failed: #95

Closed AFI4711 closed 1 year ago

AFI4711 commented 1 year ago

Hi, the code worked perfectly until 2022-12-13 (without changing anything), then I got this messages:

...
2022-12-13 10:47:43 INFO     MQTT: Published
2022-12-13 10:47:43 INFO     Next scrape in 296 secs
2022-12-13 10:52:44 INFO     Inverter: Successfully scraped in 3.696175 secs
2022-12-13 10:52:44 INFO     MQTT: Published
2022-12-13 10:52:44 INFO     Next scrape in 296 secs
2022-12-13 10:57:50 WARNING  No data returned for read, 5000:100
No data returned for read, 5000:100
2022-12-13 10:57:53 WARNING  No data returned for read, 6099:100
No data returned for read, 6099:100
2022-12-13 10:57:57 WARNING  No data returned for read, 6199:100
No data returned for read, 6199:100
2022-12-13 10:58:00 WARNING  No data returned for read, 6299:100
No data returned for read, 6299:100
2022-12-13 10:58:03 WARNING  No data returned for read, 6399:100
No data returned for read, 6399:100
2022-12-13 10:58:06 WARNING  No data returned for read, 6499:100
No data returned for read, 6499:100
2022-12-13 10:58:09 WARNING  No data returned for read, 6599:100
No data returned for read, 6599:100
2022-12-13 10:58:12 WARNING  No data returned for read, 6699:100
No data returned for read, 6699:100
2022-12-13 10:58:15 WARNING  No data returned for read, 12999:125
No data returned for read, 12999:125
2022-12-13 10:58:18 WARNING  No data returned for hold, 4999:10
No data returned for hold, 4999:10
2022-12-13 10:58:18 INFO     Disconnecting: SungrowModbusWebClient_0.3.2(192.168.0.135:8082)
2022-12-13 10:58:18 INFO     Disconnecting: None
2022-12-13 10:58:18 WARNING  Data collection failed, skipped exporting data. Retying in 300 secs
Data collection failed, skipped exporting data. Retying in 300 secs
...

After several test which all failed I have installed the newest version and running in DEBUG mode:

2022-12-15 08:51:28 INFO     Starting SunGather 0.3.9
2022-12-15 08:51:28 INFO     Loaded config: config.yaml
2022-12-15 08:51:29 INFO     Loaded registers: registers-sungrow.yaml
2022-12-15 08:51:29 INFO     Registers file version: 0.2.1
2022-12-15 08:51:29 INFO     Logging to console set to: DEBUG
2022-12-15 08:51:29 INFO     Logging to file set to: DEBUG
2022-12-15 08:51:29 DEBUG    Inverter Config Loaded: {'host': '192.168.0.135', 'port': 502, 'timeout': 300, 'retries': 5, 'slave': 1, 'scan_interval': 300, 'connection': 'http', 'model': None, 'smart_meter': False, 'use_local_time': False, 'log_console': 'DEBUG', 'log_file': 'DEBUG', 'level': 0}
2022-12-15 08:51:29 DEBUG    Checking Modbus Connection
2022-12-15 08:51:29 INFO     Modbus client is not connected, attempting to reconnect
2022-12-15 08:51:29 INFO     Connection: SungrowModbusWebClient_0.3.2(192.168.0.135:8082)
2022-12-15 08:51:29 DEBUG    Connection to websocket server established: ws://192.168.0.135:8082/ws/home/overview
2022-12-15 08:51:29 DEBUG    {'result_code': 1, 'result_msg': 'success', 'result_data': {'service': 'connect', 'token': '60581efb-1a33-4f11-99e8-dd6e4c3ab58b', 'uid': 1, 'tips_disable': 0}}
2022-12-15 08:51:29 INFO     Token Retrieved: 60581efb-1a33-4f11-99e8-dd6e4c3ab58b
2022-12-15 08:51:29 DEBUG    Requesting Device Information
2022-12-15 08:51:29 DEBUG    {'result_code': 1, 'result_msg': 'success', 'result_data': {'service': 'devicelist', 'list': [{'id': 1, 'dev_id': 1, 'dev_code': 3585, 'dev_type': 35, 'dev_procotol': 2, 'dev_sn': 'A2162102870', 'dev_name': 'SH6.0RT(COM1-001)', 'dev_model': 'SH6.0RT', 'port_name': 'COM1', 'phys_addr': '1', 'logc_addr': '1', 'link_status': 1, 'init_status': 1, 'dev_special': '0', 'list': []}], 'count': 1}}
2022-12-15 08:51:29 DEBUG    Retrieved: dev_type = 35, dev_code = 3585
2022-12-15 08:51:32 DEBUG    load_registers: read, 4999:1
2022-12-15 08:51:32 DEBUG    Current transaction state - IDLE
2022-12-15 08:51:32 DEBUG    Running transaction 1
2022-12-15 08:51:32 DEBUG    SEND: 0x0 0x1 0x0 0x0 0x0 0x6 0x1 0x4 0x13 0x87 0x0 0x1
2022-12-15 08:51:32 DEBUG    New Transaction state 'SENDING'
2022-12-15 08:51:32 DEBUG    param_type: 0, start_address: 5000, count: 1, dev_id: 1
2022-12-15 08:51:32 DEBUG    Calling: http://192.168.0.135/device/getParam?dev_id=1&dev_type=35&dev_code=3585&type=3&param_addr=5000&param_num=1&param_type=0&token=60581efb-1a33-4f11-99e8-dd6e4c3ab58b&lang=en_us&time123456=1671090692
2022-12-15 08:51:32 DEBUG    Starting new HTTP connection (1): 192.168.0.135:80
2022-12-15 08:51:32 WARNING  No data returned for read, 4999:1
No data returned for read, 4999:1
2022-12-15 08:51:32 DEBUG    Modbus Error: [Connection] HTTP Request failed: HTTPConnectionPool(host='192.168.0.135', port=80): Max retries exceeded with url: /device/getParam?dev_id=1&dev_type=35&dev_code=3585&type=3&param_addr=5000&param_num=1&param_type=0&token=60581efb-1a33-4f11-99e8-dd6e4c3ab58b&lang=en_us&time123456=1671090692 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd8e0ce1cd0>: Failed to establish a new connection: [Errno 111] Connection refused'))')

See logfile attached Can you help me? May be a problem with port 80?

Nmap scan report for espressif (192.168.0.135)
Host is up (0.0047s latency).
Not shown: 998 closed ports
PORT     STATE SERVICE
443/tcp  open  https
8082/tcp open  blackice-alerts

LOG-1.txt

michbeck100 commented 1 year ago

Maybe a firmware update on your WiNet-S? Are you using a wired connection?

AFI4711 commented 1 year ago

I use a wired connection (from a Fritz Repeater)

michbeck100 commented 1 year ago

So you are using the wired connection with the WiNet-S? I don't have this hardware. I'm using the direct wired connection of the inverter, because my WiNet stick doesn't have a wired connection. And for this I use connection: modbus. Maybe you can use this for your setup, too?

AFI4711 commented 1 year ago

"Connection modbus" does not work:

2022-12-21 10:26:32 INFO     Starting SunGather 0.3.9
2022-12-21 10:26:32 INFO     Loaded config: config.yaml
2022-12-21 10:26:36 INFO     Loaded registers: registers-sungrow.yaml
2022-12-21 10:26:36 INFO     Registers file version: 0.2.1
2022-12-21 10:26:36 INFO     Logging to console set to: DEBUG
2022-12-21 10:26:36 INFO     Logging to file set to: DEBUG
2022-12-21 10:26:36 DEBUG    Inverter Config Loaded: {'host': '192.168.0.135', 'port': 502, 'timeout': 300, 'retries': 5, 'slave': 1, 'scan_interval': 300, 'connection': 'modbus', 'model': None, 'smart_meter': False, 'use_local_time': False, 'log_console': 'DEBUG', 'log_file': 'DEBUG', 'level': 0}
2022-12-21 10:26:36 DEBUG    Checking Modbus Connection
2022-12-21 10:26:36 INFO     Modbus client is not connected, attempting to reconnect
2022-12-21 10:26:36 INFO     Connection: ModbusTcpClient(192.168.0.135:502)
2022-12-21 10:26:36 ERROR    Connection to (192.168.0.135, 502) failed: [Errno 111] Connection refused
Connection to (192.168.0.135, 502) failed: [Errno 111] Connection refused
2022-12-21 10:26:39 DEBUG    load_registers: read, 4999:1
2022-12-21 10:26:39 ERROR    Connection to (192.168.0.135, 502) failed: [Errno 111] Connection refused
Connection to (192.168.0.135, 502) failed: [Errno 111] Connection refused

I think there is a problem with the ports: the first connection with port 8082 (connection http) is successful, connection with port 80 or port 502 fail. But what could be the reason? Do you have access to port 80 via browser?

AFI4711 commented 1 year ago

The problem is solved: After re-initializing the Repeater nmap shows additionally port 80!:

Nmap scan report for espressif (192.168.0.135)
Host is up (0.014s latency).
Not shown: 997 closed ports
PORT     STATE SERVICE
80/tcp   open  http
443/tcp  open  https
8082/tcp open  blackice-alerts
AFI4711 commented 1 year ago

Thanks for the help! WiNet-S now could be reached via browser (good test in case of connecting problems)