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

[renault] Add support for MyDacia accounts and Dacia Spring car #15101

Merged
merged 6 commits into from
Jun 17, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bundles/org.openhab.binding.renault/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The binding translates the [python based renault-api](https://renault-api.readth

## Supported Things

Supports MyRenault registered cars with an active Connected-Services account.
Supports MyRenault (and MyDacia) registered cars with an active Connected-Services account.

This binding can only retrieve information that is available in the MyRenault App.

Expand All @@ -21,6 +21,7 @@ You require your MyRenault credential, locale and VIN for your MyRenault registe

| Parameter | Description | Default |
|-------------------|----------------------------------------------------------------------------|----------------------------------|
| accountType | Account Type. (MYDACIA,MYRENAULT) | MYRENAULT |
| myRenaultUsername | MyRenault Username. | |
| myRenaultPassword | MyRenault Password. | |
| locale | MyRenault Location (language_country). | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
@NonNullByDefault
public class RenaultConfiguration {

public String accountType = "MYRENAULT";
public String myRenaultUsername = "";
public String myRenaultPassword = "";
public String locale = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,14 @@ private void getAccountID()
if (responseJson != null) {
JsonArray accounts = responseJson.getAsJsonArray("accounts");
for (int i = 0; i < accounts.size(); i++) {
if (accounts.get(i).getAsJsonObject().get("accountType").getAsString().equals("MYRENAULT")) {
if (accounts.get(i).getAsJsonObject().get("accountType").getAsString().equals(config.accountType)) {
kamereonaccountId = accounts.get(i).getAsJsonObject().get("accountId").getAsString();
break;
}
}
}
if (kamereonaccountId == null) {
throw new RenaultException("Can not get Kamereon MyRenault Account ID!");
throw new RenaultException("Can not get Kamereon " + config.accountType + " Account ID!");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@
</properties>

<config-description>

<parameter name="accountType" type="text" required="true">
dougculnane marked this conversation as resolved.
Show resolved Hide resolved
<label>Account Type</label>
<options>
<option value="MYDACIA">MyDacia</option>
<option value="MYRENAULT">MyRenault</option>
</options>
<default>MYRENAULT</default>
</parameter>
<parameter name="myRenaultUsername" type="text" required="true">
<label>MyRenault Username</label>
</parameter>
Expand Down