]> git.basschouten.com Git - openhab-addons.git/commitdiff
[goecharger] Add awattarMaxPrice channel (#17532)
authorlsiepel <leosiepel@gmail.com>
Sat, 12 Oct 2024 18:47:48 +0000 (20:47 +0200)
committerGitHub <noreply@github.com>
Sat, 12 Oct 2024 18:47:48 +0000 (20:47 +0200)
* Add awp channel

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
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
bundles/org.openhab.binding.goecharger/src/main/resources/OH-INF/update/upgrade.xml [new file with mode: 0644]

index 71abd5d531c6edf90034d30226d6d659bcc91ee2..ec59184e444e4c1b90c6a1d7e5e974475ead46fe 100644 (file)
@@ -27,35 +27,37 @@ The apiVersion 2 is only available for go-e Charger with new hardware revision (
 
 ## Channels
 
-Currently available channels are
-| Channel ID               | Item Type                | Description                                                   | API version       |
-|--------------------------|--------------------------|---------------------------------------------------------------|-------------------|
-| maxCurrent               | Number:ElectricCurrent   | Maximum current allowed to use for charging                   | 1 (r/w), 2 (r/w)  |
-| maxCurrentTemp           | Number:ElectricCurrent   | Maximum current temporary (not written to EEPROM)             | 1 (r)             |
-| pwmSignal                | String                   | Signal status for PWM signal                                  | 1 (r), 2 (r)      |
-| error                    | String                   | Error code of charger                                         | 1 (r), 2 (r)      |
-| voltageL1                | Number:ElectricPotential | Voltage on L1                                                 | 1 (r), 2 (r)      |
-| voltageL2                | Number:ElectricPotential | Voltage on L2                                                 | 1 (r), 2 (r)      |
-| voltageL3                | Number:ElectricPotential | Voltage on L3                                                 | 1 (r), 2 (r)      |
-| currentL1                | Number:ElectricCurrent   | Current on L1                                                 | 1 (r), 2 (r)      |
-| currentL2                | Number:ElectricCurrent   | Current on L2                                                 | 1 (r), 2 (r)      |
-| currentL3                | Number:ElectricCurrent   | Current on L3                                                 | 1 (r), 2 (r)      |
-| powerL1                  | Number:Power             | Power on L1                                                   | 1 (r), 2 (r)      |
-| powerL2                  | Number:Power             | Power on L2                                                   | 1 (r), 2 (r)      |
-| powerL3                  | Number:Power             | Power on L2                                                   | 1 (r), 2 (r)      |
-| powerAll                 | Number:Power             | Power over all three phases                                   | 1 (r), 2 (r)      |
-| phases                   | Number                   | Amount of phases currently used for charging                  | 1 (r), 2 (r/w)    |
-| 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-e Charger          | 1 (r), 2 (r)      |
-| temperatureType2Port     | Number:Temperature       | Temperature of the type 2 port of the go-e Charger             | 2 (r)             |
-| firmware                 | String                   | Firmware Version                                              | 1 (r), 2 (r)      |
-| accessConfiguration      | String                   | Access configuration, for example OPEN, RFID ...              | 1 (r/w)           |
-| forceState               | Number                   | Force state  (Neutral=0, Off=1, On=2)                         | 2 (r/w)           |
+Currently available channels are:
+
+| Channel ID               | Item Type                | Description                                                   | API version      |
+|--------------------------|--------------------------|---------------------------------------------------------------|------------------|
+| maxCurrent               | Number:ElectricCurrent   | Maximum current allowed to use for charging                   | 1 (r/w), 2 (r/w) |
+| maxCurrentTemp           | Number:ElectricCurrent   | Maximum current temporary (not written to EEPROM)             | 1 (r)            |
+| pwmSignal                | String                   | Signal status for PWM signal                                  | 1 (r), 2 (r)     |
+| error                    | String                   | Error code of charger                                         | 1 (r), 2 (r)     |
+| voltageL1                | Number:ElectricPotential | Voltage on L1                                                 | 1 (r), 2 (r)     |
+| voltageL2                | Number:ElectricPotential | Voltage on L2                                                 | 1 (r), 2 (r)     |
+| voltageL3                | Number:ElectricPotential | Voltage on L3                                                 | 1 (r), 2 (r)     |
+| currentL1                | Number:ElectricCurrent   | Current on L1                                                 | 1 (r), 2 (r)     |
+| currentL2                | Number:ElectricCurrent   | Current on L2                                                 | 1 (r), 2 (r)     |
+| currentL3                | Number:ElectricCurrent   | Current on L3                                                 | 1 (r), 2 (r)     |
+| powerL1                  | Number:Power             | Power on L1                                                   | 1 (r), 2 (r)     |
+| powerL2                  | Number:Power             | Power on L2                                                   | 1 (r), 2 (r)     |
+| powerL3                  | Number:Power             | Power on L2                                                   | 1 (r), 2 (r)     |
+| powerAll                 | Number:Power             | Power over all three phases                                   | 1 (r), 2 (r)     |
+| phases                   | Number                   | Amount of phases currently used for charging                  | 1 (r), 2 (r/w)   |
+| 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-e Charger         | 1 (r), 2 (r)     |
+| temperatureType2Port     | Number:Temperature       | Temperature of the type 2 port of the go-e Charger            | 2 (r)            |
+| firmware                 | String                   | Firmware Version                                              | 1 (r), 2 (r)     |
+| accessConfiguration      | String                   | Access configuration, for example OPEN, RFID ...              | 1 (r/w)          |
+| forceState               | Number                   | Force state  (Neutral=0, Off=1, On=2)                         | 2 (r/w)          |
+| awattarMaxPrice          | Number                   | Awattar Max Price in ct                                       | 2 (r/w)          |
 
 ## Full Example
 
index c3e451564fdbad1fd9d2ecd81c1b6be435905f2b..56952f50cead48179fa5f2b3527fe0f438fc4254 100644 (file)
@@ -55,6 +55,7 @@ public class GoEChargerBindingConstants {
     public static final String SESSION_CHARGE_CONSUMPTION_LIMIT = "sessionChargeEnergyLimit";
     public static final String TOTAL_CONSUMPTION = "totalChargedEnergy";
     public static final String FIRMWARE = "firmware";
+    public static final String AWATTAR_MAX_PRICE = "awattarMaxPrice";
 
     public static final String API_URL = "http://%IP%/status";
     public static final String MQTT_URL = "http://%IP%/mqtt?payload=%KEY%=%VALUE%";
index 996eff9e1a078de521c9fc3fdf954298a26c455e..20033b82861510a642a6282f16982c3011525c0f 100644 (file)
@@ -47,4 +47,7 @@ public class GoEStatusResponseV2DTO extends GoEStatusResponseBaseDTO {
 
     @SerializedName("nrg")
     public Double[] energy;
+
+    @SerializedName("awp")
+    public Double awattarMaxPrice;
 }
index 248bc9498325eee50affefd4e96f41a8456f5820..afb72eecbc7b93bf9c2e0ee6bfad2e5e4aeec006 100644 (file)
@@ -142,6 +142,11 @@ public class GoEChargerV2Handler extends GoEChargerBaseHandler {
                     return UnDefType.UNDEF;
                 }
                 return new DecimalType(goeResponse.transaction);
+            case AWATTAR_MAX_PRICE:
+                if (goeResponse.awattarMaxPrice == null) {
+                    return UnDefType.UNDEF;
+                }
+                return new DecimalType(goeResponse.awattarMaxPrice);
             case ALLOW_CHARGING:
                 return OnOffType.from(goeResponse.allowCharging);
             case TEMPERATURE_TYPE2_PORT:
@@ -250,6 +255,12 @@ public class GoEChargerV2Handler extends GoEChargerBaseHandler {
                     value = String.valueOf(((QuantityType<ElectricCurrent>) command).toUnit(Units.AMPERE).intValue());
                 }
                 break;
+            case AWATTAR_MAX_PRICE:
+                key = "awp";
+                if (command instanceof DecimalType decimalCommand) {
+                    value = String.valueOf(decimalCommand);
+                }
+                break;
             case SESSION_CHARGE_CONSUMPTION_LIMIT:
                 key = "dwo";
                 var multiplier = 1000;
index 992fcfe4e0bb086035610e019c1a2cff62afbb1e..bdfab6343f4ef7782fea84e89a59f5265e2b31cf 100644 (file)
@@ -19,8 +19,6 @@ 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
@@ -29,6 +27,7 @@ channel-type.goecharger.ast.state.option.OPEN = Open
 channel-type.goecharger.ast.state.option.RFID = RFID
 channel-type.goecharger.ast.state.option.TIMER = Timer
 channel-type.goecharger.ast.state.option.AWATTAR = aWATTar
+channel-type.goecharger.awp.label = Awatttar Max Price
 channel-type.goecharger.cbl.label = Cable Encoding
 channel-type.goecharger.cbl.description = Specifies the max amps that can be charged with that cable
 channel-type.goecharger.cl1.label = Current L1
@@ -77,6 +76,8 @@ channel-type.goecharger.tmp.label = Temperature circuit board
 channel-type.goecharger.tmp.description = Temperature of the Go-eCharger on circuit board
 channel-type.goecharger.tmpT2p.label = Temperature type 2 port
 channel-type.goecharger.tmpT2p.description = Temperature of the Go-eCharger on the type 2 port
+channel-type.goecharger.trx.label = Transaction
+channel-type.goecharger.trx.description = 0 for no card, otherwise card ID
 channel-type.goecharger.vl1.label = Voltage L1
 channel-type.goecharger.vl1.description = Voltage on L1
 channel-type.goecharger.vl2.label = Voltage L2
index 4fbb56988c618b0990b9adb8dca7acec58c971c7..fbb751577ddec23ae1eb1e7e1eb29e17ef774221 100644 (file)
@@ -9,6 +9,7 @@
                <description>Go-eCharger thing that represents the wallbox configuration and readings</description>
 
                <channels>
+                       <channel id="awattarMaxPrice" typeId="awp"/>
                        <channel id="maxCurrent" typeId="current"/>
                        <channel id="maxCurrentTemp" typeId="maxCurrTmp"/>
                        <channel id="pwmSignal" typeId="pwm"/>
                        <channel id="temperature" typeId="tmp"/>
                </channels>
 
+               <properties>
+                       <property name="thingTypeVersion">1</property>
+               </properties>
+
                <config-description>
                        <parameter name="ip" type="text" required="true">
                                <label>IP Address</label>
                <description>Force state (Neutral=0, Off=1, On=2)</description>
                <state readOnly="true"/>
        </channel-type>
+       <channel-type id="awp">
+               <item-type>Number</item-type>
+               <label>Awatttar Max Price</label>
+               <state pattern="%.2f"/>
+       </channel-type>
        <channel-type id="scl">
                <item-type>Number:Energy</item-type>
                <label>Current Session Charge Energy Limit</label>
diff --git a/bundles/org.openhab.binding.goecharger/src/main/resources/OH-INF/update/upgrade.xml b/bundles/org.openhab.binding.goecharger/src/main/resources/OH-INF/update/upgrade.xml
new file mode 100644 (file)
index 0000000..6199f88
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<update:update-descriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:update="https://openhab.org/schemas/update-description/v1.0.0"
+       xsi:schemaLocation="https://openhab.org/schemas/update-description/v1.0.0 https://openhab.org/schemas/update-description-1.0.0.xsd">
+
+       <thing-type uid="goecharger:goe">
+               <instruction-set targetVersion="1">
+                       <add-channel id="awattarMaxPrice">
+                               <type>goecharger:awp</type>
+                       </add-channel>
+               </instruction-set>
+       </thing-type>
+
+</update:update-descriptions>