wills106 / homeassistant-solax-modbus

SolaX Power Modbus custom_component for Home Assistant (Supports some AlphaESS, Growatt, Sofar, Solinteg, Solis, SRNE, Swatten)
317 stars 101 forks source link

[BUG] X1-Hybrid-G4 No longer retrieving any useful entities #449

Closed obiphi closed 1 year ago

obiphi commented 1 year ago

Hi, HA newb here so any assistance (and forgiveness for ignorance) would be greatly appreciated!

I have two inverters; a Solax X1-Hybrid G4 (Serial starts: H4502AI) with Solax Triple Power Battery, and X1-Mini (Serial starts XM3A20I). Both were being queried with Modbus over TCP and everything was working. Then I updated HA to 2023.6.2 and both stopped retrieving any entities with useful information; everything was unknown or 'entity no longer retrieved'. I then ran ha core update --version 2023.6.1 to downgrade to 2023.6.1 and it still didn't work, so then I downgraded to 2023.5.4 and now the X1-Boost is working again but the X1-Hybrid-G4 is still not working. The Logs contained lines like:

2023-06-19 10:58:54.842 INFO (MainThread) [custom_components.solax_modbus] trying to load plugin - plugin_name: solax 2023-06-19 10:58:54.844 INFO (MainThread) [custom_components.solax_modbus.plugin_solax] SolaX: trying to determine inverter type 2023-06-19 10:58:55.062 INFO (MainThread) [custom_components.solax_modbus.plugin_solax] Read SolaX 0x0 serial number before potential swap: H4502AIXXXXXX 2023-06-19 10:58:55.070 INFO (MainThread) [homeassistant.components.button] Setting up button.solax_modbus 2023-06-19 10:58:55.072 INFO (MainThread) [homeassistant.components.number] Setting up number.solax_modbus 2023-06-19 10:58:55.074 INFO (MainThread) [homeassistant.components.select] Setting up select.solax_modbus 2023-06-19 10:58:55.077 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.solax_modbus 2023-06-19 10:58:55.081 INFO (MainThread) [custom_components.solax_modbus.button] hub.wakeuButton: SolaxModbusButtonEntityDescription(key='battery_awaken', device_class=None, entity_category=None, entity_registry_enabled_default=True, entity_registry_visible_default=True, force_update=False, icon='mdi:battery-clock', has_entity_name=False, name='Battery Awaken', translation_key=None, unit_of_measurement=None, allowedtypes=0, register=86, command=1, blacklist=None, write_method=1, value_function=None, autorepeat=None) 2023-06-19 10:58:55.087 INFO (MainThread) [custom_components.solax_modbus.sensor] computedRegs: {}

I can't see anything wrong with that except that it isn't getting the ~200 entities that it was getting before. Where do I go from here debugging this issue?

Mandatory details

  1. Integration Version: 2023.06.8
  2. HA Version: Currently 2023.5.4, but it was also failing on 2023.6.2 and 2023.6.1
  3. Inverter Brand: Solax
  4. Plugin Used: Solax Inverter Modbus
  5. First 6 digits of Serial: H4502A
  6. Connection Method: TCP to the Solax PocketWifi

If it's useful, calling the RESTful API on the device shows 'ver: 3.006.04' and 'type: 15'

Is the HA update likely to have caused this issue, or is that a red herring?

wills106 commented 1 year ago

If it was working ok before and has stopped I would try a power cycle on the Inverter. There still seems to be an issue with these PocketWiFi's causing them to stop responding.

obiphi commented 1 year ago

Thanks @wills106, I followed some youtube guides about how to reset the inverter but couldn't find separate DC breakers so I settled for the AC inverter plus the 'DC Switch' on the base of the unit, but the inverter never fully powered off. In lieu of this I pulled the PocketWifi USB out of the inverter (as you mentioned it was the PocketWifi with the issue), left it out for a few seconds and then put it back in. Still getting the same entries in the log, and no additional entities found. Would that level of reset be sufficient?

Any other ideas?

wills106 commented 1 year ago

Within LCD menu isn't there a system switch? It might be slightly different on your Gen4 to my Gen3

obiphi commented 1 year ago

Yes, I spoke to Solax support and he guided me through the LCD menu to switch off the system, but it still didn't fully switch off the inverter like I naively expected it to. Still no change on the modbus returns either

wills106 commented 1 year ago

Did you set the DC Breaker to off on the Battery pack? On my older T45 there is one under the cover on the BMS.

The Rotary DC switch should be for the PV? There will also be an AC Rotary isolator switch, which is the grid connection.

obiphi commented 1 year ago

Aha! Thanks @wills106, I didn't even know there was a removable cover on the battery, let-alone a control panel under there! Thanks to you I completed a proper power-down of the inverter, left it for a minute or so, and then started it all back up again. It's all happily running (according to the Solax Cloud) but I'm afraid I'm still only seeing the same entities in HA, and the same entries in the log as before

gittan443 commented 1 year ago

I am also experiencing the same issue.

Seeing this in the log: 2023-06-28 11:56:34.953 INFO (MainThread) [custom_components.solax_modbus] exception Modbus Error: [Connection] ModbusTcpClient(192.168.72.11:502): Connection unexpectedly closed 5.14984130859375e-05 seconds into read of unbounded read bytes without response from unit before it closed connection : SolaX cannot read input registers at device 1 position 0x8 NoneType: None

local_rest call works and I can read the data that way so the PocketWifi seems to work.

Sn obfuscated Ver 3.006.04 Type 14 Data 2,350, 2,357, 2,368, 22, 23, 22, 469, 497, 488, 1,454, 2,217, 0, 68, 0, 1,528, 0, 5,007, 5,007, 5,007, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,241, 0, 0, 0, 0, 21,720, 0, 0, 2,161, 0, 0, 1, 48, 213, 256, 4,359, 7,180, 5,894, 100, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10,256, 0, 31, 2,360, 0, 31, 2,910, 0, 3,748, 0, 0, 35, 8,877, 0, 35, 0, 0, 0, 36,070, 0, 37,584, 3, 80, 0, 1,460, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 100, 1, 30, 61, 256, 2,336, 1,600, 0, 300, 254, 248, 34, 34, 57, 1,108, 779, 14,135, 14,135, 0, 0, 0, 0, 3,414, 3,363, 11,016, 11, 20,564, 12,339, 18,753, 12,609, 16,690, 12,868, 12,854, 20,564, 12,339, 18,754, 12,854, 16,694, 12,359, 13,875, 20,564, 12,339, 18,754, 13,111, 16,689, 12,359, 12,600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,586, 1,538, 1,281, 258, 0, 21,720, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 Information 12, 14, H34A12I6S31027, 8, 1.21, 0, 1.22, 1.09, 0, 1

obiphi commented 1 year ago

Thanks @gittan443, just to add that despite:

I'm still experiencing the issue on one of my two inverters.

gittan443 commented 1 year ago

Ok, so yesterday I did a complete poweroff of the inverter (haven't had time until now). And now the modbus data is presented again in HomeAssistant.

Steps to poweroff: 1) Cut AC-Breaker 2) Cut DC-breaker under the SolaX inverter (on my bottom left) 3) Power-off battery stack 4) Wait for poweroff to complete and the LCD panel go blank

Poweron: 1) Restore AC (and smart meter connection) 2) Restore DC 3) When waiting for battery is displayed, startup battery pack. 4) wait one hour with daylight, restart Home Assistant

Alfred99-HA commented 1 year ago

Update: Problem solved - see at the end Hi, am am newbi and expiernce same problems with only 4 entities with my Solax X3 G3 Inverter. Actually I did shut down only the switch and it worked once - I got more than 200 entities and was happy. However a bit later they became unavailable again. I did remove Solax inverter modbus several times and installing again, restart, reboot, remove LAN-cable, shut down the switch, removed, check the Modbus Port 502 - nothing brings me back the entities. See the log-entries below. 2023-07-17 16:41:03.033 WARNING (MainThread) [custom_components.solax_modbus.plugin_solax] SolaX X3 Hybrid 10.0 kWp: reading serial number from address 0x0 failed; other address may succeed 2023-07-17 16:41:03.057 ERROR (MainThread) [pymodbus.logging] Connection to (192.168.0.228, 502) failed: [Errno 104] Connection reset by peer 2023-07-17 16:41:03.063 WARNING (MainThread) [custom_components.solax_modbus.plugin_solax] SolaX X3 Hybrid 10.0 kWp: attempt to read serialnumber failed at 0x300 Traceback (most recent call last): File "/config/custom_components/solax_modbus/plugin_solax.py", line 59, in _read_serialnr inverter_data = hub.read_holding_registers(unit=hub._modbus_addr, address=address, count=7) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/solax_modbus/init.py", line 336, in read_holding_registers return self._client.read_holding_registers(address, count, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pymodbus/client/mixin.py", line 100, in read_holding_registers return self.execute( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pymodbus/client/base.py", line 191, in execute raise ConnectionException(f"Failed to connect[{str(self)}]") pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.0.228:502)]

Is it possible to configure the Serial number manually and would this help ?

The SOLAX Inverter modbus looks quite powerful and I am eager to take advantage of it. Any help yould be highly appreciated.

Update: I found myself the cause of my problem. actually there has been another gateway ( neoom beam) listening to the modbus. When the gateway is active the problem occurs, if it's shut down everything works fine!

Great integration, thank you for providing such powerful code

wills106 commented 1 year ago

Unfortunately it still appears that the PocketWiFi is unreliable at times. That's why it's recommended to use an RS485 adaptor like a Waveshare and bypass the PocketWiFi altogether.

Alfred99-HA commented 1 year ago

It was a different problem - I am using a LAN connection anyway, but another gateway (neoom beaam) listening to the SOLAX modbus prevented HA to read the modbus currectly. Thus modbus connection might be "corrupted" by other means as weak WIFI as well. I am writing this in case someone else has similar setup and can apply this as well

wills106 commented 1 year ago

Closing down as not an Integration issue and updated Readme