mkaiser / Sungrow-SHx-Inverter-Modbus-Home-Assistant

Sungrow SH Integration for Home Assistant for SH3K6, SH4K6, SH5K-20, SH5K-V13, SH3K6-30, SH4K6-30, SH5K-30, SH3.RS, SH3.6RS, SH4.0RS, SH5.0RS, SH6.0RS, SH5.0RT, SH6.0RT, SH8.0RT, SH10RT, SH5.0RT-20, SH6.0RT-20, SH8.0RT-20, SH10RT-20, SH5.0RT-V112, SH6.0RT-V112, SH8.0RT-V112, SH10RT-V112, SH5.0RT-V122, SH6.0RT-V122, SH8.0RT-V122, SH10RT-V122, SH4.6R
342 stars 92 forks source link

Undocumented Holding Registers destroys SH10RT Config #283

Open DemigodCode opened 5 months ago

DemigodCode commented 5 months ago

Before you create an issue, make sure to update to the current version of modbus_sungrow.yaml

Describe the bug:

The undocumented holding registers of the Inverters destroys the configuration of my inverter. If I use one of them, they are overwritting a couple of settings and make the inverter not discharge the battery anymore until I load configuration defaults of the inverter. The holding register discharge is not the same as the input register one. It seems like it's destroyed after changing the min soc too.

Model: SH-10.RT v112

Home Assistant version:

modbus_sungrow.yaml:

Inverter Firmware Status:

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Overview'
  2. Scroll down to 'Helpers'
  3. Set max battery discharge power

Expected behavior They should be marked as EXPERIMENTAL... That took me so much of my time to figure out what the problem is and what it did change.

Screenshots image image

mkaiser commented 5 months ago

Hi,

sorry to hear that!

Could you describe in more detail what happened? Strange thing is that I recently installed one SH10.RT rev112 myself for a friend. All the set* functions worked fine via GUI sliders.

I will make some updates soon and ensure to write a comment on each undocumented sensor. In the current version 1.1.2 of the modbus procotoll documentation the max charging and discharging power parameters are now documented. So they should not cause your issues.

image

This leaves following registers as possible culprits:

Could you test max charging and discharging registers?

Was anything regarding the other registers in the HA log files?

DemigodCode commented 5 months ago

Can I somehow back up all settings using modbus?

I only have a user iSolarCloud account so I cannot back them up there and don't want to have my electrician to set it up again. ;-)

Don't know which parameter caused this. And don't know how to figure out.

If I change a parameter through modbus does it send the whole configuration again or the parameter to change only? I don't have much knowledge about the modbus protocol.

Do you have an idea why the holding register values differs to the other one?

mkaiser commented 5 months ago

unfortunately, its not easily possible via modbus (possible, but involves some work).

it is easier via isolarcloud: you can backup the current settings by logging in to isolarcloud via installers account. if you don't have one, create one with another email address. Sungrow does not check, if it is an anctual company behind installers accounts or not.

I assume the set parameters from the installers are

DemigodCode commented 5 months ago

Okay, I've got the time to set up a anstaller account and to create a template of my parameters.

But in HomeAssistant it's like it's not reading the parameters as it should. Logs look like that:

` 2024-05-04 22:06:02.836 WARNING (MainThread) [homeassistant.components.modbus.modbus] modbus SungrowSHx communication closed 2024-05-04 22:06:03.062 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ (states('sensor.total_imported_energy_cost')) | float |round(2) }}) renders=2> Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1984, in forgiving_float_filter return float(value) ^^^^^^^^^^^^ ValueError: could not convert string to float: 'unknown'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 567, in async_render render_result = _render_with_context(self.template, compiled, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2305, in _render_with_context return template.render(kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render self.environment.handle_exception() File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception raise rewrite_traceback_stack(source=source) File "