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]: "ZCS Azzurro inverter reporting spikes in consumption/battery/production values that revolve around the magic 65535 integer #1229

Open
Ocramius opened this issue Jan 20, 2025 · 10 comments
Labels
bug Something isn't working non solax non solax

Comments

@Ocramius
Copy link

Ocramius commented Jan 20, 2025

Describe the bug

Since 2025-01-14, which corresponds to the #1222 fix, I have numerous spikes in reported power consumption values.

Screenshots below mostly show the symptom in the HA dashboard.

Image

Image

Image

Image

Image

I've since adjusted these spikes via manual statistics adjustments in HA, but I noticed that these spikes seem to suspiciously revolve around the magic 65536 (16 bit max integer) value.

I've observed such spikes also before 2025.01.8, but I'm wondering what may have changed, that might have caused an increase in these outliers.

I'm wondering how I may help further, with debugging such issues 🤔

Integration Version

2025.01.8

Homeassistant core version

2025.1.2

Inverter brand

ZCS Azzurro (sofar)

Plugin used

EDIT: unsure about correct value: configured as "sofar" via GUI under /config/integrations/integration/solax_modbus`

Serial prefix

ZM2ES060

Connection Method

TCP/Ethernet via LSE-3 LAN stick Logger

Detailed Error Log

Logger: homeassistant.components.sensor.recorder
Source: components/sensor/recorder.py:317
integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 12:05:10 (4 occurrences)
Last logged: 13:55:10

    Entity sensor.zcs_inverter_solar_generation_today from integration solax_modbus has state class total_increasing, but its state is not strictly increasing. Triggered by state 3.74 (3.75) with last_updated set to 2025-01-20T11:00:16.005405+00:00. Please create a bug report at https://github.com/wills106/homsassistant-solax-modbus/issues
    Entity sensor.zcs_inverter_battery_input_energy_today from integration solax_modbus has state class total_increasing, but its state is not strictly increasing. Triggered by state 2.47 (2.48) with last_updated set to 2025-01-20T11:00:16.005494+00:00. Please create a bug report at https://github.com/wills106/homsassistant-solax-modbus/issues
    Entity sensor.zcs_inverter_solar_generation_total from integration solax_modbus has state class total_increasing, but its state is not strictly increasing. Triggered by state 1899.2 (1899.3) with last_updated set to 2025-01-20T11:47:18.938140+00:00. Please create a bug report at https://github.com/wills106/homsassistant-solax-modbus/issues
    Entity sensor.zcs_inverter_load_consumption_today from integration solax_modbus has state class total_increasing, but its state is not strictly increasing. Triggered by state 16.02 (16.03) with last_updated set to 2025-01-20T12:53:23.858812+00:00. Please create a bug report at https://github.com/wills106/homsassistant-solax-modbus/issues
Logger: pymodbus.logging
Source: custom_components/solax_modbus/__init__.py:545
integration: SolaX Inverter Modbus ([documentation](https://homeassistant-solax-modbus.readthedocs.io/), [issues](https://github.com/wills106/homsassistant-solax-modbus/issues))
First occurred: 09:54:40 (203 occurrences)
Last logged: 13:55:38
No response received after 6 retries, continue with next request

Additional context

No response

@Ocramius Ocramius added bug Something isn't working non solax non solax labels Jan 20, 2025
@manuelmrmorgado
Copy link

Same issue with Solax. Since 2025.1.8. Downgraded and its fine again.

@Ocramius
Copy link
Author

@manuelmrmorgado yep, had to downgrade to 2025.01.6 myself too: spikes are effectively the norm, right now, so something broke completely here.

Looking at the diffs: 2025.01.6...2025.01.8

I think the biggest offender may be pymodbus itself.

The diff of PyModbus is massive though: pymodbus-dev/pymodbus@v3.7.4...v3.8.3

@Zwer2k
Copy link
Contributor

Zwer2k commented Jan 24, 2025

Same Issue with Sofar

Image

@matejkaf
Copy link

SolaX X3 G4 here. I have spikes all over the place. Spikes are short (around 10 Seconds), one polling interval maybe.
House Load peaked to 3,932,190.0 W today 2 times. Energy total values drop to zero several times a day. Energy statistic is garbage. Will downgrade to 2025.01.6.

@mbeetle
Copy link

mbeetle commented Jan 25, 2025

Same here for me with Solax X3 G4. Downgrade back to 2025.1.6 solves the Issue

@jelmeronline
Copy link

No problems with the magic number but sometimes the total generated power, lets say 2000kWh in the inverters lifetime, is read as 0 and then back to normal. So Homeassistant has these values
2000
2001
2002
0
2003
2004
And will calculate a total generated power of 4006kWh for this period.

@Ocramius
Copy link
Author

Ocramius commented Jan 26, 2025

Yeah, in cases where a 0 would be read, "unavailable" would be the correct metric. From what I can see, the entire logic is very much (correctly) abstracted away:

SofarModbusSensorEntityDescription(
name="Solar Generation Total",
key="solar_generation_total",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
register=0x686,
unit=REGISTER_U32,
scale=0.1,
rounding=1,
allowedtypes=HYBRID | PV,
),

I wonder if this is roughly where this "unavailable" should be emitted:

class BaseModbusSensorEntityDescription(SensorEntityDescription):

Does anyone know the correct SQL manipulation to reset these metrics? I saw that metrics store a max, min, avg and sum, but I couldn't get proper logic written for it. I'm thinking WHERE (current.sum - previous.sum) > :impossible_change_threshold or such 🤔

@cschlipf
Copy link
Contributor

cschlipf commented Feb 3, 2025

Same here for me with Solax X3 G4. Downgrade back to 2025.1.6 solves the Issue

That is the solution.

In the longer term it's no longer recommended to use the LSE-3 due to the rising number of issues. See also the Sofar FAQ. Please consider switching to an RS485 Adaptor.

I switched to RS485 last weekend and no issues anymore with the latest integration version. Updating values is possible without wrong error return codes and happens in a few seconds instead of minutes.

@Ocramius
Copy link
Author

Ocramius commented Feb 3, 2025

I switched to RS485

@cschlipf do you mean that you switched to a different hardware? If so, which?

@cschlipf
Copy link
Contributor

cschlipf commented Feb 3, 2025

I am using the Waveshare USB Adaptor. In my case this is directly connected to EVCC and EVCC is providing a ModBus proxy for Home Assistant to connect to via ModBus TCP.

See also the Installation Guide.

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

No branches or pull requests

7 participants