]> git.basschouten.com Git - openhab-addons.git/commitdiff
Add transaction to Go-Echarger (#13105)
authorSascha Kloß <sascha.kloss@gmx.de>
Wed, 17 Aug 2022 20:36:56 +0000 (22:36 +0200)
committerGitHub <noreply@github.com>
Wed, 17 Aug 2022 20:36:56 +0000 (22:36 +0200)
Signed-off-by: Sascha Kloß <sascha.kloss@gmx.de>
bundles/org.openhab.binding.goecharger/README.md
bundles/org.openhab.binding.goecharger/src/main/java/org/openhab/binding/goecharger/internal/GoEChargerBindingConstants.java
bundles/org.openhab.binding.goecharger/src/main/java/org/openhab/binding/goecharger/internal/api/GoEStatusResponseV2DTO.java
bundles/org.openhab.binding.goecharger/src/main/java/org/openhab/binding/goecharger/internal/handler/GoEChargerV2Handler.java
bundles/org.openhab.binding.goecharger/src/main/resources/OH-INF/i18n/goecharger.properties
bundles/org.openhab.binding.goecharger/src/main/resources/OH-INF/thing/thing-types.xml

index 34008166f792686653c2d7cd2907cfcf3f6646c3..d777fb3d73d4b068cf8a1f87384e414ba8c93143 100644 (file)
@@ -44,6 +44,7 @@ Currently available channels are
 | sessionChargeEnergyLimit | Number:Energy            | Wallbox stops charging after defined value, disable with 0    | 1 (r/w), 2 (r/w)  |
 | sessionChargedEnergy     | Number:Energy            | Amount of energy that has been charged in this session        | 1 (r), 2 (r)      |
 | totalChargedEnergy       | Number:Energy            | Amount of energy that has been charged since installation     | 1 (r), 2 (r)      |
+| transaction              | Number                   | 0 if no card, otherwise card ID                               | 2 (r/w)           |
 | allowCharging            | Switch                   | If `ON` charging is allowed                                   | 1 (r/w), 2 (r)    |
 | cableCurrent             | Number:ElectricCurrent   | Specifies the max current that can be charged with that cable | 1 (r), 2 (r)      |
 | temperature              | Number:Temperature       | Temperature of the curciuit board of the Go-eCharger          | 1 (r), 2 (r)      |
index cadc624f80691ecbac1af525ac766eada1738bc5..b05405691e03d4b328b77eb8c8fffe7e65bfa391 100644 (file)
@@ -45,6 +45,7 @@ public class GoEChargerBindingConstants {
     public static final String POWER_L2 = "powerL2";
     public static final String POWER_L3 = "powerL3";
     public static final String POWER_ALL = "powerAll";
+    public static final String TRANSACTION = "transaction";
     public static final String ALLOW_CHARGING = "allowCharging";
     public static final String CABLE_ENCODING = "cableCurrent";
     public static final String PHASES = "phases";
index 08cb88b11af9cd20c5c3ce99cf7f0ca207e7e86e..94e59216df6dac5b8522969302a308f598c0e2a1 100644 (file)
@@ -27,6 +27,9 @@ public class GoEStatusResponseV2DTO extends GoEStatusResponseBaseDTO {
     @SerializedName("psm")
     public Integer phases;
 
+    @SerializedName("trx")
+    public Integer transaction;
+
     @SerializedName("alw")
     public Boolean allowCharging;
 
index 5c75822e6e6f4babb2884b538b22f391f6583ad4..1a93df2916f36af028fba780e03e9ac3ed6fcc5e 100644 (file)
@@ -136,6 +136,11 @@ public class GoEChargerV2Handler extends GoEChargerBaseHandler {
                     default:
                 }
                 return new StringType(error);
+            case TRANSACTION:
+                if (goeResponse.transaction == null) {
+                    return UnDefType.UNDEF;
+                }
+                return new DecimalType(goeResponse.transaction);
             case ALLOW_CHARGING:
                 return goeResponse.allowCharging == true ? OnOffType.ON : OnOffType.OFF;
             case TEMPERATURE_TYPE2_PORT:
@@ -269,6 +274,11 @@ public class GoEChargerV2Handler extends GoEChargerBaseHandler {
                 if (command instanceof DecimalType) {
                     value = String.valueOf(((DecimalType) command).intValue());
                 }
+            case TRANSACTION:
+                key = "trx";
+                if (command instanceof DecimalType) {
+                    value = String.valueOf(((DecimalType) command).intValue());
+                }
         }
 
         if (key != null && value != null) {
index 063d5bf66bb90efd99b00c2369f950d8ae478a7c..ff6ce0f53563a015e08146f86d767a527afd6ad2 100644 (file)
@@ -19,6 +19,8 @@ thing-type.config.goecharger.goe.refreshInterval.description = Refresh interval
 
 # channel types
 
+channel-type.goecharger.trx.label = Transaction
+channel-type.goecharger.trx.description = 0 for no card, otherwise card ID
 channel-type.goecharger.alw.label = Allow Charging
 channel-type.goecharger.alw.description = If true charging is allowed
 channel-type.goecharger.ast.label = Access Configuration
index 42e7ef79ec2d9090677d283fef2a8204c003aac7..4fbb56988c618b0990b9adb8dca7acec58c971c7 100644 (file)
@@ -23,6 +23,7 @@
                        <channel id="powerL2" typeId="pl2"/>
                        <channel id="powerL3" typeId="pl3"/>
                        <channel id="powerAll" typeId="pAll"/>
+                       <channel id="transaction" typeId="trx"/>
                        <channel id="allowCharging" typeId="alw"/>
                        <channel id="cableCurrent" typeId="cbl"/>
                        <channel id="firmware" typeId="fmw"/>
                <description>Amount of energy that has been charged since installation</description>
                <state pattern="%.1f %unit%" readOnly="true"/>
        </channel-type>
+       <channel-type id="trx">
+               <item-type>Number</item-type>
+               <label>Transaction</label>
+               <description>0 for no card, otherwise card ID</description>
+               <state readOnly="false"/>
+       </channel-type>
        <channel-type id="alw">
                <item-type>Switch</item-type>
                <label>Allow Charging</label>