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

[evcc] Fix API change on duration channels #17528

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

MikeTheTux
Copy link
Contributor

@MikeTheTux MikeTheTux commented Oct 8, 2024

[evcc] API change on duration channels

Since EVCC version 0.127.0 (evcc-io/evcc#13319) the EVCC Rest API duration states are in seconds instead of nanoseconds.

Current EVCC implementation still treats them as Nano-Seconds. E.g.:

        long chargeDuration = loadpoint.getChargeDuration();
        channel = new ChannelUID(uid, channelGroup, CHANNEL_LOADPOINT_CHARGE_DURATION);
        updateState(channel, new QuantityType<>(chargeDuration, MetricPrefix.NANO(Units.SECOND)));

Fixes the following issues:

Signed-off-by: Michael Weger <weger.michael@gmx.net>
@MikeTheTux MikeTheTux added the bug An unexpected problem or unintended behavior of an add-on label Oct 8, 2024
@lsiepel
Copy link
Contributor

lsiepel commented Oct 8, 2024

This change looks fine, but it also makes me wonder if we can implement some kind of schema versioning.
As currently the binding mainly supports one evcc version, all users need to be at the same version of both binding and evcc to make it work. Would be nice if we can somehow detect the evcc version and act on it. wdyt?

@MikeTheTux
Copy link
Contributor Author

EVCC status API provides the version info, e.g. "version":"0.130.13". This could be used to support different versions in parallel. Nevertheless, I fear that I will not be able to implement such a feature in the near future.

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, LGTM.

Regarding the versioning, fully understand this is time consuming, good to knwo there is a version string we can depend on. Implementing schema verisoning is not that simple if the remote API hardly supports generic/dynamic structures.

@lsiepel lsiepel merged commit 18ae995 into openhab:main Oct 8, 2024
5 checks passed
@lsiepel lsiepel added this to the 4.3 milestone Oct 8, 2024
lsiepel pushed a commit that referenced this pull request Oct 8, 2024
Signed-off-by: Michael Weger <weger.michael@gmx.net>
@lsiepel lsiepel added the patch A PR that has been cherry-picked to a patch release branch label Oct 8, 2024
@lsiepel lsiepel changed the title [evcc] API change on duration channels [evcc] Fix API change on duration channels Oct 8, 2024
fabgio pushed a commit to fabgio/openhab-addons that referenced this pull request Oct 11, 2024
Signed-off-by: Michael Weger <weger.michael@gmx.net>
joni1993 pushed a commit to joni1993/openhab-addons that referenced this pull request Oct 15, 2024
Signed-off-by: Michael Weger <weger.michael@gmx.net>
matchews pushed a commit to matchews/openhab-addons that referenced this pull request Oct 18, 2024
Signed-off-by: Michael Weger <weger.michael@gmx.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on patch A PR that has been cherry-picked to a patch release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[evcc] API change on duration channels [evcc] "Ladedauer" and "Verbleibende Ladedauer" not working
2 participants