Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Sudden peaks appearing in the measured data on Solax X3 G4 #1238

Open
shaarkys opened this issue Jan 28, 2025 · 25 comments
Open

[Bug]: Sudden peaks appearing in the measured data on Solax X3 G4 #1238

shaarkys opened this issue Jan 28, 2025 · 25 comments
Labels
bug Something isn't working solax

Comments

@shaarkys
Copy link

Describe the bug

Hi,

sudden anomalous peaks are appearing in the Solax integration data, most probably when inverted stops responding for a while. These spikes are not observed in other platforms like Homey (same sampling rate) or the Solax Cloud. The setup uses Modbus TCP via a Multiplexer and had been stable for months prior to the upgrades.
I thought it was caused by V3 Wifi+LAN dongle upgrade that was done remotely, which caused inverter to lock several times during the day, but after reverting it, the Lock issues are gone but the peaks remains.

While I have to clarify why modbus disconnects (visible on Homey logs) suddenly for a moment, is there some possibility to avoid such peaks ? Apologies if this would be some kind of HW failure on my side but trying to rule out everything.

Image

Image

Image

Integration Version

2025.01.8 (testing now 2025.01.6 to see any difference)

Homeassistant core version

2025.1.4

Inverter brand

Solax X3 G4

Plugin used

plugin_solax.py

Serial prefix

H34A10

Inverter firmware versions

DSP v1.46 ARM v1.44

Connection Method

Solax Wifi+LAN adapter V3 with fw via LAN

Dongle firmware

1.003.11 (reverted as troubleshooting steps from 1.005.04 )

Detailed Error Log

Image

This error originated from a custom integration.

Logger: pymodbus.logging
Source: custom_components/solax_modbus/__init__.py:771
integration: SolaX Inverter Modbus (documentation, issues)
First occurred: January 27, 2025 at 20:04:19 (21864 occurrences)
Last logged: 11:25:39

BinaryPayloadDecoder is deprecated and will be removed in v3.9.0 ! Please use "client.convert_from_registers()" or "client.convert_to_registers" See documentation: "https://pymodbus.readthedocs.io/en/latest/source/client.html#pymodbus.client.mixin.ModbusClientMixin.convert_from_registers"
This error originated from a custom integration.

Logger: custom_components.solax_modbus
Source: custom_components/solax_modbus/__init__.py:670
integration: SolaX Inverter Modbus (documentation, issues)
First occurred: January 27, 2025 at 21:51:40 (6 occurrences)
Last logged: 10:59:20

Something went wrong reading from modbus
Traceback (most recent call last):
  File "/config/custom_components/solax_modbus/__init__.py", line 670, in async_read_modbus_data
    res = await self.async_read_modbus_registers_all(group)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/solax_modbus/__init__.py", line 848, in async_read_modbus_registers_all
    data[descr.key] = descr.value_function(0, descr, data)
                      ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/config/custom_components/solax_modbus/plugin_solax.py", line 300, in value_function_battery_voltage_cell_difference
    return datadict.get("cell_voltage_high", 0) - datadict.get("cell_voltage_low", 0)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'
This error originated from a custom integration.

Logger: custom_components.solax_modbus
Source: custom_components/solax_modbus/__init__.py:716
integration: SolaX Inverter Modbus (documentation, issues)
First occurred: January 27, 2025 at 21:51:39 (248 occurrences)
Last logged: 10:59:20

Solax X3 G4: read failed at 0xbd: cell_voltage_low
Solax X3 G4: read failed at 0xbf: battery_soh
Solax X3 G4: read failed at 0xc8: grid_frequency
Solax X3 G4: read failed at 0xc9: grid_voltage
Solax X3 G4: read failed at 0xca: grid_voltage_l1
This error originated from a custom integration.

Logger: custom_components.solax_modbus
Source: custom_components/solax_modbus/__init__.py:670
integration: SolaX Inverter Modbus (documentation, issues)
First occurred: 08:50:12 (4 occurrences)
Last logged: 08:56:03

Something went wrong reading from modbus
Traceback (most recent call last):
  File "/config/custom_components/solax_modbus/__init__.py", line 658, in async_write_registers_multi
    resp = await self._client.write_registers(address=address, values=payload, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pymodbus/transaction/transaction.py", line 155, in execute
    raise ModbusIOException(txt)
pymodbus.exceptions.ModbusIOException: Modbus Error: [Input/Output] No response received after 6 retries, continue with next request
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/solax_modbus/__init__.py", line 670, in async_read_modbus_data
    res = await self.async_read_modbus_registers_all(group)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/solax_modbus/__init__.py", line 874, in async_read_modbus_registers_all
    await self.async_write_registers_multi(
    ...<3 lines>...
    )
  File "/config/custom_components/solax_modbus/__init__.py", line 661, in async_write_registers_multi
    raise HomeAssistantError(f"Error writing multiple Modbus registers: {original_message}") from e
homeassistant.exceptions.HomeAssistantError: Error writing multiple Modbus registers: Modbus Error: [Input/Output] No response received after 6 retries, continue with next request

Additional context

Note - around 9AM I upgraded firmware to DSP v1.46 ARM v1.44 as another troubleshooting step.

@shaarkys shaarkys added bug Something isn't working solax labels Jan 28, 2025
@shaarkys
Copy link
Author

Seems that 2025.01.6 is not showing such sudden peaks, despite of short/random disconnections (at least based on this short test).

Just wonder, is it due to the recent Python related changes and will this change maybe address it ?
048ac75

@Shortykiller
Copy link

Hi

Just want to state that I to have the same problem with random spikes. Im new to the integration, so have no history to cross check with.

My Solar System is Growatt, running Modbus/TCP custom esp32, directly on the modbus com port.

@thkn1973
Copy link

I should check github more often as soon as errors occur.
I have also had these spikes since then.

Image

@matejkaf
Copy link

Anyone tried latest release 2025.01.9? Spike Problem solved? At the moment I am stuck at 2025.01.6

@Shortykiller
Copy link

Anyone tried latest release 2025.01.9? Spike Problem solved? At the moment I am stuck at 2025.01.6

No, not yet.. I downgraded to 2025.01.6 yesterdays to check if that solved it temporary..

@shaarkys
Copy link
Author

Anyone tried latest release 2025.01.9

I did, running it almost full day, it looks much better... but still some smaller peaks appears

Image

But finally no crazy reading in energy ... !

Image

@shaarkys
Copy link
Author

Hmm, so reverting back ;-(

@shaarkys
Copy link
Author

Image

@Zwer2k
Copy link
Contributor

Zwer2k commented Jan 31, 2025

Anyone tried latest release 2025.01.9? Spike Problem solved? At the moment I am stuck at 2025.01.6

No. Complety destroys my Statistics. Back to 2025.01.6 . Inverter Sofar HYD10-KTL-3ph

Image

@shaarkys
Copy link
Author

Just use /developer-tools/statistics and remove faulty values - it's better to do it the same day it happens, it's faster then. ;-)

@Zwer2k
Copy link
Contributor

Zwer2k commented Jan 31, 2025

Thank you. I know the method. Unfortunately it is a bit time-consuming.

@shaarkys
Copy link
Author

shaarkys commented Feb 2, 2025

So far 2025.01.6 is really working fine for me.

@wills106 , any thoughts on that please ?

@wills106
Copy link
Owner

wills106 commented Feb 2, 2025

Integration 2025.01.6 is using pyModbus 3.7.4
Integration 2025.01.8 and above is using pyModbus 3.8.3 to match HA.

The developer of pyModbus is striving to make pyModbus more Modbus compliant, which many Data Loggers such as the SolaX PocketWiFi / PocketWiFi + LAN and the Sofar LSE-3 aren't.

With the Sofar LSE-3 the latest firmware ME_0D_270A_1.11 made the Data Logger even more uncompliant, people are recommended to downgrade to ME_0D_270A_1.09. But even then they are still getting issues.

I will be updating the documentation to recommend people to use a USB-RS485 or an Ethernet-RS485 device such as the Waveshare as these are less problematic, instead of these Data Loggers.

It is possible that improvements could be made to the Integration using pyModbus 3.8.3 to improve things, but I own a single Inverter with built in Modbus over TCP. So I can't actively improve support for data loggers that aren't fully Modbus compliant, as I don't own one nor can I use one on my Inverter.

@shaarkys
Copy link
Author

shaarkys commented Feb 2, 2025

Thank you @wills106 , I thought it was related to pyModbus ...however in my case, I use Wifi V3 LAN+Wifi dongle, accessing it via TCP Multiplexer on Solax X3 G4, worked very much fine last year. So not sure what do you mean with Data Loggers ?
Also I'm quite sure those peaks just occurs when dongle temporarily refuse to provide data (yet still being accessible).

In my case, I can't use WaveShare RS485, haven been this route (even created some tickets some time ago) and never worked for me reliably, not sure why, but also was getting peaks. One of the reason could be that Wifi + RS485 basically creates two devices accessing the Modbus, not sure

@matomatusov
Copy link

Hi @wills106 ,
don't you know why my pymodbus version in HA changes every now and then?

Image

Thanks

@Zwer2k
Copy link
Contributor

Zwer2k commented Feb 2, 2025

I use WaveShare RS485 and have the peaks that did not exist until version 2025.01.6. In my case, the data is read with two end devices (Solax Modbus + EVCC) via Modbus proxy. I have seen that there have been no changes to the integration that could cause these spikes, it must actually be due to the new pyModbus version.
This is annoying, especially since I've been struggling with pyModbus compatibility issues for two months now. Solax forces new versions of pyModbus all the time, which in turn leads to problems with other integrations that also use pyModbus. In my case Huawei-Solar. I keep having to switch to older Ha-Core, Huawei and Solax versions.
I don't think it's a good idea to use versions of libraries that are not yet included in HA-Core.

@wills106
Copy link
Owner

wills106 commented Feb 3, 2025

pyModbus 3.8.3 is in HA core, it's been in there for about a month now.

home-assistant/core#134809

I try and keep the Integration matched with HA, as some users also use the HA Modbus client directly for Air source Heat Pumps etc.

@shaarkys
Copy link
Author

shaarkys commented Feb 3, 2025

...however in my case, I use Wifi V3 LAN+Wifi dongle, accessing it via TCP Multiplexer on Solax X3 G4, worked very much fine last year. So not sure what do you mean with Data Loggers ?
Also I'm quite sure those peaks just occurs when dongle temporarily refuse to provide data (yet still being accessible).

@wills106 and please your response to peaks on Solax / with Wifi Dongle V3 LAN+Wifi ? Those peaks were not there so it must be something with the library itself. I checked changelog, haven't seen anything obvious and also no "bug" planned to be fixed in the next version, but I'm not expert ;-( I hope it will not result into "dongle unsupported / not recommended" anymore ;-)

@Zwer2k
Copy link
Contributor

Zwer2k commented Feb 4, 2025

Yesterday I connected the integration directly to the WaveShare RS485 adapter (without Modbus proxy) and since then I have had no more spikes. EVCC continues to run via Modbus proxy.
The problem only seems to occur in association with Modbus proxy. Version of Modbus proxy is still the same as before the problem, I have not changed anything

@shaarkys
Copy link
Author

shaarkys commented Feb 6, 2025

Integration 2025.01.6 is using pyModbus 3.7.4
Integration 2025.01.8 and above is using pyModbus 3.8.3 to match HA.

Hi @wills106 , FYI - I can confirm that combination of pyModbus 3.8.3 with Solax X3 G4 connected via WLAN V3 dongle LAN+Wifi do not work well. Since I switched over to 2025.01.6 (back to pyModbus 3.7.4 ), the integration works perfectly like whole previous time. Since we know that the cause is pyModbus 3.8.3, is there anything else I can do to help troubleshoot this ?

Perfect "curve" on 2025.01.6 (pyModbus 3.7.4)
Image

The changelog is pretty extensive since 3.7.4 but what could be causing this behavior ?
https://pymodbus.readthedocs.io/en/v3.8.3/source/changelog.html

And why there are not yet multiple reports like this one everywhere ? ...rhetorical question I'm asking myself.

Asking "AI advisor", this is the view (I don't know if it's reasonable or not)

The most likely suspect is the change introduced in 3.8.1 that causes the async client to raise an exception on no response (see #2502). This change means that if the client stops responding momentarily, it now throws an exception rather than failing silently. That could disrupt the normal flow—triggering reconnection or fallback handling—and lead to those measurement peaks you’re seeing.

Additionally, changes like the re-instantiation of Futures on reconnect (#2501) might contribute to delays or unexpected behavior if the error handling isn’t adjusted accordingly. However, the explicit raising of exceptions on no response is the primary change to check.

@matomatusov
Copy link

matomatusov commented Feb 6, 2025

Hi,
It happens to me that some registries fall out. In the past, everything was OK.

Image

Image

@darkrain-nl
Copy link
Contributor

Just want to share I see peaks as well with plugin_sofar...

@steps56
Copy link

steps56 commented Feb 7, 2025

Me too a few rare times at SolaX.

@HA-Supi
Copy link

HA-Supi commented Feb 9, 2025

I can also confirm this behavior with Qcell's Hyp-G3 (Solax X3 G4).
Data retrieval via Modbus TCP / Stick 3.0 FW 19.01 / Inverter FW 48 08 45

Please take a look at the following information on troubleshooting > @wills106 :
I switched from the 2024.05.3 integration to 2025.01.2 in January 2025. With old Integration I used a tile with FW info, the removal of the entity bothered me. ... but because of HA Updates... I switched to a recent Addon Version.
Previously, the integration worked for 6 months without any problems.

I suspect that there are data errors during retrieval that are not recognized. (no data checksum?)

I thought it might be due to the change of operating mode (inverter check mode, last picture), but why would the battery data be going so crazy at that moment?

Here are a couple of screenshots:
They do not show all entities with errors... only a selection.

Image

Image

Image

Image

Image

Image

@steps56
Copy link

steps56 commented Feb 9, 2025

Yes, I got same Errors at my system.
Newest Modbus Integration, newest HA core and supervisor and Qcells/SolaX brandnew Firmware 1.50/1.47 from this week and latest Lan/Wlan Dongle too.

The spikes must come from Integrantion blackouts, as Qcells/SolaX App History doesn't show any spikes ever.

After each new start of HA, the pyModbus depricates error shows up once too !

Using Backup Mode during winter avoids inverter idle... and no heating if ideling.
Setting FVRT to on (instead off by default) gives more Grid tollerance to grid up and downs, avoiding even more errors at Qcells/SolaX System also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working solax
Projects
None yet
Development

No branches or pull requests

10 participants