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] Adjust to evcc version 0.123.1 #16114

Merged
merged 24 commits into from
Feb 5, 2024
Merged

Conversation

lucaarn
Copy link
Contributor

@lucaarn lucaarn commented Dec 25, 2023

After the update to evcc version 0.123.0 the structure of the api changed:

  • url for limit energy and soc changed
  • minimum soc and a plan are not longer part of the loadpoint
    -> Instead of that there is a new endpoint for the vehicles, where you can setup a plan with a plan limit soc and a plan time as well as a vehicle specific minimum soc

In order to fit the new api I fixed some issues and implemented a vehicle object. It is possible that the api focusses with coming version even more on vehicles than the loadpoints.

Fixes #16098

Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
660 York Street, Suite 102,
San Francisco, CA 94110 USA

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

org.openhab.binding.evcc-4.2.0-SNAPSHOT.zip

… 0.123.1

Signed-off-by: Luca Arnecke <luca@arnecke.name>
Signed-off-by: Luca Arnecke <luca@arnecke.name>
Signed-off-by: Luca Arnecke <luca@arnecke.name>
Signed-off-by: Luca Arnecke <luca@arnecke.name>
… new implementation of minSoC and plans (served by new api)

Signed-off-by: Luca Arnecke <luca@arnecke.name>
Signed-off-by: Luca Arnecke <luca@arnecke.name>
Copy link
Contributor

@florian-h05 florian-h05 left a comment

Choose a reason for hiding this comment

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

Thank you for your PR, and thanks for updating the binding.

I’ve stopped keeping up with evcc‘s API change because I unfortunately I never started using evcc in production - blame the manufacturer of my wallbox because the announced Web API was never released.

Code looks good in general, please have a look at my comments.

@florian-h05 florian-h05 changed the title [EVCC] updated binding to support evcc version 0.123.1 [evcc] Adjust to evcc version 0.123.1 Dec 27, 2023
@florian-h05 florian-h05 added the enhancement An enhancement or new feature for an existing add-on label Dec 27, 2023
Signed-off-by: Luca Arnecke <luca@arnecke.name>
Copy link
Contributor

@florian-h05 florian-h05 left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my review!

I have a few (final) comments:

Signed-off-by: Luca Arnecke <luca@arnecke.name>
Signed-off-by: Luca Arnecke <luca@arnecke.name>
Copy link
Contributor

@florian-h05 florian-h05 left a comment

Choose a reason for hiding this comment

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

We are getting close to the finish line!
At least from my review perspective, the add-on maintainers also have to take a look at this.

lucaarn and others added 2 commits December 28, 2023 23:26
Signed-off-by: Luca Arnecke <luca@arnecke.name>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Copy link
Contributor

@florian-h05 florian-h05 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks and congratulations to your first contribution!

IMHO this is ready to get merged.
@jlaur Can you please have a look or are you busy?

@lucaarn FYI I have just pushed a small commit to re-arrange the thing-types.xml regarding the comment I requested.

MikeTheTux

This comment was marked as resolved.

@MikeTheTux
Copy link
Contributor

There are 2 findings open. After addressing those, we should be ready to go from my perspective.
I would like to get this one done in order to move forward with #15744 as well as #15644.

Signed-off-by: Michael Weger <weger.michael@gmx.net>
Signed-off-by: Michael Weger <weger.michael@gmx.net>
@MikeTheTux
Copy link
Contributor

MikeTheTux commented Jan 31, 2024

@lucaarn, I proposed a check-in in order to fix the loadpoint-vehicleName channel:

The API parameter is called vehicleName, not vehicleTitle:
image

vehicleName is the former "vehicle-id", vehicleTitle is "<vehicleName>.vehicleTitle"

With this change we loose again the shared channel type between loadpoint and vehicle, but I guess this make sense in order to highlight the differences between the two channels and to align with the official API.

Signed-off-by: Michael Weger <weger.michael@gmx.net>
@MikeTheTux
Copy link
Contributor

In order to automatize the upgrade efforts, upgrade instructions shall be implemented:
https://www.openhab.org/docs/developer/bindings/thing-xml.html#updating-thing-types

They will also make the removeChannel calls redundant:

removeChannel(CHANNEL_LOADPOINT_HAS_VEHICLE, channelGroup);
removeChannel("minSoC", channelGroup);
removeChannel("targetEnergy", channelGroup);
removeChannel("targetSoC", channelGroup);
removeChannel("targetTime", channelGroup);
removeChannel("targetTimeEnabled", channelGroup);

@florian-h05
Copy link
Contributor

For Things with statically defined channels in the thing-type.xml upgrade instructions should be provided, but the evcc binding dynamically creates the channels from the code, so no upgrade instructions are needed and they also wouldn’t work I think.

Copy link
Contributor

@florian-h05 florian-h05 left a comment

Choose a reason for hiding this comment

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

Thanks, just a few minor comments:

@florian-h05
Copy link
Contributor

@MikeTheTux Can you please regenerate the default translations?
mvn i18n:generate-default-translations -pl :org.openhab.binding.evcc

Signed-off-by: Michael Weger <weger.michael@gmx.net>
@MikeTheTux
Copy link
Contributor

@MikeTheTux Can you please regenerate the default translations? mvn i18n:generate-default-translations -pl :org.openhab.binding.evcc

done

@MikeTheTux
Copy link
Contributor

For Things with statically defined channels in the thing-type.xml upgrade instructions should be provided, but the evcc binding dynamically creates the channels from the code, so no upgrade instructions are needed and they also wouldn’t work I think.

agree. the current implementation removing outdated channels is the way to go

@MikeTheTux
Copy link
Contributor

I think I'm done from my end.
Who could do a final review and merge?

@florian-h05
Copy link
Contributor

I can do a review, but since I am only the evcc binding maintainer and no add-ons maintainer I cannot merge.
After my review, I will ping the add-on maintainers, they can then either do their own review or trust my review.

Signed-off-by: Michael Weger <weger.michael@gmx.net>
Copy link
Contributor

@florian-h05 florian-h05 left a comment

Choose a reason for hiding this comment

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

Overall LGTM, just some minor findings:

Signed-off-by: Michael Weger <weger.michael@gmx.net>
Signed-off-by: Michael Weger <weger.michael@gmx.net>
@MikeTheTux
Copy link
Contributor

MikeTheTux commented Feb 4, 2024

In the meanwhile I implemented #15744 on-top of this branch.
The impact on the channel handling is quite big.

Shall I ...

  1. commit my changes into this PR?
    1.1. Pro: single manual migration efforts for the users
    1.2. Con: potential merge of this PR gets even further delayed
  2. create a parallel PR?
  3. wait until this PR is merged and then create a new PR?

Copy link
Contributor

@florian-h05 florian-h05 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@openhab/add-ons-maintainers Can you please review and merge this PR? I already did a full review as the evcc add-on maintainer.

@florian-h05
Copy link
Contributor

Please go for 3.

What really speaks against 1 is IMO that this PR is not really your PR, and it is already pretty big and want to avoid it growing bigger.

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.

Besides this i18n comment, also note that some channels are removed and it depends on an external software upgrade. That makes this PR a breaking change. Please create a warning message at the openHAB distro repo to warn users when upgrading.

@lsiepel lsiepel merged commit b316096 into openhab:main Feb 5, 2024
3 checks passed
@lsiepel lsiepel added this to the 4.2 milestone Feb 5, 2024
austvik pushed a commit to austvik/openhab-addons that referenced this pull request Mar 27, 2024
* updated url of setTargetEnergy and setTargetSoC to match evcc version 0.123.1
* removed minSoc from Loadpoint (since evcc 0.123.0 part of vehicle)
* renamed from targetEnergy to limitEnergy to match new evcc version
* renamed from targetSoC to limitSoC to match new evcc version
* plementation of vehicle object to match new evcc version 0.123.1 -> new implementation of minSoC and plans (served by new api)

Signed-off-by: Luca Arnecke <luca@arnecke.name>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Michael Weger <weger.michael@gmx.net>
Co-authored-by: Florian Hotze <florianh_dev@icloud.com>
Co-authored-by: Michael Weger <weger.michael@gmx.net>
Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
florian-h05 pushed a commit to florian-h05/openhab-addons that referenced this pull request May 30, 2024
* updated url of setTargetEnergy and setTargetSoC to match evcc version 0.123.1
* removed minSoc from Loadpoint (since evcc 0.123.0 part of vehicle)
* renamed from targetEnergy to limitEnergy to match new evcc version
* renamed from targetSoC to limitSoC to match new evcc version
* plementation of vehicle object to match new evcc version 0.123.1 -> new implementation of minSoC and plans (served by new api)

Signed-off-by: Luca Arnecke <luca@arnecke.name>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Michael Weger <weger.michael@gmx.net>
Co-authored-by: Florian Hotze <florianh_dev@icloud.com>
Co-authored-by: Michael Weger <weger.michael@gmx.net>
(cherry picked from commit b316096)
@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/evcc-binding-electric-vehicle-charging-control-backport-4-1-0-4-2-0/135209/1

joni1993 pushed a commit to joni1993/openhab-addons that referenced this pull request Oct 15, 2024
* updated url of setTargetEnergy and setTargetSoC to match evcc version 0.123.1
* removed minSoc from Loadpoint (since evcc 0.123.0 part of vehicle)
* renamed from targetEnergy to limitEnergy to match new evcc version
* renamed from targetSoC to limitSoC to match new evcc version
* plementation of vehicle object to match new evcc version 0.123.1 -> new implementation of minSoC and plans (served by new api)

Signed-off-by: Luca Arnecke <luca@arnecke.name>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Michael Weger <weger.michael@gmx.net>
Co-authored-by: Florian Hotze <florianh_dev@icloud.com>
Co-authored-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
enhancement An enhancement or new feature for an existing add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EVCC] API changed from loadpoint to vehicles
5 participants