Skip to content

Commit

Permalink
Merge branch 'release/2021.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeilmeier committed Jul 29, 2021
2 parents 8543174 + e5fe079 commit e7f9186
Show file tree
Hide file tree
Showing 41 changed files with 1,221 additions and 272 deletions.
4 changes: 2 additions & 2 deletions cnf/build.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ buildpath: \
osgi.cmpn;version='7.0.0',\
slf4j.api;version='1.7.30',\
com.google.guava;version='30.1.1',\
com.google.gson;version='2.8.5'
com.google.gson;version='2.8.7'

testpath: \
slf4j.simple,\
Expand Down Expand Up @@ -95,4 +95,4 @@ testpath: \
Edge_Timedata;member=${filter;${p};io\.openems\.edge\.timedata\..*},\

javac.source: 1.8
javac.target: 1.8
javac.target: 1.8
25 changes: 22 additions & 3 deletions cnf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<version>2.8.7</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand Down Expand Up @@ -89,6 +89,25 @@
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>
<!-- eu -->
<dependency>
<!-- Used by io.openems.edge.evcs.ocpp. -->
<groupId>eu.chargetime.ocpp</groupId>
<artifactId>common</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<!-- Used by io.openems.edge.evcs.ocpp. -->
<groupId>eu.chargetime.ocpp</groupId>
<artifactId>OCPP-J</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<!-- Used by io.openems.edge.evcs.ocpp. -->
<groupId>eu.chargetime.ocpp</groupId>
<artifactId>v1_6</artifactId>
<version>1.0</version>
</dependency>
<!-- info -->
<dependency>
<groupId>info.faljse</groupId>
Expand Down Expand Up @@ -192,7 +211,7 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<version>3.16.200</version>
<version>3.16.300</version>
</dependency>
<dependency>
<groupId>org.influxdb</groupId>
Expand Down Expand Up @@ -243,7 +262,7 @@
<!-- Used by io.openems.backend.metadata.odoo -->
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.22</version>
<version>42.2.23</version>
</dependency>
<dependency>
<!-- Used by io.openems.edge.timedata.rrd4j -->
Expand Down
2 changes: 1 addition & 1 deletion doc/modules/ROOT/pages/single_document.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
= OpenEMS - Open Energy Management System
ifndef::toc[]
(c) 2020 OpenEMS Association e.V.
Version 2021.12.0
Version 2021.13.0
:sectnums:
:sectnumlevels: 4
:toc:
Expand Down
4 changes: 2 additions & 2 deletions io.openems.backend.application/BackendApp.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

-runbundles: \
Java-WebSocket;version='[1.5.2,1.5.3)',\
com.google.gson;version='[2.8.5,2.8.6)',\
com.google.gson;version='[2.8.7,2.8.8)',\
com.google.guava;version='[30.1.1,30.1.2)',\
com.google.guava.failureaccess;version='[1.0.1,1.0.2)',\
com.zaxxer.HikariCP;version='[4.0.3,4.0.4)',\
Expand Down Expand Up @@ -78,4 +78,4 @@
org.osgi.service.jdbc;version='[1.0.0,1.0.1)',\
org.osgi.util.function;version='[1.1.0,1.1.1)',\
org.osgi.util.promise;version='[1.1.1,1.1.2)',\
org.postgresql.jdbc;version='[42.2.22,42.2.23)'
org.postgresql.jdbc;version='[42.2.23,42.2.24)'
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,12 @@ private void sendErrorResponse(Request baseRequest, HttpServletResponse response
* @throws OpenemsException on error
*/
private static JsonObject parseJson(Request baseRequest) throws OpenemsException {
JsonParser parser = new JsonParser();
try {
return parser.parse(new BufferedReader(new InputStreamReader(baseRequest.getInputStream())).lines()
.collect(Collectors.joining("\n"))).getAsJsonObject();
return JsonParser.parseString(//
new BufferedReader(new InputStreamReader(baseRequest.getInputStream())) //
.lines() //
.collect(Collectors.joining("\n"))) //
.getAsJsonObject();
} catch (Exception e) {
throw new OpenemsException("Unable to parse: " + e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class OpenemsConstants {
*
* This is usually the number of the sprint within the year
*/
public final static short VERSION_MINOR = 12;
public final static short VERSION_MINOR = 13;

/**
* The patch version of OpenEMS.
Expand Down
19 changes: 17 additions & 2 deletions io.openems.common/src/io/openems/common/utils/JsonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,21 @@ public static int getAsInt(JsonElement jElement, String memberName) throws Opene
throw OpenemsError.JSON_NO_INTEGER_MEMBER.exception(memberName, jPrimitive.toString().replaceAll("%", "%%"));
}

/**
* Gets the member with given index of the {@link JsonArray} as int.
*
* @param jArray the {@link JsonArray}
* @param index the index of the member
* @return the int value
* @throws OpenemsNamedException on error
*/
public static int getAsInt(JsonArray jArray, int index) throws OpenemsNamedException {
if (index < 0 || jArray.size() <= index) {
throw OpenemsError.JSON_NO_INTEGER_MEMBER.exception(index, jArray.toString().replaceAll("%", "%%"));
}
return JsonUtils.getAsInt(jArray.get(index));
}

/**
* Gets the {@link JsonElement} as {@link Optional} {@link Integer}.
*
Expand Down Expand Up @@ -1350,8 +1365,7 @@ public static ZonedDateTime getAsZonedDateTime(JsonElement element, String membe
*/
public static JsonElement parse(String string) throws OpenemsNamedException {
try {
JsonParser parser = new JsonParser();
return parser.parse(string);
return JsonParser.parseString(string);
} catch (JsonParseException e) {
throw OpenemsError.JSON_PARSE_FAILED.exception(e.getMessage(), string);
}
Expand All @@ -1378,4 +1392,5 @@ public static void prettyPrint(JsonElement j) {
String json = gson.toJson(j);
System.out.println(json);
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.openems.common.websocket;

import java.io.IOException;
import java.net.BindException;
import java.net.InetSocketAddress;
import java.util.Collection;
Expand Down Expand Up @@ -217,7 +218,7 @@ public void stop() {
try {
this.ws.stop();
return;
} catch (NullPointerException | InterruptedException e) {
} catch (NullPointerException | InterruptedException | IOException e) {
this.log.warn("Unable to stop websocket server [" + this.getName() + "]. "
+ e.getClass().getSimpleName() + ": " + e.getMessage());
try {
Expand Down
25 changes: 25 additions & 0 deletions io.openems.common/test/io/openems/common/utils/JsonUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import org.junit.Test;

import com.google.gson.JsonArray;
import com.google.gson.JsonNull;
import com.google.gson.JsonPrimitive;

Expand Down Expand Up @@ -55,4 +56,28 @@ public void testGetAsBoolean() throws OpenemsNamedException {
}
}

@Test
public void testGetAsInt() throws OpenemsNamedException {
JsonArray arr = JsonUtils.buildJsonArray() //
.add(10) //
.add(20) //
.add(30) //
.build();

try {
JsonUtils.getAsInt(arr, -1);
fail();
} catch (OpenemsNamedException e) {
}
assertEquals(10, JsonUtils.getAsInt(arr, 0));
assertEquals(20, JsonUtils.getAsInt(arr, 1));
assertEquals(30, JsonUtils.getAsInt(arr, 2));
try {
JsonUtils.getAsInt(arr, 3);
fail();
} catch (OpenemsNamedException e) {
}

}

}
4 changes: 3 additions & 1 deletion io.openems.edge.application/EdgeApp.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
bnd.identity;id='io.openems.edge.ess.sma',\
bnd.identity;id='io.openems.edge.evcs.cluster',\
bnd.identity;id='io.openems.edge.evcs.core',\
bnd.identity;id='io.openems.edge.evcs.goe.chargerhome',\
bnd.identity;id='io.openems.edge.evcs.hardybarth',\
bnd.identity;id='io.openems.edge.evcs.keba.kecontact',\
bnd.identity;id='io.openems.edge.evcs.ocpp.abl',\
Expand Down Expand Up @@ -148,7 +149,7 @@
Java-WebSocket;version='[1.5.2,1.5.3)',\
com.fazecast.jSerialComm;version='[2.5.1,2.5.2)',\
com.ghgande.j2mod;version='[2.5.5,2.5.6)',\
com.google.gson;version='[2.8.5,2.8.6)',\
com.google.gson;version='[2.8.7,2.8.8)',\
com.google.guava;version='[30.1.1,30.1.2)',\
com.google.guava.failureaccess;version='[1.0.1,1.0.2)',\
com.sun.jna;version='[5.8.0,5.8.1)',\
Expand Down Expand Up @@ -230,6 +231,7 @@
io.openems.edge.evcs.api;version=snapshot,\
io.openems.edge.evcs.cluster;version=snapshot,\
io.openems.edge.evcs.core;version=snapshot,\
io.openems.edge.evcs.goe.chargerhome;version=snapshot,\
io.openems.edge.evcs.hardybarth;version=snapshot,\
io.openems.edge.evcs.keba.kecontact;version=snapshot,\
io.openems.edge.evcs.ocpp.abl;version=snapshot,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,12 @@ private boolean handlePost(User user, ChannelAddress channelAddress, Request bas
* @throws OpenemsException on error
*/
private static JsonObject parseJson(Request baseRequest) throws OpenemsException {
JsonParser parser = new JsonParser();
try {
return parser.parse(new BufferedReader(new InputStreamReader(baseRequest.getInputStream())).lines()
.collect(Collectors.joining("\n"))).getAsJsonObject();
return JsonParser.parseString(//
new BufferedReader(new InputStreamReader(baseRequest.getInputStream())) //
.lines() //
.collect(Collectors.joining("\n"))) //
.getAsJsonObject();
} catch (Exception e) {
throw new OpenemsException("Unable to parse: " + e.getMessage());
}
Expand Down
2 changes: 2 additions & 0 deletions io.openems.edge.evcs.goe.chargerhome/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/bin_test/
/generated/
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>io.openems.wrapper.eu.chargetime.ocpp</name>
<name>io.openems.edge.evcs.keba.kecontact</name>
<comment></comment>
<projects>
</projects>
Expand Down
13 changes: 13 additions & 0 deletions io.openems.edge.evcs.goe.chargerhome/bnd.bnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Bundle-Name: OpenEMS Edge EVCS Go-e Charger Home
Bundle-Vendor: FENECON GmbH
Bundle-License: https://opensource.org/licenses/EPL-2.0
Bundle-Version: 1.0.0.${tstamp}

-buildpath: \
${buildpath},\
io.openems.common,\
io.openems.edge.common,\
io.openems.edge.evcs.api

-testpath: \
${testpath}
Binary file not shown.
8 changes: 8 additions & 0 deletions io.openems.edge.evcs.goe.chargerhome/readme.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
= Go-e Charger Home Charging Station

This component implements the go-e charger home charging station, which is controlled and read out using the Rest-API protocol.
It collects all relevant informations into the given Nature Channels and its own Channels and sends charging commands that have been set by another controllers.

Implemented Natures:
* Evcs (Electric Vehicle Charging Station)
* ManagedEvcs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package io.openems.edge.evcs.goe.chargerhome;

import org.osgi.service.metatype.annotations.AttributeDefinition;
import org.osgi.service.metatype.annotations.ObjectClassDefinition;

@ObjectClassDefinition(name = "EVCS go-e Charger Home", //
description = "Implements the go-e Charger Home electric vehicle charging station.")
@interface Config {

@AttributeDefinition(name = "Component-ID", description = "Unique ID of this Component")
String id() default "evcs0";

@AttributeDefinition(name = "Alias", description = "Human-readable name "
+ "of this Component; defaults to Component-ID")
String alias() default "";

@AttributeDefinition(name = "Is enabled?", description = "Is this Component enabled?")
boolean enabled() default true;

@AttributeDefinition(name = "Debug Mode", description = "Activates the debug mode")
boolean debugMode() default false;

@AttributeDefinition(name = "IP-Address", description = "The IP address of the charging station.", required = true)
String ip() default "192.168.1.130";

@AttributeDefinition(name = "Minimum current", description = "Minimum current of the Charger in mA.", required = true)
int minHwCurrent() default 6000;

@AttributeDefinition(name = "Maximum current", description = "Maximum current of the Charger in mA.", required = true)
int maxHwCurrent() default 32000;

String webconsole_configurationFactory_nameHint() default "EVCS go-e Charger Home [{id}]";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.openems.edge.evcs.goe.chargerhome;

import io.openems.common.types.OptionsEnum;

public enum Errors implements OptionsEnum {
UNDEFINED(0, "Undefined"), //
RCCB(1, "Residual current operated device Error"), //
PHASE(3, "Phase Error"), //
NO_GROUND(8, "No Ground"), //
INTERNAL(10, "Internal error"); //

private final int value;
private final String name;

private Errors(int value, String name) {
this.value = value;
this.name = name;
}

@Override
public int getValue() {
return this.value;
}

@Override
public String getName() {
return this.name;
}

@Override
public OptionsEnum getUndefined() {
return UNDEFINED;
}
}
Loading

0 comments on commit e7f9186

Please sign in to comment.