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

[evnotify] Initial contribution: New binding for evnotify online service #11537

Closed
wants to merge 364 commits into from

Conversation

mischmidt83
Copy link

This binding can be used to read data for a given electric vehicle from the EVNotify online service (account). Please see https://evnotify.de.

Therefore the binding provides a vehicle thing that represents an electric vehicle and it allows the user to monitor different data from the vehicle (e.g. state of charge, state of health, etc.).

@mischmidt83 mischmidt83 requested a review from a team as a code owner November 6, 2021 19:33
@lolodomo lolodomo added the new binding If someone has started to work on a binding. For a new binding PR. label Nov 6, 2021
@mischmidt83 mischmidt83 force-pushed the evnotify branch 2 times, most recently from 1a44cf6 to 23ed953 Compare November 6, 2021 20:04
@wborn
Copy link
Member

wborn commented Nov 6, 2021

The issue with the build is probably that your project is still missing from bundles/pom.xml 😉

@mischmidt83
Copy link
Author

@wborn What are the next steps to get the binding merged? Only the single pending review? How long does it usually take?

@wborn
Copy link
Member

wborn commented Nov 8, 2021

The next step is that your PR will get reviewed and when a maintainer approves the changes the add-on is merged. 🚀

How long this all takes depends on how much code there is to review, season/holidays and how quickly review comments are processed. But from a quick scroll through your code it already looks quite good. 👍 With only 2 KLOC including DTOs and tests it should be relatively easy and fun to review. 😉

@mischmidt83
Copy link
Author

With only 2 KLOC including DTOs and tests it should be relatively easy and fun to review.

@wborn But when?

Copy link
Contributor

@lolodomo lolodomo left a comment

Choose a reason for hiding this comment

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

Review part 1 of 2

Comment on lines +44 to +46
| `rapid_charge_port` | Switch | ON if connected to a rapid charging port |
| `normal_charge_port` | Switch | ON if connected to a normal charging port |
| `slow_charge_port` | Switch | ON if connected to a slow charging port |
Copy link
Contributor

@lolodomo lolodomo Dec 28, 2021

Choose a reason for hiding this comment

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

Suggestion (not a request for change): you could have defined one unique channel for the type of charging port (rapid, normal, slow).
English detail: I am not sure "rapid" is appropriate. I would have naturally used "fast" but maybe "rapid" is correct too, I don't know.

Copy link
Author

Choose a reason for hiding this comment

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

English detail: I am not sure "rapid" is appropriate. I would have naturally used "fast" but maybe "rapid" is correct too, I don't know.

You are right, but I just reused the terminology, of the ev notify service.

Comment on lines +47 to +56
| `aux_battery_voltage` | Number | Voltage of the aux battery |
| `dc_battery_voltage` | Number | Voltage of the DC battery |
| `dc_battery_current` | Number | Current of the DC battery |
| `dc_battery_power` | Number | Power of the DC battery |
| `cumulative_energy_charged` | Number | Amount of energy that has been charged |
| `cumulative_energy_discharged` | Number | Amount of energy that has been discharged |
| `battery_min_temperature` | Number | The minimum temperature of the battery |
| `battery_max_temperature` | Number | The maximum temperature of the battery |
| `battery_inlet_temperature` | Number | The inlet temperature of the battery |
| `external_temperature` | Number | External temperature |
Copy link
Contributor

@lolodomo lolodomo Dec 28, 2021

Choose a reason for hiding this comment

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

You could certainly rather used Number with the appropriate dimension in order to let the user define the unit he would like.

| `battery_max_temperature` | Number | The maximum temperature of the battery |
| `battery_inlet_temperature` | Number | The inlet temperature of the battery |
| `external_temperature` | Number | External temperature |
| `last_extended` | String | Timestamp of the latest export | |
Copy link
Contributor

Choose a reason for hiding this comment

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

The channel name is a little strange and if the channel is a timestamps, the item type is not the good one.

Copy link
Author

Choose a reason for hiding this comment

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

Same as above: Just reused terminology of the ev notify service.

| ------------------------------ | --------- | ---------------------------------------------- |
| `soc_display` | Number | State of Charge (Display) |
| `soc_bms` | Number | State of Charge (BMS) |
| `last_soc` | String | Timestamp of the latest state of charge export |
Copy link
Contributor

Choose a reason for hiding this comment

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

If the channel is a timestamps, the item type is not the good one.

Copy link
Author

Choose a reason for hiding this comment

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

Same as above: Just reused terminology of the ev notify service.


### evnotify.items

```properties
Copy link
Contributor

Choose a reason for hiding this comment

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

You can suppress "properties".

Copy link
Author

Choose a reason for hiding this comment

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

fixed

*
* @author Michael Schmidt - Initial contribution
*/
public class ExtendedChargingDataDTO {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add @NonNullByDefault


public OffsetDateTime getLastExtended() {
return lastExtended == null ? null
: OffsetDateTime.from(Instant.ofEpochSecond(lastExtended).atZone(ZoneId.of("Europe/Berlin")));
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here with hardcoded timezone

Copy link
Author

Choose a reason for hiding this comment

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

fixed

*
* @author Michael Schmidt - Initial contribution
*/
public class EVNotifyClientImpl implements EVNotifyClient {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add @NonNullByDefault

Comment on lines 55 to 59
var basicRequest = HttpRequest.newBuilder(URI.create(String.format(BASIC_API_URL_PATTERN, akey, token)))
.header("accept", "application/json").build();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use proper type rather than "var" everywhere ?

Copy link
Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 65 to 74
BasicChargingDataDTO basicChargingDataDTO = new Gson().fromJson(basicResponse.body(),
BasicChargingDataDTO.class);

var extendedResponse = client.send(extendedRequest, HttpResponse.BodyHandlers.ofString());
validateResponse(extendedResponse);
ExtendedChargingDataDTO extendedChargingData = new Gson().fromJson(extendedResponse.body(),
ExtendedChargingDataDTO.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than instantiating the Gson object everytime, you could have one as a member of your class, instantiated in the constructor ?

Copy link
Author

Choose a reason for hiding this comment

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

fixed

@lolodomo
Copy link
Contributor

lolodomo commented Jan 8, 2022

@mischmidt83 : are you available to handle review comments ? I would like to know if I take time to do the second part of my review or not.

@mischmidt83
Copy link
Author

@mischmidt83 : are you available to handle review comments ? I would like to know if I take time to do the second part of my review or not.

@lolodomo: yes, I'm available and try answering your questions resp. fixing your suggestions. It would be nice if you can continue the review.

digitaldan and others added 2 commits January 9, 2022 23:09
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Signed-off-by: Michael Schmidt <mi.schmidt.83@gmail.com>
Move remaining channel details to the respective channels to simplify
and avoid mistakes/errors.

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
Signed-off-by: Michael Schmidt <mi.schmidt.83@gmail.com>
@lsiepel
Copy link
Contributor

lsiepel commented Jun 15, 2024

Unfortunately it looks like we cannot bring this PR to the finish line. After two years of inactivity i close this PR. If there is a need to restart, feel free to re-open or start a new PR.

@lsiepel lsiepel closed this Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback Awaiting feedback from the pull request author new binding If someone has started to work on a binding. For a new binding PR. stale As soon as a PR is marked stale, it can be removed 6 months later.
Projects
None yet
Development

Successfully merging this pull request may close these issues.