]> git.basschouten.com Git - openhab-addons.git/commitdiff
[renault] Add support for MyDacia accounts and Dacia Spring car (#15101)
authorDoug Culnane <32482395+dougculnane@users.noreply.github.com>
Sat, 17 Jun 2023 10:46:01 +0000 (12:46 +0200)
committerGitHub <noreply@github.com>
Sat, 17 Jun 2023 10:46:01 +0000 (12:46 +0200)
* [renault] Support for MyDacia accounts and Dacia Spring car

Signed-off-by: Doug Culnane <doug@culnane.net>
bundles/org.openhab.binding.renault/README.md
bundles/org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/RenaultConfiguration.java
bundles/org.openhab.binding.renault/src/main/java/org/openhab/binding/renault/internal/api/MyRenaultHttpSession.java
bundles/org.openhab.binding.renault/src/main/resources/OH-INF/i18n/renault.properties
bundles/org.openhab.binding.renault/src/main/resources/OH-INF/thing/thing-types.xml

index 66352f2737752d67ffd1e4088f5feb1d6c603543..4b6e35efc32a4b56b97ac957311c247e9773b42d 100644 (file)
@@ -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).                                     |                                  |
index 7bb3fbe8385b05b5b3c31e8bb4c66c09515e45de..7882f1191dc69b14c71426b80abfe0b676bfe627 100644 (file)
@@ -22,6 +22,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
 @NonNullByDefault
 public class RenaultConfiguration {
 
+    public String accountType = "MYRENAULT";
     public String myRenaultUsername = "";
     public String myRenaultPassword = "";
     public String locale = "";
index ac74fbe5e94902248025480cf60ce0d55f5acca2..701f07fd1c18be4e7838f1a509b95fd9d36b851d 100644 (file)
@@ -192,14 +192,14 @@ public class MyRenaultHttpSession {
         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!");
         }
     }
 
index 789a0220685a990a0f0ce10257082543ce2bb480..33a199e16bccba56d6980d9c122b2a36727a4f2f 100644 (file)
@@ -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
index d0464df81e6b4ec022c7fa51537f0f3734a9858b..876637a5ef13a2be1a498ab866942c190831ad66 100644 (file)
                </properties>
 
                <config-description>
-
+                       <parameter name="accountType" type="text">
+                               <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>