New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[goecharger] Changed unit of SESSION_CHARGE_CONSUMPTION / Current_session_charged_energy #10903
Changes from all commits
98a04d3
1f1ef5e
a04b453
3fbb822
48afebf
4d35791
81911d6
b4a2508
f08b422
b0fcfb4
3dab66d
e7abf5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ Currently available channels are | |
| Channel ID | Item Type | Description | | ||
|--------------------------|--------------------------|---------------------------------------------------------------| | ||
| maxCurrent | Number:ElectricCurrent | Maximum current allowed to use for charging | | ||
| maxCurrTemp | Number:ElectricCurrent | Maximum current temporary (not written to EEPROM) | | ||
| pwmSignal | String | Signal status for PWM signal | | ||
| error | String | Error code of charger | | ||
| voltageL1 | Number:ElectricPotential | Voltage on L1 | | ||
|
@@ -33,16 +34,19 @@ Currently available channels are | |
| powerL1 | Number:Power | Power on L1 | | ||
| powerL2 | Number:Power | Power on L2 | | ||
| powerL3 | Number:Power | Power on L2 | | ||
| powerAll | Number:Power | Power over all three phases | | ||
| phases | Number | Amount of phases currently used for charging | | ||
| sessionChargeEnergyLimit | Number:Energy | Wallbox stops charging after defined value, disable with 0 | | ||
| sessionChargedEnergy | Number:Energy | Amount of energy that has been charged in this session | | ||
| totalChargedEnergy | Number:Energy | Amount of energy that has been charged since installation | | ||
| allowCharging | Switch | If `ON` charging is allowed | | ||
| cableCurrent | Number:ElectricCurrent | Specifies the max current that can be charged with that cable | | ||
| temperature | Number:Temperature | Temperature of the Go-eCharger | | ||
| temptma1 | Number:Temperature | Temperature 1 of the Go-eCharger | | ||
| temptma1 | Number:Temperature | Temperature 2 of the Go-eCharger | | ||
| firmware | String | Firmware Version | | ||
| accessConfiguration | String | Access configuration, for example OPEN, RFID ... | | ||
|
||
|
||
## Full Example | ||
|
||
demo.things | ||
|
@@ -55,6 +59,7 @@ demo.items | |
|
||
``` | ||
Number:ElectricCurrent GoEChargerMaxCurrent "Maximum current" {channel="goecharger:goe:garage:maxCurrent"} | ||
Number:ElectricCurrent GoEChargerMaxCurrTemp "Maximum current temporary" {channel="goecharger:goe:garage:maxCurrentTemp"} | ||
String GoEChargerPwmSignal "Pwm signal status" {channel="goecharger:goe:garage:pwmSignal"} | ||
String GoEChargerError "Error code" {channel="goecharger:goe:garage:error"} | ||
Number:ElectricPotential GoEChargerVoltageL1 "Voltage l1" {channel="goecharger:goe:garage:voltageL1"} | ||
|
@@ -66,17 +71,18 @@ Number:ElectricCurrent GoEChargerCurrentL3 "Current l3" | |
Number:Power GoEChargerPowerL1 "Power l1" {channel="goecharger:goe:garage:powerL1"} | ||
Number:Power GoEChargerPowerL2 "Power l2" {channel="goecharger:goe:garage:powerL2"} | ||
Number:Power GoEChargerPowerL3 "Power l3" {channel="goecharger:goe:garage:powerL3"} | ||
Number:Power GoEChargerPowerAll "Power over all" {channel="goecharger:goe:garage:powerAll"} | ||
Number GoEChargerPhases "Phases" {channel="goecharger:goe:garage:phases"} | ||
Number:Energy GoEChargerSessionChargeEnergyLimit "Current session charge energy limit" {channel="goecharger:goe:garage:sessionChargeEnergyLimit"} | ||
Number:Energy GoEChargerSessionChargedEnergy "Current session charged energy" {channel="goecharger:goe:garage:sessionChargedEnergy"} | ||
Number:Energy GoEChargerTotalChargedEnergy "Total charged energy" {channel="goecharger:goe:garage:totalChargedEnergy"} | ||
Switch GoEChargerAllowCharging "Allow charging" {channel="goecharger:goe:garage:allowCharging"} | ||
Number:ElectricCurrent GoEChargerCableCurrent "Cable encoding" {channel="goecharger:goe:garage:cableCurrent"} | ||
Number:Temperature GoEChargerTemperature "Temperature" {channel="goecharger:goe:garage:temperature"} | ||
Number:Temperature GoEChargertemptma1 "Temperature_tma1" {channel="goecharger:goe:garage:temptma1"} | ||
Number:Temperature GoEChargertemptma1 "Temperature_tma2" {channel="goecharger:goe:garage:temptma2"} | ||
String GoEChargerFirmware "Firmware" {channel="goecharger:goe:garage:firmware"} | ||
String GoEChargerAccessConfiguration "Access configuration" {channel="goecharger:goe:garage:accessConfiguration"} | ||
``` | ||
|
||
## Setting charge current of Go-eCharger based on photovoltaik output | ||
|
||
You can easily define rules to charge with PV power alone. | ||
|
@@ -88,7 +94,7 @@ when | |
Item availablePVCurrent received update | ||
then | ||
logInfo("Amps available: ", receivedCommand.state) | ||
MaxAmpere.sendCommand(receivedCommand.state) | ||
MaxCurrTemp.sendCommand(receivedCommand.state) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please rename, sounds like current temperature |
||
end | ||
``` | ||
You can also define more advanced rules if you have multiple cars that charge with a different amount of phases. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,14 +21,17 @@ | |
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.ERROR; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.FIRMWARE; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.MAX_CURRENT; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.MAX_CURRENT_TEMPORARY; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.PHASES; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.POWER_ALL; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.POWER_L1; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.POWER_L2; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.POWER_L3; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.PWM_SIGNAL; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.SESSION_CHARGE_CONSUMPTION; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.SESSION_CHARGE_CONSUMPTION_LIMIT; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.TEMPERATURE; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.TEMP_TMA1; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.TEMP_TMA2; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.TOTAL_CONSUMPTION; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.VOLTAGE_L1; | ||
import static org.openhab.binding.goecharger.internal.GoEChargerBindingConstants.VOLTAGE_L2; | ||
|
@@ -108,6 +111,11 @@ private State getValue(String channelId, GoEStatusResponseDTO goeResponse) { | |
return UnDefType.UNDEF; | ||
} | ||
return new QuantityType<>(goeResponse.maxCurrent, Units.AMPERE); | ||
case MAX_CURRENT_TEMPORARY: | ||
if (goeResponse.maxCurrentTemporary == null) { | ||
return UnDefType.UNDEF; | ||
} | ||
return new QuantityType<>(goeResponse.maxCurrentTemporary, Units.AMPERE); | ||
case PWM_SIGNAL: | ||
if (goeResponse.pwmSignal == null) { | ||
return UnDefType.UNDEF; | ||
|
@@ -198,11 +206,16 @@ private State getValue(String channelId, GoEStatusResponseDTO goeResponse) { | |
count++; | ||
} | ||
return new DecimalType(count); | ||
case TEMPERATURE: | ||
if (goeResponse.temperature == null) { | ||
case TEMP_TMA1: | ||
if ((goeResponse.tempTma == null) | (goeResponse.tempTma.length == 0)) { | ||
return UnDefType.UNDEF; | ||
} | ||
return new QuantityType<>(goeResponse.temperature, SIUnits.CELSIUS); | ||
return new QuantityType<>(goeResponse.tempTma[0], SIUnits.CELSIUS); | ||
case TEMP_TMA2: | ||
if ((goeResponse.tempTma == null) | (goeResponse.tempTma.length <= 1)) { | ||
return UnDefType.UNDEF; | ||
} | ||
return new QuantityType<>(goeResponse.tempTma[1], SIUnits.CELSIUS); | ||
case SESSION_CHARGE_CONSUMPTION: | ||
if (goeResponse.sessionChargeConsumption == null) { | ||
return UnDefType.UNDEF; | ||
|
@@ -272,6 +285,11 @@ private State getValue(String channelId, GoEStatusResponseDTO goeResponse) { | |
return UnDefType.UNDEF; | ||
} | ||
return new QuantityType<>(goeResponse.energy[9] * 100, Units.WATT); | ||
case POWER_ALL: | ||
if (goeResponse.energy == null) { | ||
return UnDefType.UNDEF; | ||
} | ||
return new QuantityType<>(goeResponse.energy[11] * 10, Units.WATT); | ||
} | ||
return UnDefType.UNDEF; | ||
} | ||
|
@@ -295,6 +313,14 @@ public void handleCommand(ChannelUID channelUID, Command command) { | |
value = String.valueOf(((QuantityType<ElectricCurrent>) command).toUnit(Units.AMPERE).intValue()); | ||
} | ||
break; | ||
case MAX_CURRENT_TEMPORARY: | ||
key = "amx"; | ||
if (command instanceof DecimalType) { | ||
value = String.valueOf(((DecimalType) command).intValue()); | ||
} else if (command instanceof QuantityType<?>) { | ||
value = String.valueOf(((QuantityType<ElectricCurrent>) command).toUnit(Units.AMPERE).intValue()); | ||
} | ||
break; | ||
case SESSION_CHARGE_CONSUMPTION_LIMIT: | ||
key = "dwo"; | ||
if (command instanceof DecimalType) { | ||
|
@@ -344,9 +370,7 @@ public void initialize() { | |
config = getConfigAs(GoEChargerConfiguration.class); | ||
allChannels = getThing().getChannels().stream().map(channel -> channel.getUID().getId()) | ||
.collect(Collectors.toList()); | ||
|
||
updateStatus(ThingStatus.UNKNOWN); | ||
|
||
startAutomaticRefresh(); | ||
logger.debug("Finished initializing!"); | ||
} | ||
|
@@ -357,13 +381,10 @@ private String getUrl(String type) { | |
|
||
private void sendData(String key, String value) { | ||
String urlStr = getUrl(GoEChargerBindingConstants.MQTT_URL).replace("%KEY%", key).replace("%VALUE%", value); | ||
logger.debug("POST URL = {}", urlStr); | ||
|
||
try { | ||
ContentResponse contentResponse = httpClient.newRequest(urlStr).method(HttpMethod.POST) | ||
ContentResponse contentResponse = httpClient.newRequest(urlStr).method(HttpMethod.GET) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Last time i used this i think only post worked, do new firmwares support get now? is this backwards compatible to old hardware? |
||
.timeout(5, TimeUnit.SECONDS).send(); | ||
String response = contentResponse.getContentAsString(); | ||
logger.debug("POST Response: {}", response); | ||
GoEStatusResponseDTO result = gson.fromJson(response, GoEStatusResponseDTO.class); | ||
updateChannelsAndStatus(result, null); | ||
} catch (InterruptedException | TimeoutException | ExecutionException | JsonSyntaxException e) { | ||
|
@@ -384,8 +405,6 @@ private void sendData(String key, String value) { | |
private GoEStatusResponseDTO getGoEData() | ||
throws InterruptedException, TimeoutException, ExecutionException, JsonSyntaxException { | ||
String urlStr = getUrl(GoEChargerBindingConstants.API_URL); | ||
logger.debug("GET URL = {}", urlStr); | ||
|
||
ContentResponse contentResponse = httpClient.newRequest(urlStr).method(HttpMethod.GET) | ||
.timeout(5, TimeUnit.SECONDS).send(); | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -10,6 +10,7 @@ | |||||
|
||||||
<channels> | ||||||
<channel id="maxCurrent" typeId="current"/> | ||||||
<channel id="maxCurrentTemporary" typeId="amx"/> | ||||||
<channel id="pwmSignal" typeId="pwm"/> | ||||||
<channel id="error" typeId="err"/> | ||||||
<channel id="voltageL1" typeId="vl1"/> | ||||||
|
@@ -21,13 +22,15 @@ | |||||
<channel id="powerL1" typeId="pl1"/> | ||||||
<channel id="powerL2" typeId="pl2"/> | ||||||
<channel id="powerL3" typeId="pl3"/> | ||||||
<channel id="powerAll" typeId="pall"/> | ||||||
<channel id="phases" typeId="pha"/> | ||||||
<channel id="sessionChargeEnergyLimit" typeId="scl"/> | ||||||
<channel id="sessionChargedEnergy" typeId="scs"/> | ||||||
<channel id="totalChargedEnergy" typeId="eto"/> | ||||||
<channel id="allowCharging" typeId="alw"/> | ||||||
<channel id="cableCurrent" typeId="cbl"/> | ||||||
<channel id="temperature" typeId="tmp"/> | ||||||
<channel id="tempTma1" typeId="tma1"/> | ||||||
<channel id="tempTma2" typeId="tma2"/> | ||||||
<channel id="firmware" typeId="fmw"/> | ||||||
<channel id="accessConfiguration" typeId="ast"/> | ||||||
</channels> | ||||||
|
@@ -65,6 +68,12 @@ | |||||
<description>Maximum current per phase allowed to use for charging</description> | ||||||
<state pattern="%d %unit%" readOnly="false"/> | ||||||
</channel-type> | ||||||
<channel-type id="amx"> | ||||||
<item-type>Number:ElectricCurrent</item-type> | ||||||
<label>Maximum Current Temporary</label> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
<description>Maximum current per phase not stored in EEPROM</description> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
<state pattern="%d %unit%" readOnly="false"/> | ||||||
</channel-type> | ||||||
<channel-type id="pwm"> | ||||||
<item-type>String</item-type> | ||||||
<label>PWM signal status</label> | ||||||
|
@@ -145,6 +154,12 @@ | |||||
<description>Power on L3</description> | ||||||
<state pattern="%.1f %unit%" readOnly="true"/> | ||||||
</channel-type> | ||||||
<channel-type id="pall"> | ||||||
<item-type>Number:Power</item-type> | ||||||
<label>Power All</label> | ||||||
<description>Power on all phases</description> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
<state pattern="%.1f %unit%" readOnly="true"/> | ||||||
</channel-type> | ||||||
<channel-type id="pha"> | ||||||
<item-type>Number</item-type> | ||||||
<label>Phases</label> | ||||||
|
@@ -178,13 +193,19 @@ | |||||
<channel-type id="cbl"> | ||||||
<item-type>Number:ElectricCurrent</item-type> | ||||||
<label>Cable Encoding</label> | ||||||
<description>Specifies the max amps that can be charged with that cable</description> | ||||||
<description>Specifies the maximal current that can be charged with that cable</description> | ||||||
<state pattern="%d %unit%" readOnly="true"/> | ||||||
</channel-type> | ||||||
<channel-type id="tma1"> | ||||||
<item-type>Number:Temperature</item-type> | ||||||
<label>Temperature_tma1</label> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think this name should be chosen in a human readable format |
||||||
<description>Temperature (tma1) of the Go-eCharger</description> | ||||||
<state pattern="%d %unit%" readOnly="true"/> | ||||||
</channel-type> | ||||||
<channel-type id="tmp"> | ||||||
<channel-type id="tma2"> | ||||||
<item-type>Number:Temperature</item-type> | ||||||
<label>Temperature</label> | ||||||
<description>Temperature of the Go-eCharger</description> | ||||||
<label>Temperature_tma2</label> | ||||||
<description>Temperature (tma2) of the Go-eCharger</description> | ||||||
<state pattern="%d %unit%" readOnly="true"/> | ||||||
</channel-type> | ||||||
<channel-type id="fmw"> | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename a bit, this sounds like current temperature, for example
MaxCurrentTemporary