davidrapan / ha-solarman

⚡ Solarman Stick Logger integration for 🏠 Home Assistant
MIT License
114 stars 25 forks source link

Support for Ethernet Logger LSE-3 #21

Closed oetiker closed 2 months ago

oetiker commented 4 months ago

I am using a Sofar Hybrid Box (SOFAR HYD 20KTL-3PH) with a LSE-3 logger and get no responses when trying to use the thing with the ha-solarman code. Neither with the code here nor with the original from StephanJoubert.

Reading through @StephanJouberts repo I found this issue which seems to indicate that the LSE-3 device needs different encapsulation ...

Anyone working on this ? Or is there some secret to get my setup to communicate with ha-solarman which I just neglected until now?

davidrapan commented 4 months ago

Hi @oetiker!

I can try to implement suggested changes but as I don't have the device it will be like shooting in the dark.

Are you willing to try it afterwards and help solve potential bugs and so?

Have fun!

oetiker commented 4 months ago

Hi @oetiker!

I can try to implement suggested changes but as I don't have the device it will be like shooting in the dark.

Are you willing to try it afterwards and help solve potential bugs and so?

Have fun!

Hi David

yes sure, I would be totally willing to test and help out :)

cheers tobi

davidrapan commented 4 months ago

Ok, I'll let you know whenever there is anything to try out.

But as the code of those suggested changes is apart from the pysolarmanv5 it won't be as straight forward implementation as I initially thought so I can't make promises it will work as great as when it goes through the mentioned python library. But I'll do what I can to make it work. 😉

Have fun!

davidrapan commented 3 months ago

Does the Ethernet Stick Logger also responds to the discovery packet? Probably not, right?

Vollpanto commented 3 months ago

I have both sticks. The Ethernet Adapter also response to the discovery packet.

Vollpanto commented 3 months ago

Here is a log: 2024-08-03 21:55:14.025 WARNING (MainThread) [custom_components.solarman.api] Querying (1028 - 1067) failed. #0 [TimeoutError] 2024-08-03 21:55:15.026 DEBUG (MainThread) [custom_components.solarman.api] Querying attempts left: 4 2024-08-03 21:55:15.026 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: False, cancelled: False. 2024-08-03 21:55:15.028 DEBUG (MainThread) [custom_components.solarman.api] [2109340331] Successful reconnect 2024-08-03 21:55:15.028 DEBUG (MainThread) [custom_components.solarman.api] [2109340331] SENT: a5 17 00 10 45 b2 00 ab fa b9 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 28 05 25 59 15 2024-08-03 21:55:15.563 DEBUG (MainThread) [custom_components.solarman.api] [2109340331] V5_SEQ_NO_MISMATCH: a5 17 00 10 45 53 01 03 50 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2e 00 00 00 2a 00 00 00 00 00 00 00 00 00 00 00 2b 00 00 00 00 00 00 00 00 00 00 05 23 00 05 e4 ef 00 08 87 bc 01 97 2024-08-03 21:55:25.020 DEBUG (MainThread) [custom_components.solarman.coordinator] Finished fetching Inverter data in 30.001 seconds (success: False) 2024-08-03 21:55:25.020 DEBUG (MainThread) [custom_components.solarman.coordinator] async_shutdown 2024-08-03 21:55:25.020 INFO (MainThread) [custom_components.solarman.api] Disconnecting from 192.168.1.195:8899

lcavalli commented 3 months ago

Indeed it seems so. I currently use an integration based on pure modbus protocol, but I'm testing your integration and the config flow correctly presents the logger IP address, port and also serial number.

davidrapan commented 3 months ago

Okay, thanks guys. I'm currently investigating possible approaches to the implementation.

davidrapan commented 3 months ago

Guys, can anyone test feat: Experimental testing of ethernet stick and show me the debug log? Thanks!

For enabling this there is a new configuration toggle (Solarman protocol passthrough mode) which must be in on position.

lcavalli commented 3 months ago

@davidrapan, It is not lack of interest, I'm currently not at home. I will be able to test it when I will come back! Thank you for spending time on this issue.

davidrapan commented 3 months ago

And then for anyone who is going to try it there is this row in the api.py file (on line 34):

modbus_frame = v5_frame[10:]

Try to tweak number 10. It says how much it should cut from the response from the start and treat the rest as an modbus frame. So try for example maybe also 20 and 2...

But it really depends on what the code is gonna do.

oetiker commented 3 months ago

@davidrapan I will be glad to test, but I have not read the code to deeply and I am involved in way to many projects atm ...

davidrapan commented 3 months ago

Hi @oetiker,

how do I get the current version of the code ? can I just update ?

You would have to manually download the code in zip and replace it in the HA as this changes are not part of any release.

do I just toggle the new config setting in the config screen ?

Yes.

lcavalli commented 3 months ago

how do I get the current version of the code ? can I just update ?

You would have to manually download the code in zip and replace it in the HA as this changes are not part of any release.

You can also select master in version combo box in HACS. Download again if already installed.

davidrapan commented 3 months ago

You can also select master in version combo box in HACS. Download again if already installed.

I know that you "can" do that but it won't switch to it. It reselects automatically to the release version and thus it never worked for me.

And I think it was also stated that they gonna remove that feature all together though.

davidrapan commented 3 months ago

It's now part of the 24.08.08 pre-release.

davidrapan commented 3 months ago

I was hoping someone would at least give it a try before the planned 08/14/24 release, but I guess I'm out of luck, huh? 😆

lcavalli commented 3 months ago

@davidrapan I'm not at home! Will try as soon as I will be back for sure.

davidrapan commented 3 months ago

@lcavalli, I know you said that! 😆 I did not mean to pressure anyone with that post! 😆

proggaras commented 3 months ago

Great work. Will this also work, when I connect directly to my Deye inverter over RS485?

Detail: HomeAssistant connects over a "Waveshare RS485 to Ethernet Converter" to my Deye SUN-25K-SG01HP3-EU-AM deyedirect

davidrapan commented 3 months ago

Hi @proggaras, this is what https://github.com/kellerza/sunsynk or modbus tcp is for, I guess. 😉

This integration specializes on using Solarman protocol only.

oetiker commented 3 months ago

@davidrapan yey, I finally got to test ... unfortunately it does not work yet,. but there is debug data. this is with the released version .17

2024-08-19 09:15:48.279 DEBUG (MainThread) [custom_components.solarman] async_setup_entry({'data': {'name': 'hwr', 'inverter_discovery': True, 'inverter_host': '192.168.0.19', 'inverter_serial': 2108634189, 'inverter_port': 8899, 'inverter_mb_slave_id': 1, 'inverter_passthrough': True, 'lookup_file': 'sofar_g3hyd.yaml', 'battery_nominal_voltage': 48, 'battery_life_cycle_rating': 6000}, 'disabled_by': None, 'domain': 'solarman', 'entry_id': '01J5MQQ8GDVHPMDAB1A3PFHKXQ', 'minor_version': 1, 'options': {'name': 'hwr', 'inverter_discovery': False, 'inverter_host': '192.168.0.19', 'inverter_serial': 2108634189, 'inverter_port': 8899, 'inverter_mb_slave_id': 1, 'inverter_passthrough': True, 'lookup_file': 'sofar_g3hyd.yaml', 'battery_nominal_voltage': 48, 'battery_life_cycle_rating': 6000}, 'pref_disable_new_entities': False, 'pref_disable_polling': False, 'source': 'user', 'title': 'hwr', 'unique_id': None, 'version': 1})
2024-08-19 09:15:48.406 DEBUG (MainThread) [custom_components.solarman.parser] Defaults for update_interval: 10, code: 3, min_span: 25, digits: 6
2024-08-19 09:15:48.406 DEBUG (MainThread) [custom_components.solarman.api] {'identifiers': {('solarman', 2108634189)}, 'name': 'hwr', 'manufacturer': 'Sofar', 'model': 'G3HYD', 'serial_number': 2108634189}
2024-08-19 09:15:48.406 DEBUG (MainThread) [custom_components.solarman] async_setup: coordinator.async_config_entry_first_refresh
2024-08-19 09:15:48.406 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] Scheduling 8 query requests. #0
2024-08-19 09:15:48.406 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] Querying (1028 - 1067) ...
2024-08-19 09:15:48.406 INFO (MainThread) [custom_components.solarman.api] [2108634189] Connecting to 192.168.0.19:8899
2024-08-19 09:15:48.410 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] SENT: a5 17 00 10 45 ae 00 4d 34 af 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 28 05 25 27 15
2024-08-19 09:15:48.896 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] RECD: a5 17 00 10 45 53 01 03 50 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 27 00 00 00 00 00 00 00 00 00 00 00 25 00 00 00 00 00 00 00 00 00 00 02 2b 00 03 d9 6b 00 03 f2 f5 01 a9
2024-08-19 09:15:48.897 WARNING (MainThread) [custom_components.solarman.api] [2108634189] Querying (1028 - 1067) failed. #0 [CRCError: CRC validation failed.]
2024-08-19 09:15:49.098 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] Querying attempts left: 4
2024-08-19 09:15:49.103 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] Successful reconnect
2024-08-19 09:15:49.103 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] SENT: a5 17 00 10 45 af 00 4d 34 af 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 28 05 25 28 15
2024-08-19 09:15:49.606 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] RECD: a5 17 00 10 45 53 01 03 50 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 27 00 00 00 00 00 00 00 00 00 00 00 25 00 00 00 00 00 00 00 00 00 00 02 2b 00 03 d9 6b 00 03 f2 f5 01 a9
2024-08-19 09:15:49.607 WARNING (MainThread) [custom_components.solarman.api] [2108634189] Querying (1028 - 1067) failed. #0 [CRCError: CRC validation failed.]
2024-08-19 09:15:50.008 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] Querying attempts left: 3
2024-08-19 09:15:50.012 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] Successful reconnect
2024-08-19 09:15:50.012 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] SENT: a5 17 00 10 45 b0 00 4d 34 af 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 28 05 25 29 15
2024-08-19 09:15:50.522 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] RECD: a5 17 00 10 45 53 01 03 50 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 27 00 00 00 00 00 00 00 00 00 00 00 25 00 00 00 00 00 00 00 00 00 00 02 2b 00 03 d9 6b 00 03 f2 f5 01 a9
2024-08-19 09:15:50.523 WARNING (MainThread) [custom_components.solarman.api] [2108634189] Querying (1028 - 1067) failed. #0 [CRCError: CRC validation failed.]
2024-08-19 09:15:51.125 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] Querying attempts left: 2
2024-08-19 09:15:51.128 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] Successful reconnect
2024-08-19 09:15:51.128 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] SENT: a5 17 00 10 45 b1 00 4d 34 af 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 28 05 25 2a 15
2024-08-19 09:15:51.635 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] RECD: a5 17 00 10 45 53 01 03 50 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 27 00 00 00 00 00 00 00 00 00 00 00 26 00 00 00 00 00 00 00 00 00 00 02 2b 00 03 d9 6b 00 03 f2 f5 01 a9
2024-08-19 09:15:51.636 WARNING (MainThread) [custom_components.solarman.api] [2108634189] Querying (1028 - 1067) failed. #0 [CRCError: CRC validation failed.]
2024-08-19 09:15:52.438 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] Querying attempts left: 1
2024-08-19 09:15:52.442 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] Successful reconnect
2024-08-19 09:15:52.442 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] SENT: a5 17 00 10 45 b2 00 4d 34 af 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 28 05 25 2b 15
2024-08-19 09:15:52.914 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] RECD: a5 17 00 10 45 53 01 03 50 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 00 00 27 00 00 00 00 00 00 00 00 00 00 00 26 00 00 00 00 00 00 00 00 00 00 02 2b 00 03 d9 6b 00 03 f2 f5 01 a9
2024-08-19 09:15:52.914 WARNING (MainThread) [custom_components.solarman.api] [2108634189] Querying (1028 - 1067) failed. #0 [CRCError: CRC validation failed.]
2024-08-19 09:15:53.916 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] Querying attempts left: 0, aborting.
2024-08-19 09:15:53.916 DEBUG (MainThread) [custom_components.solarman.api] [2108634189] Request failed. [Previous State: Disconnected (-1)]
2024-08-19 09:15:53.916 INFO (MainThread) [custom_components.solarman.api] [2108634189] Disconnecting from 192.168.0.19:8899
2024-08-19 09:15:53.917 DEBUG (MainThread) [custom_components.solarman.coordinator] Finished fetching hwr data in 5.511 seconds (success: False)
2024-08-19 09:15:53.917 DEBUG (MainThread) [custom_components.solarman.coordinator] async_shutdown
2024-08-19 09:15:53.918 INFO (MainThread) [custom_components.solarman.api] [2108634189] Disconnecting from 192.168.0.19:8899
davidrapan commented 3 months ago

Hey @githubDante, can you take a look at our experiment?

Edit: Nevermind I maybe got it, will see... 😆

lcavalli commented 3 months ago

Back at home. I tried the new feature and as already reported it doesn't still work. The reported error is the same as already logged above (crc error). To further analyse the issue I installed tcpdump on Home Assistant Operating System and dumped a session from a different integration based on bare modbus (I would like to replace due to some inconsistencies in reported values). This is the starting working request to read the serial number on ZCS Azzurro inverter (addess 0x0445, length 7). Request:

image

Reply (obfuscated):

image

CRC seems not to be used as part of the protocol, since it is modbus TCP, not RTU.

davidrapan commented 3 months ago

Oh I didn't know that tcp does not have the crc, my bad.

But i mean the response is there so if we just cut it like this [6:] and add crc that it has to work.... 😆

Edit: I just tried it and it did worked! 😆

davidrapan commented 3 months ago

Guys try it from this commits: feat: Experimental testing of ethernet stick + fix: Experimental testing of ethernet stick typo

githubDante commented 3 months ago

Hi,

@lcavalli do you have the pcap file from tcpdump ?

@davidrapan if the ethernet logger operates in MODBUS TCP mode you can use a shortcut by passing a prepared request directly to the _send_receive_v5_frame function and await the result from it. The following is a simple example

from umodbus.client.tcp import parse_response_adu, read_holding_registers, read_input_registers, read_discrete_inputs, etc.   # you can map these to function codes should you wish 
...
tcp_req = read_holding_registers(<slave id>, <starting address>, <quantity>)  # choose the appropriate function 
# feed the tcp_req directly to _send_receive_v5_frame and process the result as follows ...
resp_adu = await super()._send_receive_v5_frame(tcp_req)
inverter_data = parse_response_adu(resp_adu, tcp_req)
# no other intervention should be needed the data can be returned directly 
>>> req = read_holding_registers(1, 0x0445, 7)
>>> req
b',\x9a\x00\x00\x00\x06\x01\x03\x04E\x00\x07'
>>> req.hex()
'2c9a00000006010304450007'
>>> resp_b = bytes.fromhex('2c 9a 00 00 00 11 01 03 0e 5a 4d 32 45 53 30 30 30 30 30 30 30 30 30')
>>> resp = parse_response_adu(resp_b, req)
>>> resp
[23117, 12869, 21296, 12336, 12336, 12336, 12336]
>>> b''.join([struct.pack('>H', x) for x in resp])
b'ZM2ES000000000'
lcavalli commented 3 months ago

It works now! Experienced a short disconnection but sensors are now available. Thanks!

@githubDante yes, I have a pcap dump but it contains sensitive data, I suppose, like the serial number of the inverter used for solarman cloud registration.

davidrapan commented 3 months ago

It works now! Experienced a short disconnection but sensors are now available. Thanks!

😆 😆 😆

I'm literally laughing my ass off! 😆 But I'm glad it worked!

Can you enable debug and do some logging for me?

@githubDante Thanks for your fast reply! You da best! But turns out umodbus.client.tcp is not really needed and pysolarmanv5 (+ really small tweak) is capable of reading the data. 🎉 But I'll try it both ways, though.

davidrapan commented 3 months ago

I wonder if is the start of the reply a5 17 00 10 45 the same every single time? So it can be used to detect it's the ethernet stick logger, hm.

davidrapan commented 3 months ago

Great! Can you also test it with changes made here?: feat: Add some constraints for ethernet sticks

Can you guys believe it that adding support for those sticks only needed around 16 rows of code? 😆

PV-Joe commented 3 months ago

I was watching the development and think you are doing a great job here. Glad to see that Solarman is getting some love and is being continued. ☀️

lcavalli commented 3 months ago

Great! Can you also test it with changes made here?: feat: Add some constraints for ethernet sticks

Can you guys believe it that adding support for those sticks only needed around 16 rows of code? 😆

I would like to test your last commit but after a series of periodic disconnection this night the inverted become offline and I cannot connect anymore.

image

The inverter is offline also on the official app.

Is is possible that the query rate was too high? Will try to reset the unit.

davidrapan commented 3 months ago

It should not be possible to shut it down like that though. But you can increase it in the definition profile with update_interval.

Please could you try to catch in debug log why it disconnects periodically? 😉

oetiker commented 3 months ago

I copied with the api.py from main and yey it does work ... it does seem that not all queries succeed though ... I guess some timeouts are not yet as they should be

davidrapan commented 3 months ago

Well for me to even have a chance to do something about it I'm gonna need to see the debug logs, haha. 😆

And you tried it also with the last commit?

oetiker commented 3 months ago

Well for me to even have a chance to do something about it I'm gonna need to see the debug logs, haha. 😆

And you tried it also with the last commit?

yes with the version from 9h ago ... will investigate the timeouts

davidrapan commented 3 months ago

What profiles are you using guys anyway?

lcavalli commented 3 months ago

It should not be possible to shut it down like that though. But you can increase it in the definition profile with update_interval.

Please could you try to catch in debug log why it disconnects periodically? 😉

Inverter still offline with the integration disabled. As soon as it will be online again I will try to investigate the disconnection issue. Good to know that the rate can be configured in definition file.

oetiker commented 3 months ago

sofar_tlx-g3.yaml (wr) and sofar_g3hyd.yaml (hwr)

the connectivity problems seem to have 'system' ... image

davidrapan commented 3 months ago

Enable debug logging and try to catch that disconnect. 😉

Anyway the wireless version can be bombarded even every second and it works great and I would thought that ethernet one should be even better in that regard but who knows maybe not.

lcavalli commented 3 months ago

What profiles are you using guys anyway?

I'm using this profile, although my inverter is single phase only: zcs_azzurro-hyd-zss-hp.yaml

BTW, the logger is still unable to communicate with the inverter (LAN led is on, COM led is off, SER led is blinking@1hz). Now I disconnected the logger from the inverter, will reconnect tomorrow.

davidrapan commented 3 months ago

BTW, the logger is still unable to communicate with the inverter (LAN led is on, COM led is off, SER led is blinking@1hz). Now I disconnected the logger from the inverter, will reconnect tomorrow.

I really hope everything will be alright in there! Even to say I find it hard to believe that simple data requesting (more so when the device was talking with us successfully) could somehow break anything... Well that being said I still hope it really did not, huh!

What 'bout you @oetiker, everything good?

davidrapan commented 3 months ago

Can you guys also try this version?: feat: Ethernet Logger through umodbus.client.tcp

Link to api.py: https://github.com/davidrapan/ha-solarman/blob/dev/custom_components/solarman/api.py

It's according @githubDante suggestions.

Don't forget to also produce debug log and post it here so we can look. 😉

Edit: Also added little upgrade: feat: Add register writing for Ethernet Logger

lcavalli commented 3 months ago

Hi, inverter is back online. I'm checking the disconnection problem, this is the log portion of interest:

2024-08-21 15:32:03.715 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying (1028 - 1067) ...
2024-08-21 15:32:03.715 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] SENT: a5 17 00 10 45 f6 00 fa fc 73 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 28 05 25 a8 15
2024-08-21 15:32:04.299 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] RECD: a5 17 00 10 45 53 01 03 50 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 3b 00 00 00 3b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 da 00 04 bb 92 00 08 78 23 01 d1
2024-08-21 15:32:04.300 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying succeeded.
2024-08-21 15:32:04.300 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying (1156 - 1165) ...
2024-08-21 15:32:04.300 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] SENT: a5 17 00 10 45 f7 00 fa fc 73 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 84 00 0a 84 d4 39 15
2024-08-21 15:32:04.834 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] RECD: a5 17 00 10 45 17 01 03 14 13 89 01 83 00 00 00 00 00 86 00 00 00 00 00 00 00 00 09 03
2024-08-21 15:32:04.834 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying succeeded.
2024-08-21 15:32:04.834 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying (1199 - 1199) ...
2024-08-21 15:32:04.834 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] SENT: a5 17 00 10 45 f8 00 fa fc 73 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 af 00 01 b5 1b d4 15
2024-08-21 15:32:05.349 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] RECD: a5 17 00 10 45 05 01 03 02 00 fc
2024-08-21 15:32:05.349 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying succeeded.
2024-08-21 15:32:05.350 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying (1284 - 1284) ...
2024-08-21 15:32:05.350 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] SENT: a5 17 00 10 45 f9 00 fa fc 73 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 05 04 00 01 c5 07 27 15
2024-08-21 15:32:05.893 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] RECD: a5 17 00 10 45 05 01 03 02 00 03
2024-08-21 15:32:05.894 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying succeeded.
2024-08-21 15:32:05.894 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying (1412 - 1417) ...
2024-08-21 15:32:05.894 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] SENT: a5 17 00 10 45 fa 00 fa fc 73 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 05 84 00 06 85 2d 93 15
2024-08-21 15:32:06.529 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] RECD: a5 17 00 10 45 0f 01 03 0c 09 4e 03 53 00 ca 09 cb 03 11 00 c5
2024-08-21 15:32:06.530 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying succeeded.
2024-08-21 15:32:06.530 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying (1540 - 1546) ...
2024-08-21 15:32:06.530 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] SENT: a5 17 00 10 45 fb 00 fa fc 73 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 06 04 00 07 45 41 ea 15
2024-08-21 15:32:07.054 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] RECD: a5 17 00 10 45 11 01 03 0e 02 21 00 00 00 00 00 25 00 64 00 63 00 00
2024-08-21 15:32:07.055 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying succeeded.
2024-08-21 15:32:07.055 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying (1667 - 1691) ...
2024-08-21 15:32:07.055 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] SENT: a5 17 00 10 45 fc 00 fa fc 73 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 06 83 00 19 75 60 cb 15
2024-08-21 15:32:07.619 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] RECD: a5 17 00 10 45 35 01 03 32 ff ff 00 00 0a 76 00 01 1a 81 00 00 07 d2 00 01 18 94 00 00 01 20 00 00 a3 8a 00 00 01 bc 00 00 92 7e 00 00 01 c0 00 00 2e f1 00 00 00 3c 00 00 2a 8a
2024-08-21 15:32:07.620 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying succeeded.
2024-08-21 15:32:07.620 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Returning 47 new values to the Coordinator. [Previous State: Connected (1)]
2024-08-21 15:32:07.621 DEBUG (MainThread) [custom_components.solarman.coordinator] Finished fetching ZCS data in 3.907 seconds (success: True)
2024-08-21 15:32:12.713 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Scheduling 0 query requests. #245
2024-08-21 15:32:12.713 DEBUG (MainThread) [custom_components.solarman.coordinator] Finished fetching ZCS data in 0.001 seconds (success: True)
2024-08-21 15:32:17.714 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Scheduling 0 query requests. #250
2024-08-21 15:32:17.714 DEBUG (MainThread) [custom_components.solarman.coordinator] Finished fetching ZCS data in 0.001 seconds (success: True)
2024-08-21 15:32:22.713 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Scheduling 0 query requests. #255
2024-08-21 15:32:22.714 DEBUG (MainThread) [custom_components.solarman.coordinator] Finished fetching ZCS data in 0.001 seconds (success: True)
2024-08-21 15:32:27.714 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Scheduling 7 query requests. #260
2024-08-21 15:32:27.714 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying (1028 - 1067) ...
2024-08-21 15:32:27.714 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] SENT: a5 17 00 10 45 fd 00 fa fc 73 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 28 05 25 af 15
2024-08-21 15:32:32.696 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] RECD: a5 17 00 10 45 53 01 03 50 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 3b 00 00 00 3b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 db 00 04 bb 93 00 08 78 24 01 d1
2024-08-21 15:32:32.697 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying succeeded.
2024-08-21 15:32:32.697 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying (1156 - 1165) ...
2024-08-21 15:32:32.697 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] SENT: a5 17 00 10 45 fe 00 fa fc 73 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 84 00 0a 84 d4 40 15
2024-08-21 15:32:33.815 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] RECD: a5 17 00 10 45 03 00 fa 02
2024-08-21 15:32:33.815 WARNING (MainThread) [custom_components.solarman.api] [xxxx] Querying (1156 - 1165) failed. #260 [IllegalDataAddressError:  The data address received in the request is not an allowable address for
    the server.
    ]
2024-08-21 15:32:34.016 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying attempts left: 4
2024-08-21 15:32:34.016 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] SENT: a5 17 00 10 45 ff 00 fa fc 73 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 84 00 0a 84 d4 41 15
2024-08-21 15:32:35.137 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] RECD: a5 17 00 10 45 03 00 fa 02
2024-08-21 15:32:35.138 WARNING (MainThread) [custom_components.solarman.api] [xxxx] Querying (1156 - 1165) failed. #260 [IllegalDataAddressError:  The data address received in the request is not an allowable address for
    the server.
    ]
2024-08-21 15:32:35.540 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying attempts left: 3
2024-08-21 15:32:35.540 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] SENT: a5 17 00 10 45 00 00 fa fc 73 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 84 00 0a 84 d4 42 15
2024-08-21 15:32:36.661 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] RECD: a5 17 00 10 45 03 00 fa 02
2024-08-21 15:32:36.661 WARNING (MainThread) [custom_components.solarman.api] [xxxx] Querying (1156 - 1165) failed. #260 [IllegalDataAddressError:  The data address received in the request is not an allowable address for
    the server.
    ]
2024-08-21 15:32:37.263 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying attempts left: 2
2024-08-21 15:32:37.263 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] SENT: a5 17 00 10 45 01 00 fa fc 73 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 84 00 0a 84 d4 43 15
2024-08-21 15:32:38.387 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] RECD: a5 17 00 10 45 03 00 fa 02
2024-08-21 15:32:38.387 WARNING (MainThread) [custom_components.solarman.api] [xxxx] Querying (1156 - 1165) failed. #260 [IllegalDataAddressError:  The data address received in the request is not an allowable address for
    the server.
    ]
2024-08-21 15:32:39.188 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying attempts left: 1
2024-08-21 15:32:39.188 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] SENT: a5 17 00 10 45 02 00 fa fc 73 7d 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 84 00 0a 84 d4 44 15
2024-08-21 15:32:40.455 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] RECD: a5 17 00 10 45 03 00 fa 02
2024-08-21 15:32:40.455 WARNING (MainThread) [custom_components.solarman.api] [xxxx] Querying (1156 - 1165) failed. #260 [IllegalDataAddressError:  The data address received in the request is not an allowable address for
    the server.
    ]
2024-08-21 15:32:41.456 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying attempts left: 0, aborting.
2024-08-21 15:32:41.456 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Request failed. [Previous State: Connected (1)]
2024-08-21 15:32:41.456 INFO (MainThread) [custom_components.solarman.api] [xxxx] Disconnecting from 192.168.1.178:8899
2024-08-21 15:32:41.457 DEBUG (MainThread) [custom_components.solarman.coordinator] Finished fetching ZCS data in 13.744 seconds (success: True)
2024-08-21 15:32:45.713 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Scheduling 0 query requests. #265
2024-08-21 15:32:45.714 DEBUG (MainThread) [custom_components.solarman.coordinator] Finished fetching ZCS data in 0.001 seconds (success: True)
2024-08-21 15:32:50.713 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Scheduling 0 query requests. #270
2024-08-21 15:32:50.713 DEBUG (MainThread) [custom_components.solarman.coordinator] Finished fetching ZCS data in 0.001 seconds (success: True)
2024-08-21 15:32:55.713 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Scheduling 0 query requests. #275
2024-08-21 15:32:55.713 DEBUG (MainThread) [custom_components.solarman.coordinator] Finished fetching ZCS data in 0.001 seconds (success: True)
2024-08-21 15:33:00.713 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Scheduling 7 query requests. #280
2024-08-21 15:33:00.714 DEBUG (MainThread) [custom_components.solarman.api] [xxxx] Querying (1028 - 1067) ...
2024-08-21 15:33:00.714 INFO (MainThread) [custom_components.solarman.api] [xxxx] Connecting to 192.168.1.178:8899

I modified the inverter profile to query every 20 seconds. At the beginning everything is working, until 15:32:33.815, when the data logger stops answering. After 5 attempts the integration aborts and close the connection. After several retries the data logger restart its normal behavior and replies are correctly processed. I don't know if it is a sort of protection of the data logger with respect the query rate (now 20 seconds, but 7 independent queries are performed together in sequence).

Edit: The cycle of the disconnection is every 15 minutes.

davidrapan commented 3 months ago

Yeah well it could be really anything... but as I already stated I would guess that the ethernet version could be little bit more resilient that the wireless. :-/

Anyway try it with the changes I was talking one post above. It could change this for the better. (If it will work though as I can't be sure if I did not forget anything I'm just blind guessing cause I don't have the device) 😉

Edit: The cycle of the disconnection is every 15 minutes.

Really strange. Can you see also any changes in the regular behavior with the same period?

lcavalli commented 3 months ago

Anyway try it with the changes I was talking one post above. It could change this to the better. (If it will work though as I can't be sure if I did not forget anything I'm just blind guessing cause I don't have the device) 😉

Could you please make a pre-release? The update is easier with HACS 2.0 (cannot download master anymore).

davidrapan commented 3 months ago

Haha the changes are in different branch.. I mean you can just swap the content of the api.py. I also gave you there link to the file.

I mean I could try to do that pre-releas but I think ^^ will be bit faster. :-P

lcavalli commented 3 months ago

Yep, will do manually, no problem. dev branch?

davidrapan commented 3 months ago

Yes. https://github.com/davidrapan/ha-solarman/blob/dev/custom_components/solarman/api.py