Skip to content

Commit

Permalink
[goecharger] Add awattarMaxPrice channel (openhab#17532)
Browse files Browse the repository at this point in the history
* Add awp channel

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
  • Loading branch information
lsiepel authored Oct 12, 2024
1 parent c6b2e2d commit d533ac9
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 31 deletions.
60 changes: 31 additions & 29 deletions bundles/org.openhab.binding.goecharger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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%";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,7 @@ public class GoEStatusResponseV2DTO extends GoEStatusResponseBaseDTO {

@SerializedName("nrg")
public Double[] energy;

@SerializedName("awp")
public Double awattarMaxPrice;
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ protected State getValue(String channelId, GoEStatusResponseBaseDTO goeResponseB
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:
Expand Down Expand Up @@ -250,6 +255,12 @@ public void handleCommand(ChannelUID channelUID, Command command) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down Expand Up @@ -37,6 +38,10 @@
<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>
Expand Down Expand Up @@ -178,6 +183,11 @@
<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>
Expand Down
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit d533ac9

Please sign in to comment.