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

[modbus.sungrow] Added some more registers #18364

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tscholand
Copy link

[modbus.sungrow] Added some more registers

This is my first contribution to openhab and my first work with modbus.

Description

I added some registers, among others (power flow state, mppt3 and mppt4 and some more), using the documentation "Communication Protocol of Residential Hybrid Inverter V1.1.5".

This should fix issue #17486

Testing

We need to get some positive testing feedback from people, who use the current version of the addon, as I am not 100% sure, if querying the added registers might produce errors or even render the addon unusable for them.

Testing can be done with the jar at https://github.com/tscholand/openhab-addons/releases/download/TESTING/org.openhab.binding.modbus.sungrow-5.0.0-SNAPSHOT.jar

@tscholand tscholand requested a review from soenkekueper as a code owner March 5, 2025 22:42
@tscholand
Copy link
Author

Ok, I just realized, that the checks didn't succeed. I guess, I will have to look into the problems, before this should be reviewed.

@tscholand tscholand marked this pull request as draft March 5, 2025 22:52
@tscholand tscholand force-pushed the sungrow_additions branch from 5192e2e to b253c19 Compare March 7, 2025 17:02
@tscholand
Copy link
Author

I fixed the errors stated by the build pipeline.

@tscholand tscholand marked this pull request as ready for review March 7, 2025 17:07
@lsiepel lsiepel added the enhancement An enhancement or new feature for an existing add-on label Mar 8, 2025
Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks you for your contribution. There are some minor comments to fix. Besides the added registers, there are more changes (like default poll interval) could you list the changes clearly in the start post? It's ok for now, but we usually prefer to have the changes seperated, it makes it easier to backport changes, improve review speed and it improve the release notes / documentation.

As some channels are removed and others are added, this PR also needs upgrade instructions. For reference: https://www.openhab.org/docs/developer/bindings/thing-xml.html#updating-thing-types You could also inspect a binding (like plugwiseha) to see how it works.


## Supported Inverters

As defined within the spec mentioned above the following inverters are supported, but not all are tested yet:

- SH3K6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these devices removed on purpose?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is not used anywhere is it? Better to remove.

/**
* Defines methods for mapping a given value (from the registers) to a corresponding String.
*
* @author Tim <[email protected]>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @author Tim <tim.scholand@gmail.com>
* @author Tim Scholand - Initial contribution

* This mapper implements {@link ToStringMapper} and maps the hex codes of the sungrow modbus register to the human
* readable device names.
*
* @author Tim <[email protected]>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @author Tim <tim.scholand@gmail.com>
* @author Tim Scholand - Initial contribution

* This mapper implements {@link ToStringMapper} and maps the integer codes of the sungrow modbus register to the human
* readable DRM states.
*
* @author Tim <[email protected]>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @author Tim <tim.scholand@gmail.com>
* @author Tim Scholand - Initial contribution

</channel-type>
<channel-type id="sg-power-flow-status-pv-power" advanced="true">
<item-type>Switch</item-type>
<label>Power Flow Status - Power generated from PV</label>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please adjust the labels to 2-3 words, 23 chars and capitalized words. Applies to all channels.

Some labels could just be copy pasted to a description tag.

Comment on lines +407 to +438
<!--
<channel-type id="sg-meter-phase-a-active-power" advanced="true">
<item-type>Number:Power</item-type>
<label>Meter Phase A Active Power</label>
<category>Energy</category>
<tags>
<tag>Measurement</tag>
<tag>Power</tag>
</tags>
<state pattern="%.2f %unit%" readOnly="true"/>
</channel-type>
<channel-type id="sg-meter-phase-b-active-power" advanced="true">
<item-type>Number:Power</item-type>
<label>Meter Phase B Active Power</label>
<category>Energy</category>
<tags>
<tag>Measurement</tag>
<tag>Power</tag>
</tags>
<state pattern="%.2f %unit%" readOnly="true"/>
</channel-type>
<channel-type id="sg-meter-phase-c-active-power" advanced="true">
<item-type>Number:Power</item-type>
<label>Meter Phase C Active Power</label>
<category>Energy</category>
<tags>
<tag>Measurement</tag>
<tag>Power</tag>
</tags>
<state pattern="%.2f %unit%" readOnly="true"/>
</channel-type>
-->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop or use

<label>Export Limit Max</label>
<category>Energy</category>
<tags>
<tag>Power</tag>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either two or no tags are expected. In this case i think it should be removed.

<label>BDC Rated Power</label>
<category>Energy</category>
<tags>
<tag>Power</tag>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either two or no tags are expected. In this case i think it should be removed.

<label>Max. Discharging Current (BMS)</label>
<category>Energy</category>
<tags>
<tag>Current</tag>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either two or no tags are expected. In this case i think it should be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants