From 29726e215c3f16a8e088f8a0b9e51402b1d3617d Mon Sep 17 00:00:00 2001 From: Doug Culnane Date: Wed, 19 Apr 2023 07:23:30 +0200 Subject: [PATCH 1/4] [renault] update default Kamereon API Key Signed-off-by: Doug Culnane --- .../openhab/binding/renault/internal/RenaultConfiguration.java | 2 +- .../src/main/resources/OH-INF/thing/thing-types.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/RenaultConfiguration.java b/bundles/org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/RenaultConfiguration.java index 0c7d5de696e28..7bb3fbe8385b0 100644 --- a/bundles/org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/RenaultConfiguration.java +++ b/bundles/org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/RenaultConfiguration.java @@ -28,5 +28,5 @@ public class RenaultConfiguration { public String vin = ""; public int refreshInterval = 10; public int updateDelay = 30; - public String kamereonApiKey = "VAX7XYKGfa92yMvXculCkEFyfZbuM7Ss"; + public String kamereonApiKey = "YjkKtHmGfaceeuExUDKGxrLZGGvtVS0J"; } diff --git a/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml index 4923fb474ae06..d0464df81e6b4 100644 --- a/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml @@ -94,7 +94,7 @@ Access code for MyRenault Services. - VAX7XYKGfa92yMvXculCkEFyfZbuM7Ss + YjkKtHmGfaceeuExUDKGxrLZGGvtVS0J From 5894c15fcb561ec5397d8f22af1b830c96589f91 Mon Sep 17 00:00:00 2001 From: Doug Culnane Date: Sat, 17 Jun 2023 11:20:47 +0200 Subject: [PATCH 2/4] [renault] Support for MyDacia accounts and Dacia Spring car Signed-off-by: Doug Culnane --- bundles/org.openhab.binding.renault/README.md | 3 ++- .../binding/renault/internal/RenaultConfiguration.java | 1 + .../renault/internal/api/MyRenaultHttpSession.java | 4 ++-- .../src/main/resources/OH-INF/thing/thing-types.xml | 9 ++++++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.binding.renault/README.md b/bundles/org.openhab.binding.renault/README.md index 66352f2737752..4b6e35efc32a4 100644 --- a/bundles/org.openhab.binding.renault/README.md +++ b/bundles/org.openhab.binding.renault/README.md @@ -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. @@ -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). | | diff --git a/bundles/org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/RenaultConfiguration.java b/bundles/org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/RenaultConfiguration.java index 7bb3fbe8385b0..7882f1191dc69 100644 --- a/bundles/org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/RenaultConfiguration.java +++ b/bundles/org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/RenaultConfiguration.java @@ -22,6 +22,7 @@ @NonNullByDefault public class RenaultConfiguration { + public String accountType = "MYRENAULT"; public String myRenaultUsername = ""; public String myRenaultPassword = ""; public String locale = ""; diff --git a/bundles/org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/api/MyRenaultHttpSession.java b/bundles/org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/api/MyRenaultHttpSession.java index ac74fbe5e9490..701f07fd1c18b 100644 --- a/bundles/org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/api/MyRenaultHttpSession.java +++ b/bundles/org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/api/MyRenaultHttpSession.java @@ -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!"); } } diff --git a/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml index d0464df81e6b4..52e5d1a3e1623 100644 --- a/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml @@ -34,7 +34,14 @@ - + + + + + + + MYRENAULT + From 37dd54733f48919533fc7d25e35960063a7eacac Mon Sep 17 00:00:00 2001 From: Doug Culnane <32482395+dougculnane@users.noreply.github.com> Date: Sat, 17 Jun 2023 12:25:04 +0200 Subject: [PATCH 3/4] Update bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml Co-authored-by: Jacob Laursen Signed-off-by: Doug Culnane <32482395+dougculnane@users.noreply.github.com> --- .../src/main/resources/OH-INF/thing/thing-types.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml index 52e5d1a3e1623..876637a5ef13a 100644 --- a/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml @@ -34,7 +34,7 @@ - + From 3652e26a4ce492d09b2d5ba541256054af7aac77 Mon Sep 17 00:00:00 2001 From: Doug Culnane Date: Sat, 17 Jun 2023 12:30:39 +0200 Subject: [PATCH 4/4] [renault] mvn i18n:generate-default-translations. Signed-off-by: Doug Culnane --- .../src/main/resources/OH-INF/i18n/renault.properties | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/i18n/renault.properties b/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/i18n/renault.properties index 789a0220685a9..33a199e16bccb 100644 --- a/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/i18n/renault.properties +++ b/bundles/org.openhab.binding.renault/src/main/resources/OH-INF/i18n/renault.properties @@ -10,6 +10,9 @@ thing-type.renault.car.description = A MyRenault registered car. # thing types config +thing-type.config.renault.car.accountType.label = Account Type +thing-type.config.renault.car.accountType.option.MYDACIA = MyDacia +thing-type.config.renault.car.accountType.option.MYRENAULT = MyRenault thing-type.config.renault.car.kamereonApiKey.label = Kamereon API Key thing-type.config.renault.car.kamereonApiKey.description = Access code for MyRenault Services. thing-type.config.renault.car.locale.label = MyRenault Location @@ -62,7 +65,6 @@ channel-type.renault.chargingmode.label = Charging Mode channel-type.renault.chargingmode.state.option.UNKNOWN = Unknown channel-type.renault.chargingmode.state.option.SCHEDULE_MODE = Schedule mode channel-type.renault.chargingmode.state.option.ALWAYS_CHARGING = Instant charge -channel-type.renault.pause.label = Pause channel-type.renault.chargingremainingtime.label = Charging Time Remaining channel-type.renault.chargingstatus.label = Charging Status channel-type.renault.chargingstatus.state.option.NOT_IN_CHARGE = Not charging @@ -86,13 +88,15 @@ channel-type.renault.hvactargettemperature.label = HVAC Target Temperature channel-type.renault.hvactargettemperature.description = HVAC target temperature (19 to 21) channel-type.renault.image.label = Image URL channel-type.renault.image.description = Image URL of MyRenault -channel-type.renault.locationupdated.label = Location Update +channel-type.renault.locationupdated.label = Location Updated channel-type.renault.locationupdated.description = Timestamp of the last location update channel-type.renault.locationupdated.state.pattern = %1$tH:%1$tM %1$td.%1$tm.%1$tY channel-type.renault.locked.label = Locked channel-type.renault.locked.description = Locked status of the car channel-type.renault.odometer.label = Odometer channel-type.renault.odometer.description = Total distance travelled +channel-type.renault.pause.label = Pause Charge +channel-type.renault.pause.description = Pause or resume the charge. channel-type.renault.plugstatus.label = Plug Status channel-type.renault.plugstatus.description = Status of charging plug. channel-type.renault.plugstatus.state.option.UNPLUGGED = Unplugged