Skip to content

Commit

Permalink
Merge branch 'release/2025.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeilmeier committed Mar 1, 2025
2 parents bd574ac + 448d01d commit 6261507
Show file tree
Hide file tree
Showing 483 changed files with 22,250 additions and 4,769 deletions.
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ updates:
capacitor:
patterns:
- "@capacitor/*"
- "@capacitor-community/*"
- "capacitor-*"
ionic-native:
patterns:
- "@ionic-native/*"
Expand Down
2 changes: 1 addition & 1 deletion .gradle-wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 2 additions & 1 deletion cnf/build.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ buildpath: \
org.osgi.util.promise;version='1.2.0',\
com.google.guava;version='33.4.0.jre',\
com.google.guava.failureaccess;version='1.0.2',\
com.google.gson;version='2.11.0',\
com.google.gson;version='2.12.1',\

testpath: \
slf4j.simple,\
Expand All @@ -65,6 +65,7 @@ testpath: \
Edge_Controller_PVinverter;member=${filter;${p};io\.openems\.edge\.controller\.pvinverter\..*},\
Edge_Ess;member=${filter;${p};io\.openems\.edge\.ess\..*},\
Edge_Evcs;member=${filter;${p};io\.openems\.edge\.evcs\..*|io\.openems\.wrapper\.eu\.chargetime\.ocpp},\
Edge_Evse;member=${filter;${p};io\.openems\.edge\.evse\..*|io\.openems\.edge\.controller\.evse},\
Edge_Multiple;member=${filter;${p};io\.openems\.edge\.fenecon\..*|io\.openems\.edge\.goodwe|io\.openems\.edge\.kostal\.piko|io\.openems\.edge\.tesla\..*|io\.openems\.edge\.solaredge|io\.openems\.edge\.bosch\..*|io\.openems\.edge\.katek\..*|io\.openems\.edge\.kaco\..*},\
Edge_IO;member=${filter;${p};io\.openems\.edge\.io\..*|io\.openems\.edge\.controller\.channelthreshold|io\.openems\.edge\.controller\.chp\..*|io\.openems\.edge\.controller\.highloadtimeslot},\
Edge_Meter;member=${filter;${p};io\.openems\.edge\.meter\..*},\
Expand Down
8 changes: 4 additions & 4 deletions cnf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.11.0</version>
<version>2.12.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand Down Expand Up @@ -130,13 +130,13 @@
<dependency>
<groupId>fr.turri</groupId>
<artifactId>aXMLRPC</artifactId>
<version>1.16.0</version>
<version>1.17.0</version>
</dependency>
<!-- info -->
<dependency>
<groupId>info.faljse</groupId>
<artifactId>SDNotify</artifactId>
<version>1.5</version>
<version>1.6</version>
</dependency>
<!-- io -->
<dependency>
Expand Down Expand Up @@ -265,7 +265,7 @@
<!-- Changelog: https://github.com/apache/felix-dev/blob/master/webconsole/README.md#releases -->
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.webconsole</artifactId>
<version>5.0.8</version>
<version>5.0.10</version>
</dependency>
<dependency>
<!-- Apache Felix Web Console Service Component Runtime/Declarative Services Plugin -->
Expand Down
1 change: 1 addition & 0 deletions doc/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
** xref:backend/build.adoc[Build OpenEMS Backend]
** xref:backend/deploy.adoc[Deploy OpenEMS Backend]
* xref:component-communication/index.adoc[Component Communication]
* xref:logging/log4j2.adoc[Logging]
* Simulation
** xref:simulation/gitpod.adoc[Live-Demo on Gitpod]
** xref:simulation/realtime.adoc[Real-Time Simulation]
Expand Down
3 changes: 1 addition & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
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 @@ -62,7 +62,7 @@
-runbundles: \
Java-WebSocket;version='[1.5.4,1.5.5)',\
com.fasterxml.aalto-xml;version='[1.3.3,1.3.4)',\
com.google.gson;version='[2.11.0,2.11.1)',\
com.google.gson;version='[2.12.1,2.12.2)',\
com.google.guava;version='[33.4.0,33.4.1)',\
com.google.guava.failureaccess;version='[1.0.2,1.0.3)',\
com.squareup.okio;version='[3.10.2,3.10.3)',\
Expand Down Expand Up @@ -114,7 +114,7 @@
org.apache.felix.inventory;version='[2.0.0,2.0.1)',\
org.apache.felix.metatype;version='[1.2.4,1.2.5)',\
org.apache.felix.scr;version='[2.2.12,2.2.13)',\
org.apache.felix.webconsole;version='[5.0.8,5.0.9)',\
org.apache.felix.webconsole;version='[5.0.10,5.0.11)',\
org.apache.felix.webconsole.plugins.ds;version='[2.3.0,2.3.1)',\
org.jetbrains.kotlin.osgi-bundle;version='[2.1.10,2.1.11)',\
org.jsr-305;version='[3.0.2,3.0.3)',\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.google.common.base.Strings;

import io.openems.common.OpenemsConstants;
import io.openems.common.utils.DictionaryUtils;

@Component(immediate = true)
public class BackendApp {
Expand All @@ -36,7 +37,7 @@ private void activate() {
try {
config = this.cm.getConfiguration("org.ops4j.pax.logging", null);
final var properties = config.getProperties();
if (properties == null || properties.isEmpty() || properties.get("log4j2.rootLogger.level") == null) {
if (!DictionaryUtils.containsAnyKey(properties, "log4j2.rootLogger.level")) {
final var log4j = new Hashtable<String, Object>();
log4j.put("log4j2.appender.console.type", "Console");
log4j.put("log4j2.appender.console.name", "console");
Expand All @@ -52,7 +53,7 @@ private void activate() {
config.update(log4j);
}
} catch (IOException | SecurityException e) {
e.printStackTrace();
this.log.error(e.getMessage(), e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class OpenemsConstants {
* <p>
* This is the month of the release.
*/
public static final short VERSION_MINOR = 2;
public static final short VERSION_MINOR = 3;

/**
* The patch version of OpenEMS.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.google.gson.JsonObject;

import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.common.jsonrpc.serialization.EndpointRequestType;
import io.openems.common.utils.JsonUtils;

/**
Expand All @@ -26,6 +27,23 @@
*/
public class GenericJsonrpcRequest extends JsonrpcRequest {

/**
* Creates a GenericJsonrpcRequest from the provided object.
*
* @param <REQUEST> the original type of the request
* @param endpointType the definition of the endpoint
* @param request the request to transform into a
* {@link GenericJsonrpcRequest}
* @return the created {@link GenericJsonrpcRequest}
*/
public static <REQUEST> GenericJsonrpcRequest createRequest(//
EndpointRequestType<REQUEST, ?> endpointType, //
REQUEST request //
) {
return new GenericJsonrpcRequest(endpointType.getMethod(),
endpointType.getRequestSerializer().serialize(request).getAsJsonObject());
}

/**
* Parses the String to a {@link GenericJsonrpcRequest}.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package io.openems.common.jsonrpc.request;

import static io.openems.common.jsonrpc.serialization.JsonSerializerUtil.jsonObjectSerializer;
import static io.openems.common.utils.JsonUtils.toJsonArray;
import static java.util.Collections.emptyList;
import static java.util.stream.Collectors.mapping;
import static java.util.stream.Collectors.toList;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -15,6 +19,8 @@
import io.openems.common.exceptions.OpenemsException;
import io.openems.common.function.ThrowingFunction;
import io.openems.common.jsonrpc.base.JsonrpcRequest;
import io.openems.common.jsonrpc.serialization.JsonElementPath;
import io.openems.common.jsonrpc.serialization.JsonSerializer;
import io.openems.common.utils.JsonUtils;

/**
Expand Down Expand Up @@ -50,12 +56,58 @@ public static class PaginationOptions {
private final SearchParams searchParams;
private final String query;

/**
* Returns a {@link JsonSerializer} for a
* {@link GetEdgesRequest.PaginationOptions.SearchParams}.
*
* @return the created {@link JsonSerializer}
*/
public static JsonSerializer<GetEdgesRequest.PaginationOptions> serializer() {
return jsonObjectSerializer(GetEdgesRequest.PaginationOptions.class, //
json -> new GetEdgesRequest.PaginationOptions(//
json.getInt("page"), //
json.getOptionalInt("limit").orElse(DEFAULT_LIMIT), //
json.getString("query"), //
json.getObject("searchParams", SearchParams.serializer())), //
obj -> JsonUtils.buildJsonObject() //
.addProperty("page", obj.page) //
.addProperty("limit", obj.limit) //
.addProperty("query", obj.query) //
.add("searchParams", SearchParams.serializer().serialize(obj.searchParams)) //
.build());
}

public record SearchParams(//
List<String> productTypes, //
List<Level> sumStates, //
boolean searchIsOnline, //
boolean isOnline //
) {
/**
* Returns a {@link JsonSerializer} for a
* {@link GetEdgesRequest.PaginationOptions.SearchParams}.
*
* @return the created {@link JsonSerializer}
*/
public static JsonSerializer<GetEdgesRequest.PaginationOptions.SearchParams> serializer() {
return jsonObjectSerializer(GetEdgesRequest.PaginationOptions.SearchParams.class, json -> {
final var isOnline = json.getBooleanPathNullable("isOnline");
return new GetEdgesRequest.PaginationOptions.SearchParams(//
json.getList("producttype", JsonElementPath::getAsString), //
json.getJsonArrayPath("sumState").collect(mapping(t -> t.getAsEnum(Level.class), toList())), //
isOnline.isPresent(), //
isOnline.getOrDefault(false));
}, obj -> JsonUtils.buildJsonObject() //
.add("producttype", obj.productTypes().stream() //
.map(JsonPrimitive::new) //
.collect(toJsonArray()))
.add("sumState", obj.sumStates().stream() //
.map(Level::name) //
.map(JsonPrimitive::new) //
.collect(toJsonArray()))
.onlyIf(obj.searchIsOnline(), t -> t.addProperty("isOnline", obj.isOnline())) //
.build());
}

/**
* Creates a {@link SearchParams} from a {@link JsonObject}.
Expand Down Expand Up @@ -119,7 +171,7 @@ public static PaginationOptions from(JsonObject params) throws OpenemsNamedExcep
return new PaginationOptions(page, limit, query, searchParams);
}

private PaginationOptions(int page, int limit, String query, SearchParams searchParams) {
public PaginationOptions(int page, int limit, String query, SearchParams searchParams) {
this.page = page;
this.limit = limit;
this.query = query;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.Optional;
import java.util.Set;
import java.util.TimeZone;
import java.util.TreeSet;

Expand Down Expand Up @@ -96,29 +97,31 @@ public static QueryHistoricTimeseriesDataRequest from(JsonrpcRequest r) throws O

private final ZonedDateTime fromDate;
private final ZonedDateTime toDate;
private final TreeSet<ChannelAddress> channels = new TreeSet<>();
private final Set<ChannelAddress> channels;

/**
* Resolution of the data or empty for automatic.
*/
private final Optional<Resolution> resolution;

private QueryHistoricTimeseriesDataRequest(JsonrpcRequest request, ZonedDateTime fromDate, ZonedDateTime toDate,
Optional<Resolution> resolution) throws OpenemsNamedException {
Optional<Resolution> resolution) {
super(request, QueryHistoricTimeseriesDataRequest.METHOD);

this.fromDate = fromDate;
this.toDate = toDate;
this.resolution = resolution;
this.channels = new TreeSet<>();
}

public QueryHistoricTimeseriesDataRequest(ZonedDateTime fromDate, ZonedDateTime toDate,
Optional<Resolution> resolution) throws OpenemsNamedException {
Optional<Resolution> resolution, Set<ChannelAddress> channels) {
super(QueryHistoricTimeseriesDataRequest.METHOD);

this.fromDate = fromDate;
this.toDate = toDate;
this.resolution = resolution;
this.channels = channels;
}

private void addChannel(ChannelAddress address) {
Expand Down Expand Up @@ -170,7 +173,7 @@ public ZonedDateTime getToDate() {
*
* @return Set of {@link ChannelAddress}
*/
public TreeSet<ChannelAddress> getChannels() {
public Set<ChannelAddress> getChannels() {
return this.channels;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ private QueryHistoricTimeseriesExportXlxsRequest(JsonrpcRequest request, ZonedDa
this.toDate = toDate;
}

public QueryHistoricTimeseriesExportXlxsRequest(ZonedDateTime fromDate, ZonedDateTime toDate)
throws OpenemsNamedException {
super(QueryHistoricTimeseriesExportXlxsRequest.METHOD);

DateUtils.assertSameTimezone(fromDate, toDate);
this.timezoneDiff = ZoneOffset.from(fromDate).getTotalSeconds();
this.fromDate = fromDate;
this.toDate = toDate;
}

@Override
public JsonObject getParams() {
return JsonUtils.buildJsonObject() //
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.openems.common.jsonrpc.request;

import static io.openems.common.jsonrpc.serialization.JsonSerializerUtil.jsonObjectSerializer;

import java.util.ArrayList;
import java.util.List;

Expand All @@ -10,6 +12,7 @@

import io.openems.common.exceptions.OpenemsError.OpenemsNamedException;
import io.openems.common.jsonrpc.base.JsonrpcRequest;
import io.openems.common.jsonrpc.serialization.JsonSerializer;
import io.openems.common.utils.JsonUtils;

/**
Expand Down Expand Up @@ -106,6 +109,23 @@ protected static List<Property> from(JsonArray j) throws OpenemsNamedException {
return properties;
}

/**
* Returns a {@link JsonSerializer} for a
* {@link UpdateComponentConfigRequest.Property}.
*
* @return the created {@link JsonSerializer}
*/
public static JsonSerializer<UpdateComponentConfigRequest.Property> serializer() {
return jsonObjectSerializer(UpdateComponentConfigRequest.Property.class, //
json -> new UpdateComponentConfigRequest.Property(//
json.getString("name"), //
json.getJsonElement("value")), //
obj -> JsonUtils.buildJsonObject() //
.addProperty("name", obj.name) //
.add("value", obj.value) //
.build());
}

private final String name;
private final JsonElement value;

Expand Down
Loading

0 comments on commit 6261507

Please sign in to comment.