wills106 / homeassistant-solax-modbus

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

[BUG] Integration broken on Solis Hybrid inverter #1063

Open kai-seipp opened 1 month ago

kai-seipp commented 1 month ago
          Hi Will, 

I have taken your last comment as trigger to update the integration the it's current version. I can't stress enough: For Solis - at least with my setup - it is 100% broken and unusable.

I would love to help debugging. But It would be great if we could set a time like a couple of days of a week that works best for everyone as I have to revert to an old version to avoid totally messing up my database.

Until we get this working I would advice against using the integration for Solis (or at least the hybrid model I use). Here some screenshot of the magnatude of wrong information flooding my database.

IMG_3649 Since updateing our solar plant creates almost 4kW even after midnight (and no, not near the north pole)

SCR-20240919-npnq Look at the scale of production even during night hours. Consuption numbers get affected since there is no feed into the grid so HA assumes all that energy must have been used within the house.

Let me know if you would want to takle this together. I don't have the skills to do so.

Originally posted by @kai-seipp in https://github.com/wills106/homeassistant-solax-modbus/issues/786#issuecomment-2360988280

kai-seipp commented 1 month ago

I thought It might be better not to mix these issues, so I moved it over into a new issue. These are the logs I get:

This error originated from a custom integration.

Logger: custom_components.solax_modbus
Source: custom_components/solax_modbus/__init__.py:691
integration: SolaX Inverter Modbus (documentation, issues)
First occurred: 00:38:49 (268 occurrences)
Last logged: 15:30:22

Something went wrong reading from modbus
Traceback (most recent call last):
  File "/config/custom_components/solax_modbus/__init__.py", line 691, in async_read_modbus_data
    res = await self.async_read_modbus_registers_all(group)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/solax_modbus/__init__.py", line 879, in async_read_modbus_registers_all
    data[descr.key] = descr.value_function(0, descr, data)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/solax_modbus/plugin_solis.py", line 134, in value_function_pv1_power
    return  datadict.get('pv_voltage_1', 0) * datadict.get('pv_current_1',0)
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for *: 'NoneType' and 'NoneType'
kai-seipp commented 1 month ago

Some more Logs:

This error originated from a custom integration.

Logger: custom_components.solax_modbus
Source: custom_components/solax_modbus/__init__.py:742
integration: SolaX Inverter Modbus (documentation, issues)
First occurred: 00:34:38 (14519 occurrences)
Last logged: 15:29:28

solis-sued: read failed at 0x8119: pv_voltage_1
solis-sued: read failed at 0x811a: pv_current_1
solis-sued: read failed at 0x811b: pv_voltage_2
solis-sued: read failed at 0x811c: pv_current_2
solis-sued: read failed at 0x8121: pv_total_power
This error originated from a custom integration.

Logger: pymodbus.logging
Source: custom_components/solax_modbus/__init__.py:554
integration: SolaX Inverter Modbus (documentation, issues)
First occurred: 01:42:03 (63 occurrences)
Last logged: 15:26:03

Cancel send, because not connected!
This error originated from a custom integration.

Logger: pymodbus.logging
Source: custom_components/solax_modbus/__init__.py:546
integration: SolaX Inverter Modbus (documentation, issues)
First occurred: 00:35:23 (62 occurrences)
Last logged: 15:23:18

Cancel send, because not connected!
Logger: homeassistant.components.sensor.recorder
Source: components/sensor/recorder.py:304
integration: Sensor (documentation, issues)
First occurred: 01:05:10 (6 occurrences)
Last logged: 14:40:13

Entity sensor.solis_nord_power_generation_total from integration solax_modbus has state class total_increasing, but its state is not strictly increasing. Triggered by state 192610326 (192610329.0) with last_updated set to 2024-09-18T23:03:41.474765+00:00. Please create a bug report at https://github.com/wills106/homsassistant-solax-modbus/issues
Entity sensor.solis_nord_grid_import_total from integration solax_modbus has state class total_increasing, but its state is not strictly increasing. Triggered by state 16385000 (16777316.0) with last_updated set to 2024-09-19T00:20:51.775546+00:00. Please create a bug report at https://github.com/wills106/homsassistant-solax-modbus/issues
Entity sensor.solis_sud_house_load_today from integration solax_modbus has state class total_increasing, but its state is not strictly increasing. Triggered by state 2.8 (3.0) with last_updated set to 2024-09-19T09:28:25.174444+00:00. Please create a bug report at https://github.com/wills106/homsassistant-solax-modbus/issues
Entity sensor.power_generation_yesterday_total from integration template has state class total_increasing, but its state is not strictly increasing. Triggered by state 44.7 (49.6) with last_updated set to 2024-09-19T10:14:14.967784+00:00. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+template%22
Entity sensor.solis_nord_power_generation_today from integration solax_modbus has state class total_increasing, but its state is not strictly increasing. Triggered by state 10.3 (11.2) with last_updated set to 2024-09-19T12:36:41.915046+00:00. Please create a bug report at https://github.com/wills106/homsassistant-solax-modbus/issues
This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/solax_modbus/__init__.py:460
integration: SolaX Inverter Modbus (documentation, issues)
First occurred: 00:35:23 (1273 occurrences)
Last logged: 11:03:31

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/config/custom_components/solax_modbus/__init__.py", line 409, in _refresh
    await self.async_refresh_modbus_data(interval_group, _now)
  File "/config/custom_components/solax_modbus/__init__.py", line 460, in async_refresh_modbus_data
    for group in interval_group.device_groups.values():
RuntimeError: dictionary changed size during iteration
This error originated from a custom integration.

Logger: custom_components.solax_modbus
Source: custom_components/solax_modbus/__init__.py:710
integration: SolaX Inverter Modbus (documentation, issues)
First occurred: 07:30:24 (10 occurrences)
Last logged: 07:30:24

Solis-Nord: read failed at 0xa89e: timed_charge_end_minutes_3
Solis-Nord: read failed at 0xa89f: timed_discharge_start_hours_3
Solis-Nord: read failed at 0xa8a0: timed_discharge_start_minutes_3
Solis-Nord: read failed at 0xa8a1: timed_discharge_end_hours_3
Solis-Nord: read failed at 0xa8a2: timed_discharge_end_minutes_3
Traceback (most recent call last):
  File "/config/custom_components/solax_modbus/__init__.py", line 710, in treat_address
    val = decoder.decode_16bit_uint()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pymodbus/payload.py", line 373, in decode_16bit_uint
    return unpack(fstring, handle)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^
struct.error: unpack requires a buffer of 2 bytes
kai-seipp commented 1 month ago

The last working Version is 2024.01.08

wills106 commented 1 month ago

To save looking for it again Inverter is "110CA2" #786 Potential difference between C2 and C92? Need to find who submitted 10CA92 to see if they are experiencing the same issue.

Also check for differences between 2024.09x and 2024.01.8

wills106 commented 1 month ago

I thought It might be better not to mix these issues, so I moved it over into a new issue. These are the logs I get:

This error originated from a custom integration.

Logger: custom_components.solax_modbus
Source: custom_components/solax_modbus/__init__.py:691
integration: SolaX Inverter Modbus (documentation, issues)
First occurred: 00:38:49 (268 occurrences)
Last logged: 15:30:22

Something went wrong reading from modbus
Traceback (most recent call last):
  File "/config/custom_components/solax_modbus/__init__.py", line 691, in async_read_modbus_data
    res = await self.async_read_modbus_registers_all(group)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/solax_modbus/__init__.py", line 879, in async_read_modbus_registers_all
    data[descr.key] = descr.value_function(0, descr, data)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/solax_modbus/plugin_solis.py", line 134, in value_function_pv1_power
    return  datadict.get('pv_voltage_1', 0) * datadict.get('pv_current_1',0)
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for *: 'NoneType' and 'NoneType'

886 Also getting this issue but on a different Solis Inverter and using a different adaptor.

@kai-seipp You seem to be getting a lot of communication errors. Are you using terminating resistors on your wiring setup? There is a description of them in the Sofar - Installation You also need them on SolaX Inverters Inverters when daisy chaining them on the RS485 connection. https://github.com/wills106/homeassistant-solax-modbus/issues/743#issuecomment-1962988181

Integration 2024.01.8 wasn't using async for the communications. Which newer versions are. async works a lot quicker. So possibly more likely to be unhappy with communication errors.

Can you also share the Firmware version of your Waveshare? I know another Inverter brand was having issues with an older Firmware version and get resolved with an update. But I can't find that issue thread yet. I'll try and find it.

Also it would be worthwhile sharing your Waveshare settings being used, in case another user can spot an issue with a setting being not optimal.

ececconi99 commented 1 month ago

I'm now getting lots of "entity is currently unavailable" with my HA setup. I have a Solis inverter talking to HA via an Elfin Rs485/WIFI

i-jk commented 1 month ago

Yeah I think there are a few issues overlapping here.

The issue with the commits after January in #786 that broke the energy mode switch is critical. I do wonder if we have two inverter versions out there now since the people that committed those changes don't seem to be complaining.

Either way, for this issue (the only one I'm personally affected by) I'm running 2024.04.2 but with the lines of code relating to the mode selector reverted per my comment https://github.com/wills106/homeassistant-solax-modbus/issues/786#issuecomment-2052289776

I don't dare update the module because it will break everything. My recommendation is to revert these lines that that broke it ASAP and then find out who, if anyone complains. If they do we know there are new inverter versions but at least the original cohort will have a working integration again and we can proceed from there.

Finally, to reiterate my point about the crazy names these modes have acquired - they are too long to be useful and are stating the obvious in many cases. E.g Self-Use - No Timed Charge/Discharge should just be Self-Use - it's crystal clear you won't be running timed charge/discharge when you're in self use.

@wills106 if you broadly agree with all this I can try to submit a patch or PR - I have some more time than earlier this year. But either way let's agree a plan and get going so we can restore this integration's viability for Solis users :+1: