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

Undocumented Holding Registers destroys SH10RT Config #283

Open
3 tasks done
DemigodCode opened this issue Apr 12, 2024 · 8 comments
Open
3 tasks done

Undocumented Holding Registers destroys SH10RT Config #283

DemigodCode opened this issue Apr 12, 2024 · 8 comments

Comments

@DemigodCode
Copy link

DemigodCode commented Apr 12, 2024

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

  • LAN (internal port)

  • [] WiNet-S (LAN) (connected but not used for Modbus)

  • Are you using a Modbus Proxy (mark one)

    • [] yes
    • no
    • [] I don't know what that is

Home Assistant version:

  • Version: 2024.1.6

modbus_sungrow.yaml:

  • Version/ time stamp : [e.g. 2023-09-08] (see header of the file)
  • [] I ensured to use the most recent version

** Inverter Firmware Status:**

  • I made sure that the newest firmware is installed via the installers account

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
Copy link
Owner

mkaiser commented Apr 19, 2024

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:
- name: Reserved SoC for backup
- name: Battery capacity
- name: Battery charging start power
- name: Battery discharging start power

Could you test max charging and discharging registers?

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

@DemigodCode
Copy link
Author

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
Copy link
Owner

mkaiser commented Apr 22, 2024

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

  • installed PV power
  • export power limit (should be '0', meaning no power limitation)
  • battery parameters (kWh, min/max charge {power, Soc}, backup )

@DemigodCode
Copy link
Author

DemigodCode commented May 4, 2024

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 "", line 1, in top-level template code
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1987, in forgiving_float_filter
raise_no_default("float", value)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1625, in raise_no_default
raise ValueError(
ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.total_imported_energy_cost')) | float |round(2) }}' but no default was specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 693, in async_render_to_info
render_info._result = self.async_render(
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 569, in async_render
raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.total_imported_energy_cost')) | float |round(2) }}' but no default was specified
2024-05-04 22:06:03.074 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('ValueError: Template error: float got invalid input 'unknown' when rendering template '{{ (states('sensor.total_imported_energy_cost')) | float |round(2) }}' but no default was specified') while processing template 'Template<template=({{ (states('sensor.total_imported_energy_cost')) | float |round(2) }}) renders=4>' for attribute '_attr_native_value' in entity 'sensor.daily_imported_energy_cost'
2024-05-04 22:06:03.075 WARNING (MainThread) [homeassistant.components.sensor] Entity sensor.daily_exported_energy_compensation (<class 'homeassistant.components.template.sensor.SensorTemplate'>) is using native unit of measurement '€' which is not a valid unit for the device class ('energy') it is using; expected one of ['MJ', 'MWh', 'Wh', 'kWh', 'GJ']; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+template%22
`

And now to show you what the difference is:

image

image

The Min SoC looks strange too with two different values:
image
Current iSolarCloud: 10%

Am I missing something?

@mkaiser
Copy link
Owner

mkaiser commented May 6, 2024

Cannot find (states('sensor.total_imported_energy_cost')) in this repositories YAML file. I guess the error comes from somewhere else. Can you double-check?

@Gnarfoz
Copy link
Contributor

Gnarfoz commented May 6, 2024

image
image

The max battery charge / discharge entities come with a default maximum of 5000 W since @mkaiser can't know your actual battery size / parameters.
You should adjust it to match your actual battery parameters. I assume it will then display the correct value.

You can find them here: https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/blob/main/modbus_sungrow.yaml#L2325
and here: https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/blob/main/modbus_sungrow.yaml#L2331

@jbardu
Copy link

jbardu commented Jul 30, 2024

regarding installers accounts to enable advanced settings and backup @mkaiser -- I can create an installers account and login on it -- but how do I attach my existing plant to it, in order to do anything?

When I "create" a plant and then enter a serial number of the comms dongle it says (rightly) it is already taken. thanks.

@Gnarfoz
Copy link
Contributor

Gnarfoz commented Jul 30, 2024

You share the plant from your regular account to your installer account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants