Akulatraxas / ha-modbusproxy

Hassio Addon packaging modus-proxy
Apache License 2.0
41 stars 7 forks source link

Set Slave ID (for Huawei) #11

Open GrandAmmor opened 1 year ago

GrandAmmor commented 1 year ago

I'm using your Add-On for a Sungrow modbus-proxy and it works perfectly well!

Now I tried tne same on a different home assistant instance with a Huawei Sun2000 inverter. It runs into 'connection refused' as long as I can't set the slave ID to '0'.

I tried https://github.com/wlcrs/huawei_solar to show the values and it works with the same IP and port as I tried with your add-on. Just the configuration of slave ID is missing I guess.

Can you help me with that issue?

Thx for your work anyways!

Akulatraxas commented 1 year ago

Mhh, from looking through that documentation it looks like the slave_id is only relevant if you use a RS Connections, not for a tcp-connection? Before looking deeper into it have you make sure that you disconnected all clients from the Sun2000 inverter and waited at least 10 minutes before trying to start the add-on ?

GrandAmmor commented 1 year ago

Thanks for your quick reply!

I disconected all devices and waited around 30 min till I started the add-on.

Now it shows this error (connecting to the dongle IP): 2023-02-26 18:03:36,105 INFO modbus-proxy: Starting... 2023-02-26 18:03:36,118 INFO modbus-proxy.ModBus(192.168.178.35:502): Ready to accept requests on 0:502 2023-02-26 18:04:23,723 INFO modbus-proxy.Client(192.168.178.254:58304): new client connection 2023-02-26 18:04:24,724 DEBUG modbus-proxy.Client(192.168.178.254:58304): received b'\x00\x01\x00\x00\x00\x06\x01\x03}@\x00\x02' 2023-02-26 18:04:24,726 INFO modbus-proxy.ModBus(192.168.178.35:502): connecting to modbus... 2023-02-26 18:04:24,733 INFO modbus-proxy.ModBus(192.168.178.35:502): connected! 2023-02-26 18:04:24,734 INFO modbus-proxy.ModBus(192.168.178.35:502): delay after connect: 1 2023-02-26 18:04:25,738 DEBUG modbus-proxy.ModBus(192.168.178.35:502): sending b'\x00\x01\x00\x00\x00\x06\x01\x03}@\x00\x02' 2023-02-26 18:04:25,739 ERROR modbus-proxy.ModBus(192.168.178.35:502): write_read error [1/2]: IncompleteReadError('0 bytes read on a total of 6 expected bytes')

And if I use the other IP of the inverter (eth), this error shows up:

2023-02-26 18:13:50,947 ERROR modbus-proxy.ModBus(192.168.178.36:502): write_read error [1/2]: ConnectionRefusedError(111, "Connect call failed ('192.168.178.36', 502)")

It was so easy with sungrow, but Huawei drives me crazy...

GrandAmmor commented 1 year ago

Do you think you can implement a modbus-proxy feature?

Your integration works like a charm and I would to see other services using your integration as a modbus proxy.

In don't know how much works that would be. This is why I'm asking that naive way ;)

vinc32 commented 1 year ago

i do have the same issue. any solution here?

PulsarFX commented 10 months ago

In the source repo for this addon: https://github.com/tiagocoutinho/modbus-proxy I've seen similar logs for sun2000 inverters. Seems like it needs some delay to work

Roving-Ronin commented 4 months ago

Shame this modbus (tcp) proxy isn't written in C++, it would be excellent if it was able to run upon an ESP32 board, using ESPHome. Could add these inputs / pulldown selections to the web interface (that would also make them accessible in Home Assistant) for setting the modbus servers IP and port your wanting to query, as well as the port the proxy accepts queries upon. US$5 board (RISC IV @ 240Mhz) consuming a few watts of power and that boots in a few seconds.

Would also mean centralisation of the code being possible, with people able to add this to an espome device and pull the code into an esp and run it. Example:

external_components:
  - source: github://dentra/esphome-components
HFB2022 commented 4 months ago

@Akulatraxas _Mhh, from looking through that documentation it looks like the slaveid is only relevant if you use a RS Connections, not for a tcp-connection? I'm faced with same Problem, and it is exactly the other way round: the unit ID is not needed using RS, but essential for TCP. Typical Huawai: connect to the dongle is # 1, inverter # 0. Tiago Coutinho's modbus proxy even offers a unit mapping to avoid any possible compatibility problems. Huawai Dongle: 192.168.107.200 HA (MB Proxy addon): 192.168.107.66 I would appreciate a solution very much. My log is an endless stream of: 2024-07-29 18:28:27,120 INFO modbus-proxy.ModBus(192.168.107.200:502): closing connection... 2024-07-29 18:28:27,120 INFO modbus-proxy.ModBus(192.168.107.200:502): connection closed 2024-07-29 18:28:27,120 INFO modbus-proxy.Client(192.168.107.66:38064): closing connection... 2024-07-29 18:28:27,120 INFO modbus-proxy.ModBus(192.168.107.200:502): connecting to modbus... 2024-07-29 18:28:27,121 INFO modbus-proxy.Client(192.168.107.66:38064): connection closed 2024-07-29 18:28:27,125 INFO modbus-proxy.ModBus(192.168.107.200:502): connected! 2024-07-29 18:28:27,125 INFO modbus-proxy.ModBus(192.168.107.200:502): delay after connect: 0.1 2024-07-29 18:28:27,225 DEBUG modbus-proxy.ModBus(192.168.107.200:502): sending b'\x00\x02\x00\x00\x00\x06\x01\x03\xa7\xfe\x00\x01' 2024-07-29 18:28:37,235 ERROR modbus-proxy.ModBus(192.168.107.200:502): write_read error [1/2]: TimeoutError() 2024-07-29 18:28:37,235 INFO modbus-proxy.ModBus(192.168.107.200:502): closing connection... 2024-07-29 18:28:37,235 INFO modbus-proxy.ModBus(192.168.107.200:502): connection closed 2024-07-29 18:28:37,235 INFO modbus-proxy.ModBus(192.168.107.200:502): connecting to modbus... 2024-07-29 18:28:37,241 INFO modbus-proxy.ModBus(192.168.107.200:502): connected! 2024-07-29 18:28:37,241 INFO modbus-proxy.ModBus(192.168.107.200:502): delay after connect: 0.1 2024-07-29 18:28:37,341 DEBUG modbus-proxy.ModBus(192.168.107.200:502): sending b'\x00\x02\x00\x00\x00\x06\x01\x03\xa7\xfe\x00\x01' 2024-07-29 18:28:39,914 INFO modbus-proxy.Client(192.168.107.66:35732): new client connection 2024-07-29 18:28:43,914 DEBUG modbus-proxy.Client(192.168.107.66:35732): received b'\x00\x02\x00\x00\x00\x06\x01\x03\xa7\xfe\x00\x01' 2024-07-29 18:28:47,345 ERROR modbus-proxy.ModBus(192.168.107.200:502): write_read error [2/2]: TimeoutError() 2024-07-29 18:28:47,345 INFO modbus-proxy.ModBus(192.168.107.200:502): closing connection... 2024-07-29 18:28:47,345 INFO modbus-proxy.ModBus(192.168.107.200:502): connection closed 2024-07-29 18:28:47,345 INFO modbus-proxy.Client(192.168.107.66:38050): closing connection... 2024-07-29 18:28:47,345 INFO modbus-proxy.ModBus(192.168.107.200:502): connecting to modbus... 2024-07-29 18:28:47,346 INFO modbus-proxy.Client(192.168.107.66:38050): connection closed 2024-07-29 18:28:47,350 INFO modbus-proxy.ModBus(192.168.107.200:502): connected! 2024-07-29 18:28:47,350 INFO modbus-proxy.ModBus(192.168.107.200:502): delay after connect: 0.1 2024-07-29 18:28:47,451 DEBUG modbus-proxy.ModBus(192.168.107.200:502): sending

Erkessolar commented 6 days ago

Any news on usage of HA Modbusproxy with Huawei sun2000 inverter?

theveninjeremy commented 22 hours ago

I have the same needs. I have a Huawei sun 2000 and I would like to use evcc addon therefore I need a proxy to have both HA and EVCC to access the inverter. I'm a noob for proxy so I have no idea how to configure this...

Erkessolar commented 20 hours ago

I incteased the the request duration from 0.1s to 1s and that helpdesk:-)Von meinem/meiner Galaxy gesendet -------- Ursprüngliche Nachricht --------Von: theveninjeremy @.> Datum: 26.11.24 19:35 (GMT+01:00) An: Akulatraxas/ha-modbusproxy @.> Cc: Erkessolar @.>, Comment @.> Betreff: Re: [Akulatraxas/ha-modbusproxy] Set Slave ID (for Huawei) (Issue #11) I have the same needs. I have a Huawei sun 2000 and I would like to use evcc addon therefore I need a proxy to have both HA and EVCC to access the inverter. I'm a noob for proxy so I have no idea how to configure this...

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>