diff --git a/cnf/clean-up.xml b/cnf/clean-up.xml new file mode 100644 index 00000000000..777d43aa96a --- /dev/null +++ b/cnf/clean-up.xml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/io.openems.backend.b2brest/src/io/openems/backend/b2brest/RestHandler.java b/io.openems.backend.b2brest/src/io/openems/backend/b2brest/RestHandler.java index ef6cc491eeb..dce3bd937ba 100644 --- a/io.openems.backend.b2brest/src/io/openems/backend/b2brest/RestHandler.java +++ b/io.openems.backend.b2brest/src/io/openems/backend/b2brest/RestHandler.java @@ -49,7 +49,7 @@ public RestHandler(B2bRest parent) { public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { try { - User user = this.authenticate(request); + var user = this.authenticate(request); List targets = Arrays.asList(// target.substring(1) // remove leading '/' @@ -59,7 +59,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques throw new OpenemsException("Missing arguments to handle request"); } - String thisTarget = targets.get(0); + var thisTarget = targets.get(0); switch (thisTarget) { case "jsonrpc": this.handleJsonRpc(user, baseRequest, request, response); @@ -78,11 +78,11 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques * @throws OpenemsNamedException on error */ private User authenticate(HttpServletRequest request) throws OpenemsNamedException { - String authHeader = request.getHeader("Authorization"); + var authHeader = request.getHeader("Authorization"); if (authHeader != null) { var st = new StringTokenizer(authHeader); if (st.hasMoreTokens()) { - String basic = st.nextToken(); + var basic = st.nextToken(); if (basic.equalsIgnoreCase("Basic")) { String credentials; try { @@ -90,7 +90,7 @@ private User authenticate(HttpServletRequest request) throws OpenemsNamedExcepti } catch (UnsupportedEncodingException e) { throw OpenemsError.COMMON_AUTHENTICATION_FAILED.exception(); } - int p = credentials.indexOf(":"); + var p = credentials.indexOf(":"); if (p != -1) { var username = credentials.substring(0, p).trim(); var password = credentials.substring(p + 1).trim(); diff --git a/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/OnOpen.java b/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/OnOpen.java index 917ef5eecd9..fa0e7706a90 100644 --- a/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/OnOpen.java +++ b/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/OnOpen.java @@ -9,7 +9,6 @@ import com.google.gson.JsonObject; -import io.openems.backend.common.metadata.User; import io.openems.common.exceptions.OpenemsError; import io.openems.common.exceptions.OpenemsError.OpenemsNamedException; import io.openems.common.utils.JsonUtils; @@ -33,8 +32,8 @@ public void run(WebSocket ws, JsonObject handshake) throws OpenemsNamedException throw OpenemsError.COMMON_AUTHENTICATION_FAILED.exception(); } - String base64Credentials = authorization.substring("Basic".length()).trim(); - byte[] credDecoded = Base64.getDecoder().decode(base64Credentials); + var base64Credentials = authorization.substring("Basic".length()).trim(); + var credDecoded = Base64.getDecoder().decode(base64Credentials); var credentials = new String(credDecoded, StandardCharsets.UTF_8); // credentials = username:password final var values = credentials.split(":", 2); @@ -43,7 +42,7 @@ public void run(WebSocket ws, JsonObject handshake) throws OpenemsNamedException } var username = values[0]; var password = values[1]; - User user = this.parent.metadata.authenticate(username, password); + var user = this.parent.metadata.authenticate(username, password); WsData wsData = ws.getAttachment(); wsData.setUser(user); diff --git a/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/SubscribedEdgesChannelsWorker.java b/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/SubscribedEdgesChannelsWorker.java index f3a8f42c4e9..6da5bae1201 100644 --- a/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/SubscribedEdgesChannelsWorker.java +++ b/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/SubscribedEdgesChannelsWorker.java @@ -9,7 +9,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.gson.JsonElement; import com.google.gson.JsonNull; import io.openems.backend.b2bwebsocket.jsonrpc.notification.EdgesCurrentDataNotification; @@ -131,7 +130,7 @@ private EdgesCurrentDataNotification getCurrentDataNotification() throws Openems user.assertEdgeRoleIsAtLeast("EdgesCurrentDataNotification", edgeId, Role.GUEST); for (ChannelAddress channel : this.channels) { - Optional value = this.parent.timeData.getChannelValue(edgeId, channel); + var value = this.parent.timeData.getChannelValue(edgeId, channel); result.addValue(edgeId, channel, value.orElse(JsonNull.INSTANCE)); } } diff --git a/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/WsData.java b/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/WsData.java index d0db7fafc76..87fdfcebcf3 100644 --- a/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/WsData.java +++ b/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/WsData.java @@ -37,7 +37,7 @@ public CompletableFuture getUser() { /** * Gets the logged in User with a timeout. - * + * * @param timeout the timeout length * @param unit the {@link TimeUnit} of the timeout * @return the {@link User} diff --git a/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/jsonrpc/notification/EdgesCurrentDataNotification.java b/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/jsonrpc/notification/EdgesCurrentDataNotification.java index 36a50f361d7..3e80187f21a 100644 --- a/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/jsonrpc/notification/EdgesCurrentDataNotification.java +++ b/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/jsonrpc/notification/EdgesCurrentDataNotification.java @@ -39,7 +39,7 @@ public EdgesCurrentDataNotification() { /** * Adds a value to the notification. - * + * * @param edgeId the Edge-ID * @param channel the {@link ChannelAddress} * @param value the value @@ -52,12 +52,12 @@ public void addValue(String edgeId, ChannelAddress channel, JsonElement value) { public JsonObject getParams() { var j = new JsonObject(); for (Entry> row : this.values.rowMap().entrySet()) { - String edgeId = row.getKey(); - Map columns = row.getValue(); + var edgeId = row.getKey(); + var columns = row.getValue(); var jEdge = new JsonObject(); for (Entry column : columns.entrySet()) { - ChannelAddress channel = column.getKey(); - JsonElement value = column.getValue(); + var channel = column.getKey(); + var value = column.getValue(); jEdge.add(channel.toString(), value); } j.add(edgeId, jEdge); diff --git a/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/jsonrpc/request/SubscribeEdgesChannelsRequest.java b/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/jsonrpc/request/SubscribeEdgesChannelsRequest.java index 733100b96b9..6df17a85318 100644 --- a/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/jsonrpc/request/SubscribeEdgesChannelsRequest.java +++ b/io.openems.backend.b2bwebsocket/src/io/openems/backend/b2bwebsocket/jsonrpc/request/SubscribeEdgesChannelsRequest.java @@ -34,7 +34,7 @@ public class SubscribeEdgesChannelsRequest extends JsonrpcRequest { /** * Builds a {@link SubscribeEdgesChannelsRequest} from a {@link JsonrpcRequest}. - * + * * @param r the {@link JsonrpcRequest} * @return the {@link SubscribeEdgesChannelsRequest} * @throws OpenemsNamedException on error @@ -57,7 +57,7 @@ public static SubscribeEdgesChannelsRequest from(JsonrpcRequest r) throws Openem /** * Builds a {@link SubscribeEdgesChannelsRequest} from a {@link JsonObject}. - * + * * @param j the {@link JsonObject} * @return the {@link SubscribeEdgesChannelsRequest} * @throws OpenemsNamedException on error @@ -82,7 +82,7 @@ public SubscribeEdgesChannelsRequest(int count) { /** * Adds an Edge-ID. - * + * * @param edgeId the Edge-ID. */ public void addEdgeId(String edgeId) { @@ -91,7 +91,7 @@ public void addEdgeId(String edgeId) { /** * Removes an Edge-ID. - * + * * @param edgeId the Edge-ID */ public void removeEdgeId(String edgeId) { @@ -104,7 +104,7 @@ public TreeSet getEdgeIds() { /** * Adds a Channel. - * + * * @param address the {@link ChannelAddress} */ public void addChannel(ChannelAddress address) { diff --git a/io.openems.backend.common/src/io/openems/backend/common/jsonrpc/response/GetEdgesChannelsValuesResponse.java b/io.openems.backend.common/src/io/openems/backend/common/jsonrpc/response/GetEdgesChannelsValuesResponse.java index 6e4b8544af6..a2378633315 100644 --- a/io.openems.backend.common/src/io/openems/backend/common/jsonrpc/response/GetEdgesChannelsValuesResponse.java +++ b/io.openems.backend.common/src/io/openems/backend/common/jsonrpc/response/GetEdgesChannelsValuesResponse.java @@ -55,12 +55,12 @@ public void addValue(String edgeId, ChannelAddress channel, JsonElement value) { public JsonObject getResult() { var j = new JsonObject(); for (Entry> row : this.values.rowMap().entrySet()) { - String edgeId = row.getKey(); - Map columns = row.getValue(); + var edgeId = row.getKey(); + var columns = row.getValue(); var jEdge = new JsonObject(); for (Entry column : columns.entrySet()) { - ChannelAddress channel = column.getKey(); - JsonElement value = column.getValue(); + var channel = column.getKey(); + var value = column.getValue(); jEdge.add(channel.toString(), value); } j.add(edgeId, jEdge); diff --git a/io.openems.backend.common/src/io/openems/backend/common/jsonrpc/response/GetEdgesStatusResponse.java b/io.openems.backend.common/src/io/openems/backend/common/jsonrpc/response/GetEdgesStatusResponse.java index 7680bf570b9..3d063311e69 100644 --- a/io.openems.backend.common/src/io/openems/backend/common/jsonrpc/response/GetEdgesStatusResponse.java +++ b/io.openems.backend.common/src/io/openems/backend/common/jsonrpc/response/GetEdgesStatusResponse.java @@ -53,7 +53,7 @@ public GetEdgesStatusResponse(UUID id, Map edgeInfos) { public JsonObject getResult() { var j = new JsonObject(); for (Entry entry : this.edgeInfos.entrySet()) { - EdgeInfo edge = entry.getValue(); + var edge = entry.getValue(); j.add(entry.getKey(), JsonUtils.buildJsonObject() // .addProperty("online", edge.online) // .build()); diff --git a/io.openems.backend.common/src/io/openems/backend/common/jsonrpc/response/GetUserInformationResponse.java b/io.openems.backend.common/src/io/openems/backend/common/jsonrpc/response/GetUserInformationResponse.java index 5ce64b7e5ce..8a48fde7b6d 100644 --- a/io.openems.backend.common/src/io/openems/backend/common/jsonrpc/response/GetUserInformationResponse.java +++ b/io.openems.backend.common/src/io/openems/backend/common/jsonrpc/response/GetUserInformationResponse.java @@ -53,7 +53,7 @@ public JsonObject getResult() { .build(); String country = null; - Object[] array = ObjectUtils.getAsObjectArrray(this.userInformation.get("country_id")); + var array = ObjectUtils.getAsObjectArrray(this.userInformation.get("country_id")); if (array.length > 2) { country = ObjectUtils.getAsString(array[2]).toLowerCase(); } diff --git a/io.openems.backend.common/src/io/openems/backend/common/metadata/Edge.java b/io.openems.backend.common/src/io/openems/backend/common/metadata/Edge.java index 012a510e375..7dd13d00668 100644 --- a/io.openems.backend.common/src/io/openems/backend/common/metadata/Edge.java +++ b/io.openems.backend.common/src/io/openems/backend/common/metadata/Edge.java @@ -68,7 +68,7 @@ public EdgeConfig getConfig() { /** * Gets this {@link Edge} as {@link JsonObject}. - * + * * @return a {@link JsonObject} */ public JsonObject toJsonObject() { @@ -103,7 +103,7 @@ public String toString() { /** * Add a Listener for Set-Online events. - * + * * @param listener the listener */ public void onSetOnline(Consumer listener) { @@ -179,7 +179,7 @@ public State getState() { /** * Add a Listener for Set-Last-Message events. - * + * * @param listener the listener */ public void onSetLastMessage(Runnable listener) { @@ -217,7 +217,7 @@ public ZonedDateTime getLastMessageTimestamp() { /** * Add a Listener for Set-Last-Update events. - * + * * @param listener the listener */ public void onSetLastUpdate(Runnable listener) { @@ -259,7 +259,7 @@ public SemanticVersion getVersion() { /** * Add a Listener for Set-Version events. - * + * * @param listener the listener */ public void onSetVersion(Consumer listener) { @@ -303,7 +303,7 @@ public String getProducttype() { /** * Add a Listener for Set-Product-Type events. - * + * * @param listener the listener */ public void onSetProducttype(Consumer listener) { @@ -347,7 +347,7 @@ public Level getSumState() { /** * Add a Listener for Set-Sum-State events. - * + * * @param listener the listener */ public void onSetSumState(Consumer listener) { diff --git a/io.openems.backend.common/src/io/openems/backend/common/metadata/Metadata.java b/io.openems.backend.common/src/io/openems/backend/common/metadata/Metadata.java index 47033b1fa42..a2a2261a50e 100644 --- a/io.openems.backend.common/src/io/openems/backend/common/metadata/Metadata.java +++ b/io.openems.backend.common/src/io/openems/backend/common/metadata/Metadata.java @@ -20,7 +20,6 @@ import io.openems.common.types.ChannelAddress; import io.openems.common.types.EdgeConfig; import io.openems.common.types.EdgeConfig.Component.Channel; -import io.openems.common.types.EdgeConfig.Component.Channel.ChannelDetail; import io.openems.common.types.EdgeConfig.Component.Channel.ChannelDetailState; @ProviderType @@ -181,10 +180,10 @@ public static String activeStateChannelsToString( // Sort active State-Channels by Level and Component-ID var states = new HashMap>(); for (Entry entry : activeStateChannels.entrySet()) { - ChannelDetail detail = entry.getValue().getDetail(); + var detail = entry.getValue().getDetail(); if (detail instanceof ChannelDetailState) { var level = ((ChannelDetailState) detail).getLevel(); - HashMultimap channelsByComponent = states.get(level); + var channelsByComponent = states.get(level); if (channelsByComponent == null) { channelsByComponent = HashMultimap.create(); states.put(level, channelsByComponent); diff --git a/io.openems.backend.common/src/io/openems/backend/common/timedata/EdgeCache.java b/io.openems.backend.common/src/io/openems/backend/common/timedata/EdgeCache.java index b2b3d7c6f59..a86dae1b538 100644 --- a/io.openems.backend.common/src/io/openems/backend/common/timedata/EdgeCache.java +++ b/io.openems.backend.common/src/io/openems/backend/common/timedata/EdgeCache.java @@ -32,7 +32,7 @@ public class EdgeCache { /** * Gets the channel value from cache. - * + * * @param address the {@link ChannelAddress} of the channel * @return the value; empty if it is not in cache */ @@ -42,15 +42,15 @@ public final synchronized Optional getChannelValue(ChannelAddress a /** * Updates the 'incoming data' with the data from the cache. - * + * * @param edgeId the Edge-ID * @param incomingDatas the incoming data */ public synchronized void complementDataFromCache(String edgeId, SortedMap> incomingDatas) { for (Entry> entry : incomingDatas.entrySet()) { - Long incomingTimestamp = entry.getKey(); - Map incomingData = entry.getValue(); + var incomingTimestamp = entry.getKey(); + var incomingData = entry.getValue(); // Check if cache should be applied if (incomingTimestamp < this.cacheTimestamp) { diff --git a/io.openems.backend.core/src/io/openems/backend/core/jsonrpcrequesthandler/EdgeRpcRequestHandler.java b/io.openems.backend.core/src/io/openems/backend/core/jsonrpcrequesthandler/EdgeRpcRequestHandler.java index 5e17d13410e..c45c8bce362 100644 --- a/io.openems.backend.core/src/io/openems/backend/core/jsonrpcrequesthandler/EdgeRpcRequestHandler.java +++ b/io.openems.backend.core/src/io/openems/backend/core/jsonrpcrequesthandler/EdgeRpcRequestHandler.java @@ -1,8 +1,6 @@ package io.openems.backend.core.jsonrpcrequesthandler; -import java.time.ZonedDateTime; import java.util.Map; -import java.util.SortedMap; import java.util.UUID; import java.util.concurrent.CompletableFuture; @@ -134,7 +132,7 @@ protected CompletableFuture handleRequest(User user, UUID messa */ private CompletableFuture handleQueryHistoricDataRequest(String edgeId, User user, QueryHistoricTimeseriesDataRequest request) throws OpenemsNamedException { - SortedMap> historicData = this.parent.timeData + var historicData = this.parent.timeData .queryHistoricData(edgeId, request); // JSON-RPC response @@ -171,7 +169,7 @@ private CompletableFuture handleQueryHistoricEnergyReque */ private CompletableFuture handleQueryHistoricEnergyPerPeriodRequest(String edgeId, User user, QueryHistoricTimeseriesEnergyPerPeriodRequest request) throws OpenemsNamedException { - SortedMap> data = this.parent.timeData + var data = this.parent.timeData .queryHistoricEnergyPerPeriod(// edgeId, request.getFromDate(), request.getToDate(), request.getChannels(), request.getResolution()); diff --git a/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/OnNotification.java b/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/OnNotification.java index 8029c340b88..b5f348be317 100644 --- a/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/OnNotification.java +++ b/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/OnNotification.java @@ -121,7 +121,7 @@ private void handleTimestampedDataNotification(TimestampedDataNotification messa // set specific Edge values if (data.has("_sum/State") && data.get("_sum/State").isJsonPrimitive()) { - Level sumState = Level.fromJson(data, "_sum/State").orElse(Level.FAULT); + var sumState = Level.fromJson(data, "_sum/State").orElse(Level.FAULT); edge.setSumState(sumState); } diff --git a/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/OnOpen.java b/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/OnOpen.java index 0d2b120b0bd..228d2c8aeb9 100644 --- a/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/OnOpen.java +++ b/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/OnOpen.java @@ -24,7 +24,7 @@ public void run(WebSocket ws, JsonObject handshake) { // get websocket attachment WsData wsData = ws.getAttachment(); - String apikey = ""; + var apikey = ""; try { // get apikey from handshake var apikeyOpt = JsonUtils.getAsOptionalString(handshake, "apikey"); diff --git a/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/SystemLogHandler.java b/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/SystemLogHandler.java index 3ccf65b9bfd..798f23302ec 100644 --- a/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/SystemLogHandler.java +++ b/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/SystemLogHandler.java @@ -68,33 +68,32 @@ public CompletableFuture handleSubscribeSystemLogRequest // return this.parent.send(edgeId, request); } - } else { - /* - * End subscription - */ - boolean isAnySubscriptionForThisEdgeLeft; - synchronized (this.subscriptions) { - this.subscriptions.remove(edgeId, token); + } + /* + * End subscription + */ + boolean isAnySubscriptionForThisEdgeLeft; + synchronized (this.subscriptions) { + this.subscriptions.remove(edgeId, token); - isAnySubscriptionForThisEdgeLeft = this.subscriptions.containsKey(edgeId); - } + isAnySubscriptionForThisEdgeLeft = this.subscriptions.containsKey(edgeId); + } - if (isAnySubscriptionForThisEdgeLeft) { - // announce success - return CompletableFuture.completedFuture(new GenericJsonrpcResponseSuccess(request.getId())); + if (isAnySubscriptionForThisEdgeLeft) { + // announce success + return CompletableFuture.completedFuture(new GenericJsonrpcResponseSuccess(request.getId())); - } else { - // send unsubscribe to Edge - return this.sendSubscribe(edgeId, user, request, false); - // return this.parent.send(edgeId, request); - } + } else { + // send unsubscribe to Edge + return this.sendSubscribe(edgeId, user, request, false); + // return this.parent.send(edgeId, request); } } /** * Handles a {@link SystemLogNotification}, i.e. the replies to * {@link SubscribeSystemLogRequest}. - * + * * @param edgeId the Edge-ID * @param user the {@link User} * @param notification the {@link SystemLogNotification} diff --git a/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/WebsocketServer.java b/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/WebsocketServer.java index 67811fc1b52..0d63d02eff9 100644 --- a/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/WebsocketServer.java +++ b/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/WebsocketServer.java @@ -55,7 +55,7 @@ protected WsData createWsData() { /** * Is the given Edge online?. - * + * * @param edgeId the Edge-ID * @return true if it is online. */ diff --git a/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/WsData.java b/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/WsData.java index 7fa48cdbb15..99dd6fee4eb 100644 --- a/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/WsData.java +++ b/io.openems.backend.edgewebsocket/src/io/openems/backend/edgewebsocket/WsData.java @@ -35,7 +35,7 @@ public CompletableFuture isAuthenticated() { /** * Asserts that the User is authenticated within a timeout. - * + * * @param message a identification message on error * @param timeout the timeout length * @param unit the {@link TimeUnit} of the timeout @@ -90,7 +90,7 @@ public synchronized Optional getEdge(Metadata metadata) { /** * Asserts that the Edge-ID is present. - * + * * @param message a identification message on error * @return the Edge-ID * @throws OpenemsException on error diff --git a/io.openems.backend.metadata.file/src/io/openems/backend/metadata/file/FileMetadata.java b/io.openems.backend.metadata.file/src/io/openems/backend/metadata/file/FileMetadata.java index c10a63469d1..8004205413b 100644 --- a/io.openems.backend.metadata.file/src/io/openems/backend/metadata/file/FileMetadata.java +++ b/io.openems.backend.metadata.file/src/io/openems/backend/metadata/file/FileMetadata.java @@ -176,10 +176,10 @@ private synchronized void refreshData() { // parse to JSON try { - JsonElement config = JsonUtils.parse(sb.toString()); - JsonObject jEdges = JsonUtils.getAsJsonObject(config, "edges"); + var config = JsonUtils.parse(sb.toString()); + var jEdges = JsonUtils.getAsJsonObject(config, "edges"); for (Entry entry : jEdges.entrySet()) { - JsonObject edge = JsonUtils.getAsJsonObject(entry.getValue()); + var edge = JsonUtils.getAsJsonObject(entry.getValue()); edges.add(new MyEdge(// entry.getKey(), // Edge-ID JsonUtils.getAsString(edge, "apikey"), // diff --git a/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/OdooMetadata.java b/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/OdooMetadata.java index b4361fdbb67..6a3f02baabc 100644 --- a/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/OdooMetadata.java +++ b/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/OdooMetadata.java @@ -93,7 +93,7 @@ public User authenticate(String username, String password) throws OpenemsNamedEx */ @Override public User authenticate(String sessionId) throws OpenemsNamedException { - JsonObject result = this.odooHandler.authenticateSession(sessionId); + var result = this.odooHandler.authenticateSession(sessionId); // Parse Result var jDevices = JsonUtils.getAsJsonArray(result, "devices"); diff --git a/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/odoo/OdooHandler.java b/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/odoo/OdooHandler.java index c87ae4dbc27..977f22b79cf 100644 --- a/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/odoo/OdooHandler.java +++ b/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/odoo/OdooHandler.java @@ -426,7 +426,8 @@ public int submitSetupProtocol(MyUser user, JsonObject setupProtocolJson) throws var protocolId = this.createSetupProtocol(setupProtocolJson, foundEdge[0], customerId, installerId); - var installer = OdooUtils.readOne(credentials, Field.Partner.ODOO_MODEL, installerId, Field.Partner.IS_COMPANY); + var installer = OdooUtils.readOne(this.credentials, Field.Partner.ODOO_MODEL, installerId, + Field.Partner.IS_COMPANY); boolean isCompany = (boolean) installer.get("is_company"); if (!isCompany) { Map fieldsToUpdate = new HashMap<>(); @@ -436,7 +437,8 @@ public int submitSetupProtocol(MyUser user, JsonObject setupProtocolJson) throws .ifPresent(lastname -> fieldsToUpdate.put(Field.Partner.LASTNAME.id(), lastname)); if (!fieldsToUpdate.isEmpty()) { - OdooUtils.write(credentials, Field.Partner.ODOO_MODEL, new Integer[] { installerId }, fieldsToUpdate); + OdooUtils.write(this.credentials, Field.Partner.ODOO_MODEL, new Integer[] { installerId }, + fieldsToUpdate); } } @@ -488,7 +490,7 @@ private int createOdooUser(JsonObject userJson, String password) throws OpenemsN var email = JsonUtils.getAsString(userJson, "email").toLowerCase(); customerFields.put(Field.Partner.EMAIL.id(), email); - + JsonUtils.getAsOptionalString(userJson, "phone") // .ifPresent(phone -> customerFields.put(Field.Partner.PHONE.id(), phone)); @@ -525,7 +527,7 @@ private int createOdooUser(JsonObject userJson, String password) throws OpenemsN * @throws OpenemsException on error */ private void addTagToPartner(int userId) throws OpenemsException { - var tagId = OdooUtils.getObjectReference(credentials, "edge", "res_partner_category_created_via_ibn"); + var tagId = OdooUtils.getObjectReference(this.credentials, "edge", "res_partner_category_created_via_ibn"); var partnerId = this.getOdooPartnerId(userId); OdooUtils.write(this.credentials, Field.Partner.ODOO_MODEL, new Integer[] { partnerId }, diff --git a/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/InitializeEdgesWorker.java b/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/InitializeEdgesWorker.java index 9531bdbc180..fd00341b866 100644 --- a/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/InitializeEdgesWorker.java +++ b/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/InitializeEdgesWorker.java @@ -2,7 +2,6 @@ import java.sql.Connection; import java.sql.PreparedStatement; -import java.sql.ResultSet; import java.sql.SQLException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -54,8 +53,8 @@ public synchronized void stop() { /* * First: mark all Edges as offline */ - try (Connection con = self.dataSource.getConnection(); // - PreparedStatement pst = self.psUpdateAllEdgesOffline(con); // + try (var con = self.dataSource.getConnection(); // + var pst = self.psUpdateAllEdgesOffline(con); // ) { pst.execute(); } catch (SQLException e) { @@ -67,12 +66,12 @@ public synchronized void stop() { /** * Reads all Edges from Postgres and puts them in a local Cache. */ - try (Connection con = self.dataSource.getConnection(); // - PreparedStatement pst = self.psQueryAllEdges(con); // - ResultSet rs = pst.executeQuery(); // + try (var con = self.dataSource.getConnection(); // + var pst = self.psQueryAllEdges(con); // + var rs = pst.executeQuery(); // ) { self.parent.logInfo(this.log, "Caching Edges from Postgres"); - for (int i = 0; rs.next(); i++) { + for (var i = 0; rs.next(); i++) { if (i % 100 == 0) { self.parent.logInfo(this.log, "Caching Edges from Postgres. Finished [" + i + "]"); } diff --git a/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/PeriodicWriteWorker.java b/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/PeriodicWriteWorker.java index 7c2f23663f3..a5ecf010797 100644 --- a/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/PeriodicWriteWorker.java +++ b/io.openems.backend.metadata.odoo/src/io/openems/backend/metadata/odoo/postgres/PeriodicWriteWorker.java @@ -129,7 +129,7 @@ public void onLastUpdate(MyEdge edge) { public void isOnline(MyEdge edge) { synchronized (this.isOnlineOdooIds) { synchronized (this.isOfflineOdooIds) { - int odooId = edge.getOdooId(); + var odooId = edge.getOdooId(); this.isOfflineOdooIds.remove(odooId); this.isOnlineOdooIds.add(edge.getOdooId()); } @@ -144,7 +144,7 @@ public void isOnline(MyEdge edge) { public void isOffline(MyEdge edge) { synchronized (this.isOnlineOdooIds) { synchronized (this.isOfflineOdooIds) { - int odooId = edge.getOdooId(); + var odooId = edge.getOdooId(); this.isOnlineOdooIds.remove(odooId); this.isOfflineOdooIds.add(edge.getOdooId()); } diff --git a/io.openems.backend.timedata.dummy/src/io/openems/backend/timedata/dummy/TimedataDummy.java b/io.openems.backend.timedata.dummy/src/io/openems/backend/timedata/dummy/TimedataDummy.java index 85f6d788ef9..628fc8de2a3 100644 --- a/io.openems.backend.timedata.dummy/src/io/openems/backend/timedata/dummy/TimedataDummy.java +++ b/io.openems.backend.timedata.dummy/src/io/openems/backend/timedata/dummy/TimedataDummy.java @@ -49,7 +49,7 @@ private void deactivate() { @Override public Optional getChannelValue(String edgeId, ChannelAddress channelAddress) { - EdgeCache edgeCache = this.edgeCacheMap.get(edgeId); + var edgeCache = this.edgeCacheMap.get(edgeId); if (edgeCache != null) { return edgeCache.getChannelValue(channelAddress); } @@ -59,7 +59,7 @@ public Optional getChannelValue(String edgeId, ChannelAddress chann @Override public void write(String edgeId, TreeBasedTable data) throws OpenemsException { // get existing or create new EdgeCache - EdgeCache edgeCache = this.edgeCacheMap.get(edgeId); + var edgeCache = this.edgeCacheMap.get(edgeId); if (edgeCache == null) { edgeCache = new EdgeCache(); this.edgeCacheMap.put(edgeId, edgeCache); diff --git a/io.openems.backend.timedata.influx/src/io/openems/backend/timedata/influx/ChannelFormula.java b/io.openems.backend.timedata.influx/src/io/openems/backend/timedata/influx/ChannelFormula.java index 808c585368b..0f6c6398217 100644 --- a/io.openems.backend.timedata.influx/src/io/openems/backend/timedata/influx/ChannelFormula.java +++ b/io.openems.backend.timedata.influx/src/io/openems/backend/timedata/influx/ChannelFormula.java @@ -28,14 +28,15 @@ public ChannelFormula(Function function, int staticValue) { /** * Gets the Channel value. - * + * * @param cache an {@link EdgeCache} * @return the value */ public int getValue(EdgeCache cache) { if (this.address.isPresent()) { return cache.getChannelValue(this.address.get()).orElse(new JsonPrimitive(0)).getAsInt(); - } else if (this.staticValue.isPresent()) { + } + if (this.staticValue.isPresent()) { return this.staticValue.get(); } else { return 0; diff --git a/io.openems.backend.timedata.influx/src/io/openems/backend/timedata/influx/Influx.java b/io.openems.backend.timedata.influx/src/io/openems/backend/timedata/influx/Influx.java index 826bed38c64..969358cc112 100644 --- a/io.openems.backend.timedata.influx/src/io/openems/backend/timedata/influx/Influx.java +++ b/io.openems.backend.timedata.influx/src/io/openems/backend/timedata/influx/Influx.java @@ -2,7 +2,6 @@ import java.time.ZonedDateTime; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Optional; @@ -128,20 +127,20 @@ public void write(String edgeId, TreeBasedTable data) throws OpenemsException { - Set>> dataEntries = data.rowMap().entrySet(); + var dataEntries = data.rowMap().entrySet(); if (dataEntries.isEmpty()) { // no data to write return; } for (Entry> dataEntry : dataEntries) { - Set> channelEntries = dataEntry.getValue().entrySet(); + var channelEntries = dataEntry.getValue().entrySet(); if (channelEntries.isEmpty()) { // no points to add continue; } - Long timestamp = dataEntry.getKey(); + var timestamp = dataEntry.getKey(); // this builds an InfluxDB record ("point") for a given timestamp var builder = Point // .measurement(InfluxConnector.MEASUREMENT) // @@ -158,10 +157,10 @@ private void writeData(int influxEdgeId, TreeBasedTable * e.g. translates "edge0" to "0". - * + * * @param name the edge name * @return the number * @throws OpenemsException on error @@ -306,7 +305,7 @@ public Optional getChannelValue(String edgeId, ChannelAddress addre */ @Deprecated private Optional getCompatibilityChannelValue(ChannelFormula[] compatibility, EdgeCache cache) { - int value = 0; + var value = 0; for (ChannelFormula formula : compatibility) { switch (formula.getFunction()) { case PLUS: @@ -331,7 +330,7 @@ private ChannelFormula[] getCompatibilityFormula(Edge edge, ChannelAddress addre switch (address.getChannelId()) { case "EssSoc": { - List ids = config.getComponentsImplementingNature("EssNature"); + var ids = config.getComponentsImplementingNature("EssNature"); if (ids.size() > 0) { // take first result return new ChannelFormula[] { @@ -341,11 +340,11 @@ private ChannelFormula[] getCompatibilityFormula(Edge edge, ChannelAddress addre } case "EssActivePower": { - List asymmetricIds = config.getComponentsImplementingNature("AsymmetricEssNature"); - List symmetricIds = config.getComponentsImplementingNature("SymmetricEssNature"); + var asymmetricIds = config.getComponentsImplementingNature("AsymmetricEssNature"); + var symmetricIds = config.getComponentsImplementingNature("SymmetricEssNature"); symmetricIds.removeAll(asymmetricIds); var result = new ChannelFormula[asymmetricIds.size() * 3 + symmetricIds.size()]; - int i = 0; + var i = 0; for (String id : asymmetricIds) { result[i++] = new ChannelFormula(Function.PLUS, new ChannelAddress(id, "ActivePowerL1")); result[i++] = new ChannelFormula(Function.PLUS, new ChannelAddress(id, "ActivePowerL2")); @@ -413,18 +412,18 @@ private ChannelFormula[] getCompatibilityFormula(Edge edge, ChannelAddress addre ChannelFormula.class); case "ProductionAcActivePower": { - List ignoreIds = config.getComponentsImplementingNature("FeneconMiniConsumptionMeter"); + var ignoreIds = config.getComponentsImplementingNature("FeneconMiniConsumptionMeter"); ignoreIds.add("meter0"); - List asymmetricIds = config.getComponentsImplementingNature("AsymmetricMeterNature"); + var asymmetricIds = config.getComponentsImplementingNature("AsymmetricMeterNature"); asymmetricIds.removeAll(ignoreIds); - List symmetricIds = config.getComponentsImplementingNature("SymmetricMeterNature"); + var symmetricIds = config.getComponentsImplementingNature("SymmetricMeterNature"); symmetricIds.removeAll(ignoreIds); symmetricIds.removeAll(asymmetricIds); var result = new ChannelFormula[asymmetricIds.size() * 3 + symmetricIds.size()]; - int i = 0; + var i = 0; for (String id : asymmetricIds) { result[i++] = new ChannelFormula(Function.PLUS, new ChannelAddress(id, "ActivePowerL1")); result[i++] = new ChannelFormula(Function.PLUS, new ChannelAddress(id, "ActivePowerL2")); @@ -437,9 +436,9 @@ private ChannelFormula[] getCompatibilityFormula(Edge edge, ChannelAddress addre } case "ProductionDcActualPower": { - List ids = config.getComponentsImplementingNature("ChargerNature"); + var ids = config.getComponentsImplementingNature("ChargerNature"); var result = new ChannelFormula[ids.size()]; - for (int i = 0; i < ids.size(); i++) { + for (var i = 0; i < ids.size(); i++) { result[i] = new ChannelFormula(Function.PLUS, new ChannelAddress(ids.get(i), "ActualPower")); } return result; diff --git a/io.openems.backend.uiwebsocket/src/io/openems/backend/uiwebsocket/impl/OnRequest.java b/io.openems.backend.uiwebsocket/src/io/openems/backend/uiwebsocket/impl/OnRequest.java index 0bb168fa346..f5359be9f49 100644 --- a/io.openems.backend.uiwebsocket/src/io/openems/backend/uiwebsocket/impl/OnRequest.java +++ b/io.openems.backend.uiwebsocket/src/io/openems/backend/uiwebsocket/impl/OnRequest.java @@ -348,7 +348,7 @@ private CompletableFuture handleSetUserInformatio */ private CompletableFuture handleSubmitSetupProtocolRequest(User user, SubmitSetupProtocolRequest request) throws OpenemsNamedException { - int protocolId = this.parent.metadata.submitSetupProtocol(user, request.getJsonObject()); + var protocolId = this.parent.metadata.submitSetupProtocol(user, request.getJsonObject()); var response = JsonUtils.buildJsonObject() // .addProperty("setupProtocolId", protocolId) // diff --git a/io.openems.common/src/io/openems/common/channel/PersistencePriority.java b/io.openems.common/src/io/openems/common/channel/PersistencePriority.java index 421cb3c953a..d59b1a2fb62 100644 --- a/io.openems.common/src/io/openems/common/channel/PersistencePriority.java +++ b/io.openems.common/src/io/openems/common/channel/PersistencePriority.java @@ -18,7 +18,7 @@ private PersistencePriority(int value) { /** * Is this {@link PersistencePriority} at least as high as the given * {@link PersistencePriority}?. - * + * * @param other the given {@link PersistencePriority} * @return true if this is equal or higher than other */ @@ -29,7 +29,7 @@ public boolean isAtLeast(PersistencePriority other) { /** * Is this {@link PersistencePriority} at lower than the given * {@link PersistencePriority}?. - * + * * @param other the given {@link PersistencePriority} * @return true if this is strictly lower than other */ diff --git a/io.openems.common/src/io/openems/common/channel/Unit.java b/io.openems.common/src/io/openems/common/channel/Unit.java index 5f4d23d0e58..12bbe1d1a81 100644 --- a/io.openems.common/src/io/openems/common/channel/Unit.java +++ b/io.openems.common/src/io/openems/common/channel/Unit.java @@ -262,7 +262,7 @@ public Unit getBaseUnit() { /** * Gets the value in its base unit, e.g. converts [kW] to [W]. - * + * * @param value the value * @return the converted value */ @@ -276,11 +276,11 @@ public String getSymbol() { /** * Formats the value in the given type. - * + * *

* For most cases this adds the unit symbol to the value, like "123 kW". * Booleans are converted to "ON" or "OFF". - * + * * @param value the value {@link Object} * @param type the {@link OpenemsType} * @return the formatted value as String diff --git a/io.openems.common/src/io/openems/common/exceptions/OpenemsError.java b/io.openems.common/src/io/openems/common/exceptions/OpenemsError.java index b5ab6f7fb2c..f151619768a 100644 --- a/io.openems.common/src/io/openems/common/exceptions/OpenemsError.java +++ b/io.openems.common/src/io/openems/common/exceptions/OpenemsError.java @@ -118,7 +118,7 @@ public String getRawMessage() { /** * Gets the formatted Error message. - * + * * @param params the error parameters * @return the error message as String */ diff --git a/io.openems.common/src/io/openems/common/function/ThrowingRunnable.java b/io.openems.common/src/io/openems/common/function/ThrowingRunnable.java index dee8fb4493a..04b1fc9fafa 100644 --- a/io.openems.common/src/io/openems/common/function/ThrowingRunnable.java +++ b/io.openems.common/src/io/openems/common/function/ThrowingRunnable.java @@ -14,7 +14,7 @@ public interface ThrowingRunnable { * When an object implementing interface Runnable is used to create * a thread, starting the thread causes the object's run method to * be called in that separately executing thread. - * + * *

* The general contract of the method run is that it may take any * action whatsoever. diff --git a/io.openems.common/src/io/openems/common/jsonrpc/base/AbstractJsonrpcRequest.java b/io.openems.common/src/io/openems/common/jsonrpc/base/AbstractJsonrpcRequest.java index ee495898592..72acbaf6702 100644 --- a/io.openems.common/src/io/openems/common/jsonrpc/base/AbstractJsonrpcRequest.java +++ b/io.openems.common/src/io/openems/common/jsonrpc/base/AbstractJsonrpcRequest.java @@ -25,7 +25,7 @@ public String getMethod() { /** * Gets the params {@link JsonObject} of the {@link JsonrpcRequest}. - * + * * @return the params as {@link JsonObject} */ public abstract JsonObject getParams(); diff --git a/io.openems.common/src/io/openems/common/jsonrpc/base/GenericJsonrpcNotification.java b/io.openems.common/src/io/openems/common/jsonrpc/base/GenericJsonrpcNotification.java index 2fb014b81ed..69080267aa0 100644 --- a/io.openems.common/src/io/openems/common/jsonrpc/base/GenericJsonrpcNotification.java +++ b/io.openems.common/src/io/openems/common/jsonrpc/base/GenericJsonrpcNotification.java @@ -23,7 +23,7 @@ public class GenericJsonrpcNotification extends JsonrpcNotification { /** * Parses a JSON String to a {@link GenericJsonrpcNotification}. - * + * * @param json the JSON String * @return the {@link GenericJsonrpcNotification} * @throws OpenemsNamedException on error @@ -34,7 +34,7 @@ public static GenericJsonrpcNotification from(String json) throws OpenemsNamedEx /** * Parses a {@link JsonObject} to a {@link GenericJsonrpcNotification}. - * + * * @param j the {@link JsonObject} * @return the {@link GenericJsonrpcNotification} * @throws OpenemsNamedException on error diff --git a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcMessage.java b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcMessage.java index 5121fcf4ee0..2b4ad440394 100644 --- a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcMessage.java +++ b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcMessage.java @@ -26,7 +26,7 @@ public abstract class JsonrpcMessage { /** * Parses a JSON String to a {@link JsonrpcMessage}. - * + * * @param json the JSON String * @return the {@link JsonrpcMessage} * @throws OpenemsNamedException on error @@ -37,7 +37,7 @@ public static JsonrpcMessage from(String json) throws OpenemsNamedException { /** * Parses a {@link JsonObject} to a {@link JsonrpcMessage}. - * + * * @param j the {@link JsonObject} * @return the {@link JsonrpcMessage} * @throws OpenemsNamedException on error @@ -46,15 +46,15 @@ public static JsonrpcMessage from(JsonObject j) throws OpenemsNamedException { if (j.has("method") && j.has("params")) { if (j.has("id")) { return GenericJsonrpcRequest.from(j); - } else { - return GenericJsonrpcNotification.from(j); } + return GenericJsonrpcNotification.from(j); } if (j.has("result")) { return JsonrpcResponseSuccess.from(j); - } else if (j.has("error")) { + } + if (j.has("error")) { return JsonrpcResponseError.from(j); } throw new OpenemsException( @@ -63,7 +63,7 @@ public static JsonrpcMessage from(JsonObject j) throws OpenemsNamedException { /** * Gets the {@link JsonObject} representation of this {@link JsonrpcMessage}. - * + * * @return a {@link JsonObject} */ public JsonObject toJsonObject() { diff --git a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponse.java b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponse.java index 1b1ebfba338..87bf060e807 100644 --- a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponse.java +++ b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponse.java @@ -27,7 +27,7 @@ public abstract class JsonrpcResponse extends JsonrpcMessage { /** * Parses a JSON String to a {@link JsonrpcResponse}. - * + * * @param json the JSON String * @return the {@link JsonrpcResponse} * @throws OpenemsNamedException on error @@ -38,7 +38,7 @@ public static JsonrpcResponse from(String json) throws OpenemsNamedException { /** * Parses a {@link JsonObject} to a {@link JsonrpcResponse}. - * + * * @param j the {@link JsonObject} * @return the {@link JsonrpcResponse} * @throws OpenemsNamedException on error @@ -47,7 +47,8 @@ public static JsonrpcResponse from(JsonObject j) throws OpenemsNamedException { var id = UUID.fromString(JsonUtils.getAsString(j, "id")); if (j.has("result")) { return new GenericJsonrpcResponseSuccess(id, JsonUtils.getAsJsonObject(j, "result")); - } else if (j.has("error")) { + } + if (j.has("error")) { return JsonrpcResponseError.from(j); } throw new OpenemsException("Unable to parse JsonrpcResponse from " + StringUtils.toShortString(j, 100)); diff --git a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseError.java b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseError.java index 1a1d9e41a00..5514f047e87 100644 --- a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseError.java +++ b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseError.java @@ -37,7 +37,7 @@ public class JsonrpcResponseError extends JsonrpcResponse { /** * Parses a JSON String to a {@link JsonrpcResponseError}. - * + * * @param json the JSON String * @return the {@link JsonrpcResponseError} * @throws OpenemsNamedException on error @@ -48,7 +48,7 @@ public static JsonrpcResponseError from(String json) throws OpenemsNamedExceptio /** * Parses a {@link JsonObject} to a {@link JsonrpcResponseError}. - * + * * @param j the {@link JsonObject} * @return the {@link JsonrpcResponseError} * @throws OpenemsNamedException on error @@ -136,7 +136,7 @@ public JsonArray getParams() { /** * Gets the error message parameters as Object array. - * + * * @return the array of error message parameters */ public Object[] getParamsAsObjectArray() { diff --git a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseSuccess.java b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseSuccess.java index f5f5ea35307..05dae9f3b4e 100644 --- a/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseSuccess.java +++ b/io.openems.common/src/io/openems/common/jsonrpc/base/JsonrpcResponseSuccess.java @@ -52,7 +52,7 @@ public JsonObject toJsonObject() { /** * Gets the result of this {@link JsonrpcResponseSuccess}. - * + * * @return a JsonObject with the 'result' property of the response */ public abstract JsonObject getResult(); diff --git a/io.openems.common/src/io/openems/common/jsonrpc/notification/CurrentDataNotification.java b/io.openems.common/src/io/openems/common/jsonrpc/notification/CurrentDataNotification.java index c413d92e88c..482e4007095 100644 --- a/io.openems.common/src/io/openems/common/jsonrpc/notification/CurrentDataNotification.java +++ b/io.openems.common/src/io/openems/common/jsonrpc/notification/CurrentDataNotification.java @@ -36,7 +36,7 @@ public CurrentDataNotification() { /** * Add a Channel value. - * + * * @param channel the {@link ChannelAddress} * @param value the value as {@link JsonElement} */ diff --git a/io.openems.common/src/io/openems/common/jsonrpc/notification/EdgeConfigNotification.java b/io.openems.common/src/io/openems/common/jsonrpc/notification/EdgeConfigNotification.java index 381fa095206..9badf79766c 100644 --- a/io.openems.common/src/io/openems/common/jsonrpc/notification/EdgeConfigNotification.java +++ b/io.openems.common/src/io/openems/common/jsonrpc/notification/EdgeConfigNotification.java @@ -24,7 +24,7 @@ public class EdgeConfigNotification extends JsonrpcNotification { /** * Parses a {@link JsonObject} to a {@link EdgeConfigNotification}. - * + * * @param j the {@link JsonObject} * @return the {@link EdgeConfigNotification} * @throws OpenemsNamedException on error @@ -35,7 +35,7 @@ public static EdgeConfigNotification from(JsonObject j) throws OpenemsNamedExcep /** * Parses a {@link JsonrpcNotification} to a {@link EdgeConfigNotification}. - * + * * @param n the {@link JsonrpcNotification} * @return the {@link EdgeConfigNotification} * @throws OpenemsNamedException on error diff --git a/io.openems.common/src/io/openems/common/jsonrpc/notification/SystemLogNotification.java b/io.openems.common/src/io/openems/common/jsonrpc/notification/SystemLogNotification.java index ba9ad793684..34789641d75 100644 --- a/io.openems.common/src/io/openems/common/jsonrpc/notification/SystemLogNotification.java +++ b/io.openems.common/src/io/openems/common/jsonrpc/notification/SystemLogNotification.java @@ -30,7 +30,7 @@ public class SystemLogNotification extends JsonrpcNotification { /** * Parses a {@link JsonrpcNotification} to a {@link SystemLogNotification}. - * + * * @param n the {@link JsonrpcNotification} * @return the {@link SystemLogNotification} * @throws OpenemsNamedException on error @@ -43,7 +43,7 @@ public static SystemLogNotification from(JsonrpcNotification n) throws OpenemsNa /** * Creates a {@link SystemLogNotification} from a {@link PaxLoggingEvent}. - * + * * @param event the {@link PaxLoggingEvent} * @return the {@link SystemLogNotification} */ diff --git a/io.openems.common/src/io/openems/common/jsonrpc/notification/TimestampedDataNotification.java b/io.openems.common/src/io/openems/common/jsonrpc/notification/TimestampedDataNotification.java index b907dec4f19..3489fd6eec1 100644 --- a/io.openems.common/src/io/openems/common/jsonrpc/notification/TimestampedDataNotification.java +++ b/io.openems.common/src/io/openems/common/jsonrpc/notification/TimestampedDataNotification.java @@ -33,7 +33,7 @@ public class TimestampedDataNotification extends JsonrpcNotification { /** * Parses a {@link JsonrpcNotification} to a * {@link TimestampedDataNotification}. - * + * * @param n the {@link JsonrpcNotification} * @return the {@link TimestampedDataNotification} * @throws OpenemsNamedException on error @@ -42,8 +42,8 @@ public static TimestampedDataNotification from(JsonrpcNotification n) throws Ope var result = new TimestampedDataNotification(); var j = n.getParams(); for (Entry e1 : j.entrySet()) { - long timestamp = Long.parseLong(e1.getKey()); - JsonObject jTime = JsonUtils.getAsJsonObject(e1.getValue()); + var timestamp = Long.parseLong(e1.getKey()); + var jTime = JsonUtils.getAsJsonObject(e1.getValue()); for (Entry e2 : jTime.entrySet()) { result.add(timestamp, ChannelAddress.fromString(e2.getKey()), e2.getValue()); } @@ -61,7 +61,7 @@ public TimestampedDataNotification() { /** * Add timestamped data. - * + * * @param timestamp the timestamp epoch in milliseconds * @param data a map of {@link ChannelAddress} to {@link JsonElement} value */ @@ -73,7 +73,7 @@ public void add(long timestamp, Map data) { /** * Add a timestamped value. - * + * * @param timestamp the timestamp epoch in milliseconds * @param address the {@link ChannelAddress} * @param value the {@link JsonElement} value @@ -88,8 +88,8 @@ public JsonObject getParams() { for (Entry> e1 : this.data.rowMap().entrySet()) { var jTime = new JsonObject(); for (Entry e2 : e1.getValue().entrySet()) { - ChannelAddress address = e2.getKey(); - JsonElement value = e2.getValue(); + var address = e2.getKey(); + var value = e2.getValue(); jTime.add(address.toString(), value); } p.add(e1.getKey().toString(), jTime); diff --git a/io.openems.common/src/io/openems/common/jsonrpc/request/AuthenticatedRpcRequest.java b/io.openems.common/src/io/openems/common/jsonrpc/request/AuthenticatedRpcRequest.java index c72b223e55e..8ba66deae9a 100644 --- a/io.openems.common/src/io/openems/common/jsonrpc/request/AuthenticatedRpcRequest.java +++ b/io.openems.common/src/io/openems/common/jsonrpc/request/AuthenticatedRpcRequest.java @@ -53,14 +53,14 @@ public class AuthenticatedRpcRequest extends JsonrpcR * "role": {@link Role} * } * - * + * * @return the {@link AuthenticatedRpcRequest} * @throws OpenemsNamedException on parse error */ public static AuthenticatedRpcRequest from(JsonrpcRequest r, ThrowingFunction userFactory) throws OpenemsNamedException { var p = r.getParams(); - USER user = userFactory.apply(JsonUtils.getAsJsonObject(p, "user")); + var user = userFactory.apply(JsonUtils.getAsJsonObject(p, "user")); JsonrpcRequest payload = GenericJsonrpcRequest.from(JsonUtils.getAsJsonObject(p, "payload")); return new AuthenticatedRpcRequest<>(r, Optional.empty(), user, payload); } diff --git a/io.openems.common/src/io/openems/common/jsonrpc/request/QueryHistoricTimeseriesEnergyPerPeriodRequest.java b/io.openems.common/src/io/openems/common/jsonrpc/request/QueryHistoricTimeseriesEnergyPerPeriodRequest.java index 89132dcac96..665295456a0 100644 --- a/io.openems.common/src/io/openems/common/jsonrpc/request/QueryHistoricTimeseriesEnergyPerPeriodRequest.java +++ b/io.openems.common/src/io/openems/common/jsonrpc/request/QueryHistoricTimeseriesEnergyPerPeriodRequest.java @@ -60,8 +60,7 @@ public static QueryHistoricTimeseriesEnergyPerPeriodRequest from(JsonrpcRequest var fromDate = JsonUtils.getAsZonedDateTime(p, "fromDate", timezone); var toDate = JsonUtils.getAsZonedDateTime(p, "toDate", timezone).plusDays(1); var resolution = JsonUtils.getAsInt(p, "resolution"); - var result = new QueryHistoricTimeseriesEnergyPerPeriodRequest(r, - fromDate, toDate, resolution); + var result = new QueryHistoricTimeseriesEnergyPerPeriodRequest(r, fromDate, toDate, resolution); var channels = JsonUtils.getAsJsonArray(p, "channels"); for (JsonElement channel : channels) { var address = ChannelAddress.fromString(JsonUtils.getAsString(channel)); diff --git a/io.openems.common/src/io/openems/common/jsonrpc/request/UpdateUserLanguageRequest.java b/io.openems.common/src/io/openems/common/jsonrpc/request/UpdateUserLanguageRequest.java index 51db5ed9377..62f47bc51cd 100644 --- a/io.openems.common/src/io/openems/common/jsonrpc/request/UpdateUserLanguageRequest.java +++ b/io.openems.common/src/io/openems/common/jsonrpc/request/UpdateUserLanguageRequest.java @@ -9,7 +9,7 @@ /** * Updates the User Language. - * + * *

  * {
  *   "jsonrpc": "2.0",
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/response/AuthenticatedRpcResponse.java b/io.openems.common/src/io/openems/common/jsonrpc/response/AuthenticatedRpcResponse.java
index 01d8e1ccd0d..1c6e7bcbbd2 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/response/AuthenticatedRpcResponse.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/response/AuthenticatedRpcResponse.java
@@ -26,7 +26,7 @@ public class AuthenticatedRpcResponse extends JsonrpcResponseSuccess {
 	/**
 	 * Parses a {@link JsonrpcResponseSuccess} to a
 	 * {@link AuthenticatedRpcResponse}.
-	 * 
+	 *
 	 * @param r the {@link JsonrpcResponseSuccess}
 	 * @return the {@link AuthenticatedRpcResponse}
 	 * @throws OpenemsNamedException on error
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesDataResponse.java b/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesDataResponse.java
index d272193270b..43318065d8f 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesDataResponse.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesDataResponse.java
@@ -60,9 +60,9 @@ public JsonObject getResult() {
 		var data = new JsonObject();
 		for (Entry> rowEntry : this.table.entrySet()) {
 			for (Entry colEntry : rowEntry.getValue().entrySet()) {
-				String channelAddress = colEntry.getKey().toString();
-				JsonElement value = colEntry.getValue();
-				JsonElement channelValuesElement = data.get(channelAddress);
+				var channelAddress = colEntry.getKey().toString();
+				var value = colEntry.getValue();
+				var channelValuesElement = data.get(channelAddress);
 				JsonArray channelValues;
 				if (channelValuesElement != null) {
 					channelValues = channelValuesElement.getAsJsonArray();
diff --git a/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesEnergyPerPeriodResponse.java b/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesEnergyPerPeriodResponse.java
index 1a67899ae81..81767988916 100644
--- a/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesEnergyPerPeriodResponse.java
+++ b/io.openems.common/src/io/openems/common/jsonrpc/response/QueryHistoricTimeseriesEnergyPerPeriodResponse.java
@@ -61,9 +61,9 @@ public JsonObject getResult() {
 		var data = new JsonObject();
 		for (Entry> rowEntry : this.table.entrySet()) {
 			for (Entry colEntry : rowEntry.getValue().entrySet()) {
-				String channelAddress = colEntry.getKey().toString();
-				JsonElement value = colEntry.getValue();
-				JsonElement channelValuesElement = data.get(channelAddress);
+				var channelAddress = colEntry.getKey().toString();
+				var value = colEntry.getValue();
+				var channelValuesElement = data.get(channelAddress);
 				JsonArray channelValues;
 				if (channelValuesElement != null) {
 					channelValues = channelValuesElement.getAsJsonArray();
diff --git a/io.openems.common/src/io/openems/common/timedata/CommonTimedataService.java b/io.openems.common/src/io/openems/common/timedata/CommonTimedataService.java
index 544c9ddd906..83edab7f4ab 100644
--- a/io.openems.common/src/io/openems/common/timedata/CommonTimedataService.java
+++ b/io.openems.common/src/io/openems/common/timedata/CommonTimedataService.java
@@ -28,10 +28,10 @@ public interface CommonTimedataService {
 	 */
 	public default QueryHistoricTimeseriesExportXlsxResponse handleQueryHistoricTimeseriesExportXlxsRequest(
 			String edgeId, QueryHistoricTimeseriesExportXlxsRequest request) throws OpenemsNamedException {
-		SortedMap> powerData = this.queryHistoricData(edgeId,
+		var powerData = this.queryHistoricData(edgeId,
 				request.getFromDate(), request.getToDate(), QueryHistoricTimeseriesExportXlsxResponse.POWER_CHANNELS,
 				15 * 60 /* 15 Minutes */);
-		SortedMap energyData = this.queryHistoricEnergy(edgeId, request.getFromDate(),
+		var energyData = this.queryHistoricEnergy(edgeId, request.getFromDate(),
 				request.getToDate(), QueryHistoricTimeseriesExportXlsxResponse.ENERGY_CHANNELS);
 
 		try {
@@ -50,7 +50,7 @@ public default QueryHistoricTimeseriesExportXlsxResponse handleQueryHistoricTime
 	 * @return the resolution in seconds
 	 */
 	public static int calculateResolution(ZonedDateTime fromDate, ZonedDateTime toDate) {
-		int days = Period.between(fromDate.toLocalDate(), toDate.toLocalDate()).getDays();
+		var days = Period.between(fromDate.toLocalDate(), toDate.toLocalDate()).getDays();
 		int resolution;
 		if (days <= 1) {
 			resolution = 5 * 60; // 5 Minutes
diff --git a/io.openems.common/src/io/openems/common/types/ChannelAddress.java b/io.openems.common/src/io/openems/common/types/ChannelAddress.java
index a302955f8f7..1d0b4eef915 100644
--- a/io.openems.common/src/io/openems/common/types/ChannelAddress.java
+++ b/io.openems.common/src/io/openems/common/types/ChannelAddress.java
@@ -99,16 +99,18 @@ public boolean equals(Object obj) {
 	 * @return an integer value representing the degree of matching
 	 */
 	public static int match(ChannelAddress source, ChannelAddress pattern) {
-		int componentIdMatch = StringUtils.matchWildcard(source.componentId, pattern.componentId);
-		int channelIdMatch = StringUtils.matchWildcard(source.channelId, pattern.channelId);
+		var componentIdMatch = StringUtils.matchWildcard(source.componentId, pattern.componentId);
+		var channelIdMatch = StringUtils.matchWildcard(source.channelId, pattern.channelId);
 		if (componentIdMatch < 0 || channelIdMatch < 0) {
 			return -1;
-		} else if (componentIdMatch == 0 && channelIdMatch == 0) {
+		}
+		if (componentIdMatch == 0 && channelIdMatch == 0) {
 			return 0;
 		}
 		if (componentIdMatch == 0) {
 			return Integer.MAX_VALUE / 2 + channelIdMatch;
-		} else if (channelIdMatch == 0) {
+		}
+		if (channelIdMatch == 0) {
 			return Integer.MAX_VALUE / 2 + componentIdMatch;
 		} else {
 			return componentIdMatch + channelIdMatch;
diff --git a/io.openems.common/src/io/openems/common/types/ConfigurationProperty.java b/io.openems.common/src/io/openems/common/types/ConfigurationProperty.java
index f98280a21c2..7f49d3c4fe7 100644
--- a/io.openems.common/src/io/openems/common/types/ConfigurationProperty.java
+++ b/io.openems.common/src/io/openems/common/types/ConfigurationProperty.java
@@ -21,7 +21,7 @@ public class ConfigurationProperty {
 
 	/**
 	 * Creates a {@link ConfigurationProperty} object from a value.
-	 * 
+	 *
 	 * @param    the type of the value
 	 * @param value the value
 	 * @return the {@link ConfigurationProperty}
@@ -32,7 +32,7 @@ public static  ConfigurationProperty of(T value) {
 
 	/**
 	 * Creates a {@link ConfigurationProperty} object with 'null' value.
-	 * 
+	 *
 	 * @param  the type of the value
 	 * @return the {@link ConfigurationProperty}
 	 */
@@ -42,7 +42,7 @@ public static  ConfigurationProperty asNull() {
 
 	/**
 	 * Creates a {@link ConfigurationProperty} object with 'not set' value.
-	 * 
+	 *
 	 * @param  the type of the value
 	 * @return the {@link ConfigurationProperty}
 	 */
@@ -53,7 +53,7 @@ public static  ConfigurationProperty asNotSet() {
 	/**
 	 * Creates a {@link ConfigurationProperty} object from a {@link JsonElement}
 	 * value.
-	 * 
+	 *
 	 * @param       the type of the value
 	 * @param element  the {@link JsonElement} value
 	 * @param function conversion function from {@link JsonElement} to type T
@@ -64,7 +64,8 @@ public static  ConfigurationProperty fromJsonElement(Optional
 			ThrowingFunction function) throws OpenemsNamedException {
 		if (!element.isPresent()) {
 			return ConfigurationProperty.asNotSet();
-		} else if (element.get().isJsonNull()) {
+		}
+		if (element.get().isJsonNull()) {
 			return ConfigurationProperty.asNull();
 		} else {
 			return ConfigurationProperty.of(function.apply(element.get()));
diff --git a/io.openems.common/src/io/openems/common/types/EdgeConfig.java b/io.openems.common/src/io/openems/common/types/EdgeConfig.java
index 9c18c72948b..12f507aaa35 100644
--- a/io.openems.common/src/io/openems/common/types/EdgeConfig.java
+++ b/io.openems.common/src/io/openems/common/types/EdgeConfig.java
@@ -179,8 +179,8 @@ public static Channel fromJson(String channelId, JsonElement json) throws Openem
 					}
 				}
 				var text = JsonUtils.getAsOptionalString(json, "text").orElse("");
-				Unit unit = JsonUtils.getAsOptionalEnum(Unit.class, json, "unit").orElse(Unit.NONE);
-				ChannelCategory category = JsonUtils.getAsOptionalEnum(ChannelCategory.class, json, "category")
+				var unit = JsonUtils.getAsOptionalEnum(Unit.class, json, "unit").orElse(Unit.NONE);
+				var category = JsonUtils.getAsOptionalEnum(ChannelCategory.class, json, "category")
 						.orElse(ChannelCategory.OPENEMS_TYPE);
 				ChannelDetail detail = null;
 				switch (category) {
@@ -202,7 +202,7 @@ public static Channel fromJson(String channelId, JsonElement json) throws Openem
 				}
 
 				case STATE: {
-					Level level = JsonUtils.getAsEnum(Level.class, json, "level");
+					var level = JsonUtils.getAsEnum(Level.class, json, "level");
 					detail = new ChannelDetailState(level);
 					break;
 				}
@@ -319,7 +319,7 @@ public Component(String servicePid, String id, String alias, String factoryId,
 
 		/**
 		 * Constructor with NO_SERVICE_PID.
-		 * 
+		 *
 		 * @param id         the Component-ID
 		 * @param alias      the Alias
 		 * @param factoryId  the Factory-ID
@@ -333,7 +333,7 @@ public Component(String id, String alias, String factoryId, SortedMap getProperty(String propertyId) {
 		 * @return the Property
 		 */
 		public JsonElement getPropertyOrError(String propertyId) throws InvalidValueException {
-			JsonElement property = this.properties.get(propertyId);
+			var property = this.properties.get(propertyId);
 			if (property != null) {
 				return property;
 			}
@@ -758,44 +758,43 @@ private static JsonObject getSchema(AttributeDefinition ad) {
 									.build()) //
 							.build();
 
-				} else {
-					// generate schema from AttributeDefinition Type
-					switch (ad.getType()) {
-					case AttributeDefinition.STRING:
-					case AttributeDefinition.CHARACTER:
-						return JsonUtils.buildJsonObject() //
-								.addProperty("type", "input") //
-								.add("templateOptions", JsonUtils.buildJsonObject() //
-										.addProperty("type", "text") //
-										.build()) //
-								.build();
-
-					case AttributeDefinition.LONG:
-					case AttributeDefinition.INTEGER:
-					case AttributeDefinition.SHORT:
-					case AttributeDefinition.DOUBLE:
-					case AttributeDefinition.FLOAT:
-					case AttributeDefinition.BYTE:
-						return JsonUtils.buildJsonObject() //
-								.addProperty("type", "input") //
-								.add("templateOptions", JsonUtils.buildJsonObject() //
-										.addProperty("type", "number") //
-										.build()) //
-								.build();
-
-					case AttributeDefinition.PASSWORD:
-						return JsonUtils.buildJsonObject() //
-								.addProperty("type", "input") //
-								.add("templateOptions", JsonUtils.buildJsonObject() //
-										.addProperty("type", "password") //
-										.build()) //
-								.build();
-
-					case AttributeDefinition.BOOLEAN:
-						return JsonUtils.buildJsonObject() //
-								.addProperty("type", "toggle") //
-								.build();
-					}
+				}
+				// generate schema from AttributeDefinition Type
+				switch (ad.getType()) {
+				case AttributeDefinition.STRING:
+				case AttributeDefinition.CHARACTER:
+					return JsonUtils.buildJsonObject() //
+							.addProperty("type", "input") //
+							.add("templateOptions", JsonUtils.buildJsonObject() //
+									.addProperty("type", "text") //
+									.build()) //
+							.build();
+
+				case AttributeDefinition.LONG:
+				case AttributeDefinition.INTEGER:
+				case AttributeDefinition.SHORT:
+				case AttributeDefinition.DOUBLE:
+				case AttributeDefinition.FLOAT:
+				case AttributeDefinition.BYTE:
+					return JsonUtils.buildJsonObject() //
+							.addProperty("type", "input") //
+							.add("templateOptions", JsonUtils.buildJsonObject() //
+									.addProperty("type", "number") //
+									.build()) //
+							.build();
+
+				case AttributeDefinition.PASSWORD:
+					return JsonUtils.buildJsonObject() //
+							.addProperty("type", "input") //
+							.add("templateOptions", JsonUtils.buildJsonObject() //
+									.addProperty("type", "password") //
+									.build()) //
+							.build();
+
+				case AttributeDefinition.BOOLEAN:
+					return JsonUtils.buildJsonObject() //
+							.addProperty("type", "toggle") //
+							.build();
 				}
 
 				return schema;
@@ -812,7 +811,7 @@ public static Property fromJson(JsonElement json) throws OpenemsNamedException {
 				var id = JsonUtils.getAsString(json, "id");
 				var name = JsonUtils.getAsString(json, "name");
 				var description = JsonUtils.getAsString(json, "description");
-				OpenemsType type = JsonUtils.getAsOptionalEnum(OpenemsType.class, json, "type")
+				var type = JsonUtils.getAsOptionalEnum(OpenemsType.class, json, "type")
 						.orElse(OpenemsType.STRING);
 				var isRequired = JsonUtils.getAsBoolean(json, "isRequired");
 				boolean isPassword = JsonUtils.getAsOptionalBoolean(json, "isPassword").orElse(false);
@@ -1108,7 +1107,7 @@ public Optional getComponent(String componentId) {
 	 * @return the {@link Component}
 	 */
 	public Component getComponentOrError(String componentId) throws InvalidValueException {
-		Component component = this.components.get(componentId);
+		var component = this.components.get(componentId);
 		if (component != null) {
 			return component;
 		}
diff --git a/io.openems.common/src/io/openems/common/types/EdgeConfigDiff.java b/io.openems.common/src/io/openems/common/types/EdgeConfigDiff.java
index d1d90f9f0a8..9741d7cfd98 100644
--- a/io.openems.common/src/io/openems/common/types/EdgeConfigDiff.java
+++ b/io.openems.common/src/io/openems/common/types/EdgeConfigDiff.java
@@ -57,8 +57,8 @@ public static EdgeConfigDiff diff(EdgeConfig newConfig, EdgeConfig oldConfig) {
 		if (!diffComponents.entriesDiffering().isEmpty()) {
 			for (Entry> differingComponent : diffComponents
 					.entriesDiffering().entrySet()) {
-				EdgeConfig.Component newComponent = differingComponent.getValue().leftValue();
-				EdgeConfig.Component oldComponent = differingComponent.getValue().rightValue();
+				var newComponent = differingComponent.getValue().leftValue();
+				var oldComponent = differingComponent.getValue().rightValue();
 
 				MapDifference diffProperties = Maps.difference(newComponent.getProperties(),
 						oldComponent.getProperties());
@@ -192,12 +192,12 @@ public TreeMap getProperties() {
 	 * @param properties  the properties
 	 */
 	private void addCreated(String componentId, Component component, Map properties) {
-		ComponentDiff.OldNewProperty lastChangeBy = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
+		var lastChangeBy = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
 				component.getProperty(OpenemsConstants.PROPERTY_LAST_CHANGE_BY)
 						.orElse(new JsonPrimitive("Apache Felix Webconsole")));
-		ComponentDiff.OldNewProperty lastChangeAt = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
+		var lastChangeAt = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
 				component.getProperty(OpenemsConstants.PROPERTY_LAST_CHANGE_AT).orElse(JsonNull.INSTANCE));
-		ComponentDiff diff = new ComponentDiff(component, Change.CREATED, lastChangeBy, lastChangeAt);
+		var diff = new ComponentDiff(component, Change.CREATED, lastChangeBy, lastChangeAt);
 		for (Entry entry : properties.entrySet()) {
 			diff.add(entry.getKey(), new ComponentDiff.OldNewProperty(JsonNull.INSTANCE, entry.getValue()));
 		}
@@ -212,14 +212,14 @@ private void addCreated(String componentId, Component component, Map properties) {
-		ComponentDiff.OldNewProperty lastChangeBy = new ComponentDiff.OldNewProperty(
+		var lastChangeBy = new ComponentDiff.OldNewProperty(
 				component.getProperty(OpenemsConstants.PROPERTY_LAST_CHANGE_BY)
 						.orElse(new JsonPrimitive("Apache Felix Webconsole")),
 				JsonNull.INSTANCE);
-		ComponentDiff.OldNewProperty lastChangeAt = new ComponentDiff.OldNewProperty(
+		var lastChangeAt = new ComponentDiff.OldNewProperty(
 				component.getProperty(OpenemsConstants.PROPERTY_LAST_CHANGE_AT).orElse(JsonNull.INSTANCE),
 				JsonNull.INSTANCE);
-		ComponentDiff diff = new ComponentDiff(component, Change.DELETED, lastChangeBy, lastChangeAt);
+		var diff = new ComponentDiff(component, Change.DELETED, lastChangeBy, lastChangeAt);
 		for (Entry entry : properties.entrySet()) {
 			diff.add(entry.getKey(), new ComponentDiff.OldNewProperty(entry.getValue(), JsonNull.INSTANCE));
 		}
@@ -234,12 +234,12 @@ private void addDeleted(String componentId, Component component, Map properties) {
-		ComponentDiff.OldNewProperty lastChangeBy = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
+		var lastChangeBy = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
 				component.getProperty(OpenemsConstants.PROPERTY_LAST_CHANGE_BY)
 						.orElse(new JsonPrimitive("Apache Felix Webconsole")));
-		ComponentDiff.OldNewProperty lastChangeAt = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
+		var lastChangeAt = new ComponentDiff.OldNewProperty(JsonNull.INSTANCE,
 				JsonNull.INSTANCE);
-		ComponentDiff diff = new ComponentDiff(component, Change.UPDATED, lastChangeBy, lastChangeAt);
+		var diff = new ComponentDiff(component, Change.UPDATED, lastChangeBy, lastChangeAt);
 		for (Entry property : properties.entrySet()) {
 			diff.add(property.getKey(), property.getValue());
 		}
@@ -265,8 +265,8 @@ public String getAsHtml() {
 				+ "	" //
 				+ "	");
 		for (Entry componentEntry : this.components.entrySet()) {
-			String componentId = componentEntry.getKey();
-			ComponentDiff component = componentEntry.getValue();
+			var componentId = componentEntry.getKey();
+			var component = componentEntry.getValue();
 			b.append("");
 			// Change column
 			b.append(String.format("%s",
@@ -319,8 +319,8 @@ public String getAsHtml() {
 	public String getAsText() {
 		var b = new StringBuilder();
 		for (Entry componentEntry : this.components.entrySet()) {
-			final ComponentDiff component = componentEntry.getValue();
-			String change = component.properties.entrySet().stream() //
+			final var component = componentEntry.getValue();
+			var change = component.properties.entrySet().stream() //
 					.filter(e -> {
 						switch (e.getKey()) {
 						case "_lastChangeAt":
diff --git a/io.openems.common/src/io/openems/common/types/SemanticVersion.java b/io.openems.common/src/io/openems/common/types/SemanticVersion.java
index 3484f9c9624..ac1b7b9561e 100644
--- a/io.openems.common/src/io/openems/common/types/SemanticVersion.java
+++ b/io.openems.common/src/io/openems/common/types/SemanticVersion.java
@@ -99,7 +99,7 @@ public SemanticVersion(int major, int minor, int patch) {
 
 	/**
 	 * Is this version at least as high as the given {@link SemanticVersion}?.
-	 * 
+	 *
 	 * @param o the given version
 	 * @return true if this version is greater or equal to the given version
 	 */
diff --git a/io.openems.common/src/io/openems/common/types/SystemLog.java b/io.openems.common/src/io/openems/common/types/SystemLog.java
index a796c0c95fb..b98ec62a2f6 100644
--- a/io.openems.common/src/io/openems/common/types/SystemLog.java
+++ b/io.openems.common/src/io/openems/common/types/SystemLog.java
@@ -58,8 +58,7 @@ public static Level fromPaxLevel(PaxLevel paxLevel) {
 	 */
 	public static SystemLog fromPaxLoggingEvent(PaxLoggingEvent event) {
 		var level = Level.fromPaxLevel(event.getLevel());
-		var time = ZonedDateTime.ofInstant(Instant.ofEpochMilli(event.getTimeStamp()),
-				ZoneId.systemDefault());
+		var time = ZonedDateTime.ofInstant(Instant.ofEpochMilli(event.getTimeStamp()), ZoneId.systemDefault());
 		var source = event.getLoggerName();
 		var message = event.getRenderedMessage();
 		return new SystemLog(time, level, source, message);
diff --git a/io.openems.common/src/io/openems/common/utils/EnumUtils.java b/io.openems.common/src/io/openems/common/utils/EnumUtils.java
index b96337222dd..c398d4a3b97 100644
--- a/io.openems.common/src/io/openems/common/utils/EnumUtils.java
+++ b/io.openems.common/src/io/openems/common/utils/EnumUtils.java
@@ -13,7 +13,7 @@ public class EnumUtils {
 
 	/**
 	 * Gets the member of the {@link EnumMap} as {@link Optional} {@link Boolean}.
-	 * 
+	 *
 	 * @param  the type of the EnumMap key
 	 * @param map    the {@link EnumMap}
 	 * @param member the member
@@ -31,7 +31,7 @@ public static > Optional getAsOptionalBoolean(E
 
 	/**
 	 * Gets the member of the {@link EnumMap} as {@link Optional} {@link String}.
-	 * 
+	 *
 	 * @param  the type of the EnumMap key
 	 * @param map    the {@link EnumMap}
 	 * @param member the member
@@ -49,7 +49,7 @@ public static > Optional getAsOptionalString(Enu
 
 	/**
 	 * Gets the member of the {@link EnumMap} as {@link JsonPrimitive}.
-	 * 
+	 *
 	 * @param  the type of the EnumMap key
 	 * @param map    the {@link EnumMap}
 	 * @param member the member
@@ -58,13 +58,13 @@ public static > Optional getAsOptionalString(Enu
 	 */
 	public static > JsonPrimitive getAsPrimitive(EnumMap map, ENUM member)
 			throws OpenemsNamedException {
-		JsonElement jSubElement = getSubElement(map, member);
+		var jSubElement = getSubElement(map, member);
 		return JsonUtils.getAsPrimitive(jSubElement);
 	}
 
 	/**
 	 * Gets the member of the {@link EnumMap} as {@link Boolean}.
-	 * 
+	 *
 	 * @param  the type of the EnumMap key
 	 * @param map    the {@link EnumMap}
 	 * @param member the member
@@ -78,7 +78,7 @@ public static > Boolean getAsBoolean(EnumMap the type of the EnumMap key
 	 * @param map    the {@link EnumMap}
 	 * @param member the member
@@ -92,7 +92,7 @@ public static > String getAsString(EnumMap the type of the EnumMap key
 	 * @param map    the {@link EnumMap}
 	 * @param member the member
@@ -103,14 +103,14 @@ public static > JsonElement getSubElement(EnumMap the type of the EnumMap key
 	 * @param map    the {@link EnumMap}
 	 * @param member the member
diff --git a/io.openems.common/src/io/openems/common/utils/JsonUtils.java b/io.openems.common/src/io/openems/common/utils/JsonUtils.java
index 0cefd17859a..efdf6ca7dd5 100644
--- a/io.openems.common/src/io/openems/common/utils/JsonUtils.java
+++ b/io.openems.common/src/io/openems/common/utils/JsonUtils.java
@@ -1,6 +1,7 @@
 package io.openems.common.utils;
 
 import java.net.Inet4Address;
+import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.time.ZoneId;
 import java.time.ZonedDateTime;
@@ -342,8 +343,7 @@ public static JsonPrimitive getAsPrimitive(JsonElement jElement) throws OpenemsN
 	public static JsonPrimitive getAsPrimitive(JsonElement jElement, String memberName) throws OpenemsNamedException {
 		var jSubElement = getSubElement(jElement, memberName);
 		if (!jSubElement.isJsonPrimitive()) {
-			throw OpenemsError.JSON_NO_PRIMITIVE_MEMBER.exception(memberName,
-					jElement.toString().replaceAll("%", "%%"));
+			throw OpenemsError.JSON_NO_PRIMITIVE_MEMBER.exception(memberName, jElement.toString().replace("%", "%%"));
 		}
 		return jSubElement.getAsJsonPrimitive();
 	}
@@ -506,7 +506,7 @@ public static String getAsString(JsonElement jElement) throws OpenemsNamedExcept
 
 	/**
 	 * Gets the {@link JsonPrimitive} as {@link String}.
-	 * 
+	 *
 	 * @param jPrimitive the {@link JsonPrimitive}
 	 * @return the {@link String} value
 	 * @throws OpenemsNamedException on error
@@ -585,7 +585,7 @@ public static String[] getAsStringArray(JsonArray json) throws OpenemsNamedExcep
 
 	/**
 	 * Gets the {@link JsonPrimitive} as {@link Boolean}.
-	 * 
+	 *
 	 * @param jPrimitive the {@link JsonPrimitive}
 	 * @return the {@link Boolean} value
 	 * @throws OpenemsNamedException on error
@@ -598,7 +598,8 @@ public static boolean getAsBoolean(JsonPrimitive jPrimitive) throws OpenemsNamed
 			var element = jPrimitive.getAsString();
 			if (element.equalsIgnoreCase("false")) {
 				return false;
-			} else if (element.equalsIgnoreCase("true")) {
+			}
+			if (element.equalsIgnoreCase("true")) {
 				return true;
 			}
 		}
@@ -607,7 +608,7 @@ public static boolean getAsBoolean(JsonPrimitive jPrimitive) throws OpenemsNamed
 
 	/**
 	 * Gets the {@link JsonElement} as {@link Boolean}.
-	 * 
+	 *
 	 * @param jElement the {@link JsonElement}
 	 * @return the {@link Boolean} value
 	 * @throws OpenemsNamedException on error
@@ -648,7 +649,7 @@ public static Optional getAsOptionalBoolean(JsonElement jElement, Strin
 
 	/**
 	 * Gets the {@link JsonPrimitive} as short.
-	 * 
+	 *
 	 * @param jPrimitive the {@link JsonPrimitive}
 	 * @return the short value
 	 * @throws OpenemsNamedException on error
@@ -656,7 +657,8 @@ public static Optional getAsOptionalBoolean(JsonElement jElement, Strin
 	public static short getAsShort(JsonPrimitive jPrimitive) throws OpenemsNamedException {
 		if (jPrimitive.isNumber()) {
 			return jPrimitive.getAsShort();
-		} else if (jPrimitive.isString()) {
+		}
+		if (jPrimitive.isString()) {
 			var string = jPrimitive.getAsString();
 			return Short.parseShort(string);
 		}
@@ -665,7 +667,7 @@ public static short getAsShort(JsonPrimitive jPrimitive) throws OpenemsNamedExce
 
 	/**
 	 * Gets the {@link JsonElement} as short.
-	 * 
+	 *
 	 * @param jElement the {@link JsonElement}
 	 * @return the short value
 	 * @throws OpenemsNamedException on error
@@ -688,7 +690,7 @@ public static short getAsShort(JsonElement jElement, String memberName) throws O
 
 	/**
 	 * Gets the {@link JsonPrimitive} as int.
-	 * 
+	 *
 	 * @param jPrimitive the {@link JsonPrimitive}
 	 * @return the int value
 	 * @throws OpenemsNamedException on error
@@ -696,7 +698,8 @@ public static short getAsShort(JsonElement jElement, String memberName) throws O
 	public static int getAsInt(JsonPrimitive jPrimitive) throws OpenemsNamedException {
 		if (jPrimitive.isNumber()) {
 			return jPrimitive.getAsInt();
-		} else if (jPrimitive.isString()) {
+		}
+		if (jPrimitive.isString()) {
 			var string = jPrimitive.getAsString();
 			return Integer.parseInt(string);
 		}
@@ -705,7 +708,7 @@ public static int getAsInt(JsonPrimitive jPrimitive) throws OpenemsNamedExceptio
 
 	/**
 	 * Gets the {@link JsonElement} as int.
-	 * 
+	 *
 	 * @param jElement the {@link JsonElement}
 	 * @return the int value
 	 * @throws OpenemsNamedException on error
@@ -775,7 +778,7 @@ public static Optional getAsOptionalInt(JsonElement jElement, String me
 
 	/**
 	 * Gets the {@link JsonPrimitive} as long.
-	 * 
+	 *
 	 * @param jPrimitive the {@link JsonPrimitive}
 	 * @return the long value
 	 * @throws OpenemsNamedException on error
@@ -783,7 +786,8 @@ public static Optional getAsOptionalInt(JsonElement jElement, String me
 	public static long getAsLong(JsonPrimitive jPrimitive) throws OpenemsNamedException {
 		if (jPrimitive.isNumber()) {
 			return jPrimitive.getAsLong();
-		} else if (jPrimitive.isString()) {
+		}
+		if (jPrimitive.isString()) {
 			var string = jPrimitive.getAsString();
 			return Integer.parseInt(string);
 		}
@@ -792,7 +796,7 @@ public static long getAsLong(JsonPrimitive jPrimitive) throws OpenemsNamedExcept
 
 	/**
 	 * Gets the {@link JsonElement} as long.
-	 * 
+	 *
 	 * @param jElement the {@link JsonElement}
 	 * @return the long value
 	 * @throws OpenemsNamedException on error
@@ -831,7 +835,7 @@ public static Optional getAsOptionalLong(JsonElement jElement, String memb
 
 	/**
 	 * Gets the {@link JsonPrimitive} as {@link Float}.
-	 * 
+	 *
 	 * @param jPrimitive the {@link JsonPrimitive}
 	 * @return the {@link Float} value
 	 * @throws OpenemsNamedException on error
@@ -839,7 +843,8 @@ public static Optional getAsOptionalLong(JsonElement jElement, String memb
 	public static float getAsFloat(JsonPrimitive jPrimitive) throws OpenemsNamedException {
 		if (jPrimitive.isNumber()) {
 			return jPrimitive.getAsFloat();
-		} else if (jPrimitive.isString()) {
+		}
+		if (jPrimitive.isString()) {
 			var string = jPrimitive.getAsString();
 			return Float.parseFloat(string);
 		}
@@ -848,7 +853,7 @@ public static float getAsFloat(JsonPrimitive jPrimitive) throws OpenemsNamedExce
 
 	/**
 	 * Gets the {@link JsonElement} as {@link Float}.
-	 * 
+	 *
 	 * @param jElement the {@link JsonElement}
 	 * @return the {@link Float} value
 	 * @throws OpenemsNamedException on error
@@ -871,7 +876,7 @@ public static float getAsFloat(JsonElement jElement, String memberName) throws O
 
 	/**
 	 * Gets the {@link JsonPrimitive} as {@link Double}.
-	 * 
+	 *
 	 * @param jPrimitive the {@link JsonPrimitive}
 	 * @return the {@link Double} value
 	 * @throws OpenemsNamedException on error
@@ -879,7 +884,8 @@ public static float getAsFloat(JsonElement jElement, String memberName) throws O
 	public static double getAsDouble(JsonPrimitive jPrimitive) throws OpenemsNamedException {
 		if (jPrimitive.isNumber()) {
 			return jPrimitive.getAsDouble();
-		} else if (jPrimitive.isString()) {
+		}
+		if (jPrimitive.isString()) {
 			var string = jPrimitive.getAsString();
 			return Double.parseDouble(string);
 		}
@@ -888,7 +894,7 @@ public static double getAsDouble(JsonPrimitive jPrimitive) throws OpenemsNamedEx
 
 	/**
 	 * Gets the {@link JsonElement} as {@link Double}.
-	 * 
+	 *
 	 * @param jElement the {@link JsonElement}
 	 * @return the {@link Double} value
 	 * @throws OpenemsNamedException on error
@@ -922,7 +928,7 @@ public static > E getAsEnum(Class enumType, JsonElement jEl
 			throws OpenemsNamedException {
 		var element = getAsString(jElement);
 		try {
-			return (E) Enum.valueOf(enumType, element);
+			return Enum.valueOf(enumType, element);
 		} catch (IllegalArgumentException e) {
 			throw OpenemsError.JSON_NO_ENUM.exception(element);
 		}
@@ -942,7 +948,7 @@ public static > E getAsEnum(Class enumType, JsonElement jEl
 			throws OpenemsNamedException {
 		var element = getAsString(jElement, memberName);
 		try {
-			return (E) Enum.valueOf(enumType, element);
+			return Enum.valueOf(enumType, element);
 		} catch (IllegalArgumentException e) {
 			throw OpenemsError.JSON_NO_ENUM_MEMBER.exception(memberName, element);
 		}
@@ -980,7 +986,7 @@ public static > Optional getAsOptionalEnum(Class enumTyp
 	 */
 	public static Inet4Address getAsInet4Address(JsonElement jElement) throws OpenemsNamedException {
 		try {
-			return (Inet4Address) Inet4Address.getByName(getAsString(jElement));
+			return (Inet4Address) InetAddress.getByName(getAsString(jElement));
 		} catch (UnknownHostException e) {
 			throw OpenemsError.JSON_NO_INET4ADDRESS.exception(jElement.toString().replace("%", "%%"));
 		}
@@ -997,7 +1003,7 @@ public static Inet4Address getAsInet4Address(JsonElement jElement) throws Openem
 	 */
 	public static Optional getAsOptionalInet4Address(JsonElement jElement, String memberName) {
 		try {
-			return Optional.ofNullable((Inet4Address) Inet4Address.getByName(getAsString(jElement, memberName)));
+			return Optional.ofNullable((Inet4Address) InetAddress.getByName(getAsString(jElement, memberName)));
 		} catch (OpenemsNamedException | UnknownHostException e) {
 			return Optional.empty();
 		}
@@ -1032,7 +1038,7 @@ public static UUID getAsUUID(JsonElement jElement, String memberName) throws Ope
 	// CHECKSTYLE:OFF
 	public static Optional getAsOptionalUUID(JsonElement jElement, String memberName) {
 		// CHECKSTYLE:ON
-		Optional uuid = getAsOptionalString(jElement, memberName);
+		var uuid = getAsOptionalString(jElement, memberName);
 		if (uuid.isPresent()) {
 			return Optional.ofNullable(UUID.fromString(uuid.get()));
 		}
@@ -1078,7 +1084,8 @@ public static Object getAsBestType(JsonElement j) throws OpenemsNamedException {
 						result[i] = jA.get(i).getAsBoolean();
 					}
 					return result;
-				} else if (isInt) {
+				}
+				if (isInt) {
 					// convert to int array
 					var result = new int[jA.size()];
 					for (var i = 0; i < jA.size(); i++) {
@@ -1140,7 +1147,8 @@ public static JsonElement getAsJsonElement(Object value) {
 			 * Number
 			 */
 			return new JsonPrimitive((Number) value);
-		} else if (value instanceof String) {
+		}
+		if (value instanceof String) {
 			/*
 			 * String
 			 */
@@ -1263,7 +1271,8 @@ public static Object getAsType(Class type, JsonElement j) throws NotImplement
 				 */
 				return j.getAsInt();
 
-			} else if (Long.class.isAssignableFrom(type)) {
+			}
+			if (Long.class.isAssignableFrom(type)) {
 				/*
 				 * Asking for an Long
 				 */
@@ -1434,7 +1443,7 @@ public static JsonObject parseToJsonObject(String string) throws OpenemsNamedExc
 
 	/**
 	 * Parses a string to a {@link JsonArray}.
-	 * 
+	 *
 	 * @param string the String
 	 * @return the {@link JsonArray}
 	 * @throws OpenemsNamedException on error
diff --git a/io.openems.common/src/io/openems/common/utils/Mutex.java b/io.openems.common/src/io/openems/common/utils/Mutex.java
index 2d57055e547..f311bf8d40c 100644
--- a/io.openems.common/src/io/openems/common/utils/Mutex.java
+++ b/io.openems.common/src/io/openems/common/utils/Mutex.java
@@ -17,7 +17,7 @@ public Mutex(boolean initiallyPermitted) {
 
 	/**
 	 * Wait for a {@link #release()}.
-	 * 
+	 *
 	 * @throws InterruptedException on wait error
 	 */
 	public void await() throws InterruptedException {
@@ -29,7 +29,7 @@ public void await() throws InterruptedException {
 
 	/**
 	 * Wait for a {@link #release()} with a timeout.
-	 * 
+	 *
 	 * @param timeout the timeout value
 	 * @param unit    the timeout {@link TimeUnit}
 	 * @throws InterruptedException on wait error
diff --git a/io.openems.common/src/io/openems/common/utils/SecureRandomSingleton.java b/io.openems.common/src/io/openems/common/utils/SecureRandomSingleton.java
index 4f8058ac100..dd3818e31c1 100644
--- a/io.openems.common/src/io/openems/common/utils/SecureRandomSingleton.java
+++ b/io.openems.common/src/io/openems/common/utils/SecureRandomSingleton.java
@@ -14,7 +14,7 @@ public class SecureRandomSingleton {
 
 	/**
 	 * Gets the {@link SecureRandom} singleton instance.
-	 * 
+	 *
 	 * @return the {@link SecureRandom} instance
 	 */
 	public static synchronized SecureRandom getInstance() {
diff --git a/io.openems.common/src/io/openems/common/utils/StringUtils.java b/io.openems.common/src/io/openems/common/utils/StringUtils.java
index 7db042b67b5..d7b87e53b0f 100644
--- a/io.openems.common/src/io/openems/common/utils/StringUtils.java
+++ b/io.openems.common/src/io/openems/common/utils/StringUtils.java
@@ -9,10 +9,10 @@ public class StringUtils {
 
 	/**
 	 * Shortens a string to a given length.
-	 * 
+	 *
 	 * 

* Example: converts a string "hello world" to "hello w..." - * + * * @param s the string * @param length the target string length * @return the shortened string @@ -26,10 +26,10 @@ public static String toShortString(String s, int length) { /** * Shortens a {@link JsonElement} string representation to a given length. - * + * *

* Example: converts a "{ 'foo': 'bar' }" to "{ 'foo': '..." - * + * * @param j the {@link JsonElement} * @param length the target string length * @return the shortened string @@ -41,10 +41,10 @@ public static String toShortString(JsonElement j, int length) { /** * Convert the first letter of a string to Upper-Case. - * + * *

* Example: converts "hello world" to "Hello world" - * + * * @param s the string * @return the converted string */ @@ -74,7 +74,8 @@ public static String capitalizeFirstLetter(String s) { public static int matchWildcard(String source, String pattern) { if (source.equals(pattern)) { return 0; - } else if (pattern.equals("*")) { + } + if (pattern.equals("*")) { return 1; } else if (pattern.startsWith("*") && source.endsWith(pattern.substring(1))) { return pattern.length(); diff --git a/io.openems.common/src/io/openems/common/utils/XmlUtils.java b/io.openems.common/src/io/openems/common/utils/XmlUtils.java index 59431251e9d..6431897bda9 100644 --- a/io.openems.common/src/io/openems/common/utils/XmlUtils.java +++ b/io.openems.common/src/io/openems/common/utils/XmlUtils.java @@ -15,7 +15,7 @@ public class XmlUtils { /** * Converts a {@link NamedNodeMap} to a string representative. - * + * * @param attrs the {@link NamedNodeMap} * @return a string */ @@ -29,7 +29,7 @@ public static String namedNodeMapToString(NamedNodeMap attrs) { /** * Gets the Sub-Node of a {@link NamedNodeMap} with the given name. - * + * * @param attrs the {@link NamedNodeMap} * @param name the name of the Sub-Node * @return the {@link Node} @@ -47,7 +47,7 @@ public static Node getSubNode(NamedNodeMap attrs, String name) throws OpenemsNam /** * Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as * String. - * + * * @param attrs the {@link NamedNodeMap} * @param name the name of the Sub-Node * @return the value of the {@link Node} @@ -65,7 +65,7 @@ public static String getAsString(NamedNodeMap attrs, String name) throws Openems /** * Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as * String; otherwise the alternative value. - * + * * @param attrs the {@link NamedNodeMap} * @param name the name of the Sub-Node * @param def the alternative value @@ -83,7 +83,7 @@ public static String getAsStringOrElse(NamedNodeMap attrs, String name, String d /** * Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as * Integer. - * + * * @param attrs the {@link NamedNodeMap} * @param name the name of the Sub-Node * @return the value of the {@link Node} @@ -100,7 +100,7 @@ public static int getAsInt(NamedNodeMap attrs, String name) throws OpenemsNamedE /** * Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as * Integer; otherwise the alternative value. - * + * * @param attrs the {@link NamedNodeMap} * @param name the name of the Sub-Node * @param def the alternative value @@ -118,7 +118,7 @@ public static int getAsIntOrElse(NamedNodeMap attrs, String name, int def) { /** * Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as * Enum. - * + * * @param the type of the {@link Enum} * @param enumType the class of the {@link Enum} * @param attrs the {@link NamedNodeMap} @@ -130,7 +130,7 @@ public static > E getAsEnum(Class enumType, NamedNodeMap at throws OpenemsNamedException { var element = XmlUtils.getAsString(attrs, name); try { - return (E) Enum.valueOf(enumType, element.toUpperCase()); + return Enum.valueOf(enumType, element.toUpperCase()); } catch (IllegalArgumentException e) { throw new OpenemsException(e); } @@ -139,7 +139,7 @@ public static > E getAsEnum(Class enumType, NamedNodeMap at /** * Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as * Enum; otherwise the alternative value. - * + * * @param the type of the {@link Enum} * @param enumType the class of the {@link Enum} * @param attrs the {@link NamedNodeMap} @@ -159,7 +159,7 @@ public static > E getAsEnumOrElse(Class enumType, NamedNode /** * Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as * Boolean. - * + * * @param attrs the {@link NamedNodeMap} * @param name the name of the Sub-Node * @return the value of the {@link Node} @@ -173,7 +173,7 @@ public static boolean getAsBoolean(NamedNodeMap attrs, String name) throws Opene /** * Gets the value of a Sub-Node of a {@link NamedNodeMap} with the given name as * Boolean; otherwise the alternative value. - * + * * @param attrs the {@link NamedNodeMap} * @param name the name of the Sub-Node * @param def the alternative value @@ -190,7 +190,7 @@ public static boolean getAsBooleanOrElse(NamedNodeMap attrs, String name, boolea /** * Gets the Content of a {@link Node}. - * + * * @param node the {@link Node} * @return the text content as string */ @@ -200,7 +200,7 @@ public static String getContentAsString(Node node) { /** * Gets the Content of a {@link Node} as Integer. - * + * * @param node the {@link Node} * @return the text content as string */ diff --git a/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketClient.java b/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketClient.java index 933de987884..28ea1de9ba6 100644 --- a/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketClient.java +++ b/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketClient.java @@ -167,7 +167,7 @@ protected OnInternalError getOnInternalError() { /** * Sends a {@link JsonrpcMessage}. - * + * * @param message the {@link JsonrpcMessage} * @throws OpenemsException on error, e.g. if the websocket is not connected */ diff --git a/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketServer.java b/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketServer.java index 387b33e312c..f88a30d2f6c 100644 --- a/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketServer.java +++ b/io.openems.common/src/io/openems/common/websocket/AbstractWebsocketServer.java @@ -46,7 +46,7 @@ public abstract class AbstractWebsocketServer extends Abstract /** * Construct an {@link AbstractWebsocketServer}. - * + * * @param name to identify this server * @param port to listen on * @param poolSize number of threads dedicated to handle the tasks @@ -217,7 +217,7 @@ public void stop() { ThreadPoolUtils.shutdownAndAwaitTermination(this.executor, 5); ThreadPoolUtils.shutdownAndAwaitTermination(this.debugLogExecutor, 5); - int tries = 3; + var tries = 3; while (tries-- > 0) { try { this.ws.stop(); diff --git a/io.openems.common/src/io/openems/common/websocket/DummyWebsocketServer.java b/io.openems.common/src/io/openems/common/websocket/DummyWebsocketServer.java index 487b821aa9b..5e23393a57a 100644 --- a/io.openems.common/src/io/openems/common/websocket/DummyWebsocketServer.java +++ b/io.openems.common/src/io/openems/common/websocket/DummyWebsocketServer.java @@ -25,7 +25,7 @@ private Builder() { /** * Sets the {@link OnOpen} callback. - * + * * @param onOpen the callback * @return the {@link Builder} */ @@ -36,7 +36,7 @@ public DummyWebsocketServer.Builder onOpen(OnOpen onOpen) { /** * Sets the {@link OnRequest} callback. - * + * * @param onRequest the callback * @return the {@link Builder} */ @@ -47,7 +47,7 @@ public DummyWebsocketServer.Builder onRequest(OnRequest onRequest) { /** * Sets the {@link OnNotification} callback. - * + * * @param onNotification the callback * @return the {@link Builder} */ @@ -58,7 +58,7 @@ public DummyWebsocketServer.Builder onNotification(OnNotification onNotification /** * Sets the {@link OnError} callback. - * + * * @param onError the callback * @return the {@link Builder} */ @@ -69,7 +69,7 @@ public DummyWebsocketServer.Builder onError(OnError onError) { /** * Sets the {@link OnClose} callback. - * + * * @param onClose the callback * @return the {@link Builder} */ diff --git a/io.openems.common/src/io/openems/common/websocket/OnOpen.java b/io.openems.common/src/io/openems/common/websocket/OnOpen.java index bfa1ea360e6..3851d7e4524 100644 --- a/io.openems.common/src/io/openems/common/websocket/OnOpen.java +++ b/io.openems.common/src/io/openems/common/websocket/OnOpen.java @@ -38,10 +38,10 @@ public interface OnOpen { public static Optional getFieldFromHandshakeCookie(JsonObject handshake, String fieldname) { for (Entry entry : handshake.entrySet()) { if (entry.getKey().equalsIgnoreCase("cookie")) { - Optional cookieOpt = JsonUtils.getAsOptionalString(entry.getValue()); + var cookieOpt = JsonUtils.getAsOptionalString(entry.getValue()); if (cookieOpt.isPresent()) { for (String cookieVariable : cookieOpt.get().split("; ")) { - String[] keyValue = cookieVariable.split("="); + var keyValue = cookieVariable.split("="); if (keyValue.length == 2) { if (keyValue[0].equals(fieldname)) { return Optional.ofNullable(keyValue[1]); diff --git a/io.openems.common/src/io/openems/common/websocket/OnRequestHandler.java b/io.openems.common/src/io/openems/common/websocket/OnRequestHandler.java index c225f32faf0..4883688c4da 100644 --- a/io.openems.common/src/io/openems/common/websocket/OnRequestHandler.java +++ b/io.openems.common/src/io/openems/common/websocket/OnRequestHandler.java @@ -75,7 +75,7 @@ public final void run() { /** * Simplifies a {@link JsonrpcMessage} by recursively removing unnecessary * elements "jsonrpc" and "id". - * + * * @param j the {@link JsonrpcMessage#toJsonObject()} * @return a simplified {@link JsonObject} */ diff --git a/io.openems.edge.battery.bydcommercial/src/io/openems/edge/battery/bydcommercial/BatteryBoxC130Impl.java b/io.openems.edge.battery.bydcommercial/src/io/openems/edge/battery/bydcommercial/BatteryBoxC130Impl.java index 4f9f82b853e..e35024baabb 100644 --- a/io.openems.edge.battery.bydcommercial/src/io/openems/edge/battery/bydcommercial/BatteryBoxC130Impl.java +++ b/io.openems.edge.battery.bydcommercial/src/io/openems/edge/battery/bydcommercial/BatteryBoxC130Impl.java @@ -195,7 +195,7 @@ protected ModbusProtocol defineModbusProtocol() throws OpenemsException { .m(Battery.ChannelId.CURRENT, ElementToChannelConverter.SCALE_FACTOR_MINUS_1) // [A] .build(), // m(BatteryBoxC130.ChannelId.BATTERY_WORK_STATE, new UnsignedWordElement(0x2102)), // - m(Battery.ChannelId.SOC, new UnsignedWordElement(0x2103)), + m(Battery.ChannelId.SOC, new UnsignedWordElement(0x2103)), // m(new UnsignedWordElement(0x2104)) // .m(BatteryBoxC130.ChannelId.CLUSTER_1_SOH, ElementToChannelConverter.DIRECT_1_TO_1) // [%] .m(Battery.ChannelId.SOH, ElementToChannelConverter.DIRECT_1_TO_1) // [%] @@ -212,16 +212,14 @@ protected ModbusProtocol defineModbusProtocol() throws OpenemsException { ElementToChannelConverter.DIRECT_1_TO_1) // .m(Battery.ChannelId.MIN_CELL_VOLTAGE, ElementToChannelConverter.DIRECT_1_TO_1) // .build(), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_MAX_CELL_TEMPERATURE_ID, - new UnsignedWordElement(0x2109)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_MAX_CELL_TEMPERATURE_ID, new UnsignedWordElement(0x2109)), // m(new SignedWordElement(0x210A)) // .m(BatteryBoxC130.ChannelId.CLUSTER_1_MAX_CELL_TEMPERATURE, ElementToChannelConverter.DIRECT_1_TO_1) // .m(Battery.ChannelId.MAX_CELL_TEMPERATURE, ElementToChannelConverter.SCALE_FACTOR_MINUS_1) // .build(), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_MIN_CELL_TEMPERATURE_ID, - new UnsignedWordElement(0x210B)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_MIN_CELL_TEMPERATURE_ID, new UnsignedWordElement(0x210B)), // m(new SignedWordElement(0x210C)) // .m(BatteryBoxC130.ChannelId.CLUSTER_1_MIN_CELL_TEMPERATURE, ElementToChannelConverter.DIRECT_1_TO_1) // @@ -596,102 +594,54 @@ protected ModbusProtocol defineModbusProtocol() throws OpenemsException { m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_216_VOLTAGE, new UnsignedWordElement(0x28D7)) // ), // new FC3ReadRegistersTask(0x2C00, Priority.LOW, // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_00_TEMPERATURE, - new UnsignedWordElement(0x2C00)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_01_TEMPERATURE, - new UnsignedWordElement(0x2C01)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_02_TEMPERATURE, - new UnsignedWordElement(0x2C02)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_03_TEMPERATURE, - new UnsignedWordElement(0x2C03)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_04_TEMPERATURE, - new UnsignedWordElement(0x2C04)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_05_TEMPERATURE, - new UnsignedWordElement(0x2C05)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_06_TEMPERATURE, - new UnsignedWordElement(0x2C06)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_07_TEMPERATURE, - new UnsignedWordElement(0x2C07)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_08_TEMPERATURE, - new UnsignedWordElement(0x2C08)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_09_TEMPERATURE, - new UnsignedWordElement(0x2C09)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_10_TEMPERATURE, - new UnsignedWordElement(0x2C0A)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_11_TEMPERATURE, - new UnsignedWordElement(0x2C0B)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_12_TEMPERATURE, - new UnsignedWordElement(0x2C0C)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_13_TEMPERATURE, - new UnsignedWordElement(0x2C0D)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_14_TEMPERATURE, - new UnsignedWordElement(0x2C0E)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_15_TEMPERATURE, - new UnsignedWordElement(0x2C0F)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_16_TEMPERATURE, - new UnsignedWordElement(0x2C10)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_17_TEMPERATURE, - new UnsignedWordElement(0x2C11)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_18_TEMPERATURE, - new UnsignedWordElement(0x2C12)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_19_TEMPERATURE, - new UnsignedWordElement(0x2C13)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_20_TEMPERATURE, - new UnsignedWordElement(0x2C14)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_21_TEMPERATURE, - new UnsignedWordElement(0x2C15)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_22_TEMPERATURE, - new UnsignedWordElement(0x2C16)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_23_TEMPERATURE, - new UnsignedWordElement(0x2C17)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_24_TEMPERATURE, - new UnsignedWordElement(0x2C18)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_25_TEMPERATURE, - new UnsignedWordElement(0x2C19)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_26_TEMPERATURE, - new UnsignedWordElement(0x2C1A)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_27_TEMPERATURE, - new UnsignedWordElement(0x2C1B)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_28_TEMPERATURE, - new UnsignedWordElement(0x2C1C)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_29_TEMPERATURE, - new UnsignedWordElement(0x2C1D)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_30_TEMPERATURE, - new UnsignedWordElement(0x2C1E)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_31_TEMPERATURE, - new UnsignedWordElement(0x2C1F)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_32_TEMPERATURE, - new UnsignedWordElement(0x2C20)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_33_TEMPERATURE, - new UnsignedWordElement(0x2C21)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_34_TEMPERATURE, - new UnsignedWordElement(0x2C22)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_35_TEMPERATURE, - new UnsignedWordElement(0x2C23)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_36_TEMPERATURE, - new UnsignedWordElement(0x2C24)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_37_TEMPERATURE, - new UnsignedWordElement(0x2C25)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_38_TEMPERATURE, - new UnsignedWordElement(0x2C26)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_39_TEMPERATURE, - new UnsignedWordElement(0x2C27)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_40_TEMPERATURE, - new UnsignedWordElement(0x2C28)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_41_TEMPERATURE, - new UnsignedWordElement(0x2C29)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_42_TEMPERATURE, - new UnsignedWordElement(0x2C2A)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_43_TEMPERATURE, - new UnsignedWordElement(0x2C2B)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_44_TEMPERATURE, - new UnsignedWordElement(0x2C2C)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_45_TEMPERATURE, - new UnsignedWordElement(0x2C2D)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_46_TEMPERATURE, - new UnsignedWordElement(0x2C2E)), // - m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_47_TEMPERATURE, - new UnsignedWordElement(0x2C2F)) // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_00_TEMPERATURE, new UnsignedWordElement(0x2C00)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_01_TEMPERATURE, new UnsignedWordElement(0x2C01)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_02_TEMPERATURE, new UnsignedWordElement(0x2C02)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_03_TEMPERATURE, new UnsignedWordElement(0x2C03)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_04_TEMPERATURE, new UnsignedWordElement(0x2C04)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_05_TEMPERATURE, new UnsignedWordElement(0x2C05)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_06_TEMPERATURE, new UnsignedWordElement(0x2C06)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_07_TEMPERATURE, new UnsignedWordElement(0x2C07)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_08_TEMPERATURE, new UnsignedWordElement(0x2C08)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_09_TEMPERATURE, new UnsignedWordElement(0x2C09)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_10_TEMPERATURE, new UnsignedWordElement(0x2C0A)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_11_TEMPERATURE, new UnsignedWordElement(0x2C0B)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_12_TEMPERATURE, new UnsignedWordElement(0x2C0C)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_13_TEMPERATURE, new UnsignedWordElement(0x2C0D)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_14_TEMPERATURE, new UnsignedWordElement(0x2C0E)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_15_TEMPERATURE, new UnsignedWordElement(0x2C0F)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_16_TEMPERATURE, new UnsignedWordElement(0x2C10)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_17_TEMPERATURE, new UnsignedWordElement(0x2C11)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_18_TEMPERATURE, new UnsignedWordElement(0x2C12)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_19_TEMPERATURE, new UnsignedWordElement(0x2C13)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_20_TEMPERATURE, new UnsignedWordElement(0x2C14)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_21_TEMPERATURE, new UnsignedWordElement(0x2C15)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_22_TEMPERATURE, new UnsignedWordElement(0x2C16)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_23_TEMPERATURE, new UnsignedWordElement(0x2C17)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_24_TEMPERATURE, new UnsignedWordElement(0x2C18)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_25_TEMPERATURE, new UnsignedWordElement(0x2C19)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_26_TEMPERATURE, new UnsignedWordElement(0x2C1A)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_27_TEMPERATURE, new UnsignedWordElement(0x2C1B)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_28_TEMPERATURE, new UnsignedWordElement(0x2C1C)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_29_TEMPERATURE, new UnsignedWordElement(0x2C1D)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_30_TEMPERATURE, new UnsignedWordElement(0x2C1E)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_31_TEMPERATURE, new UnsignedWordElement(0x2C1F)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_32_TEMPERATURE, new UnsignedWordElement(0x2C20)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_33_TEMPERATURE, new UnsignedWordElement(0x2C21)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_34_TEMPERATURE, new UnsignedWordElement(0x2C22)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_35_TEMPERATURE, new UnsignedWordElement(0x2C23)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_36_TEMPERATURE, new UnsignedWordElement(0x2C24)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_37_TEMPERATURE, new UnsignedWordElement(0x2C25)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_38_TEMPERATURE, new UnsignedWordElement(0x2C26)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_39_TEMPERATURE, new UnsignedWordElement(0x2C27)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_40_TEMPERATURE, new UnsignedWordElement(0x2C28)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_41_TEMPERATURE, new UnsignedWordElement(0x2C29)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_42_TEMPERATURE, new UnsignedWordElement(0x2C2A)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_43_TEMPERATURE, new UnsignedWordElement(0x2C2B)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_44_TEMPERATURE, new UnsignedWordElement(0x2C2C)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_45_TEMPERATURE, new UnsignedWordElement(0x2C2D)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_46_TEMPERATURE, new UnsignedWordElement(0x2C2E)), // + m(BatteryBoxC130.ChannelId.CLUSTER_1_BATTERY_47_TEMPERATURE, new UnsignedWordElement(0x2C2F)) // )// ); // } @@ -761,13 +711,11 @@ public StartStop getStartStopTarget() { try { this.getModbusProtocol().addTasks(// new FC3ReadRegistersTask(0x210D, Priority.LOW, // - m(BatteryBoxC130.ChannelId.MODULE_QTY, - new UnsignedWordElement(0x210D)), // + m(BatteryBoxC130.ChannelId.MODULE_QTY, new UnsignedWordElement(0x210D)), // m(BatteryBoxC130.ChannelId.TOTAL_VOLTAGE_OF_SINGLE_MODULE, new UnsignedWordElement(0x210E))), // new FC3ReadRegistersTask(0x216E, Priority.LOW, // - m(Battery.ChannelId.CHARGE_MAX_VOLTAGE, - new UnsignedWordElement(0x216E), // + m(Battery.ChannelId.CHARGE_MAX_VOLTAGE, new UnsignedWordElement(0x216E), // ElementToChannelConverter.SCALE_FACTOR_MINUS_1), // m(Battery.ChannelId.DISCHARGE_MIN_VOLTAGE, new UnsignedWordElement(0x216F), // diff --git a/io.openems.edge.battery.fenecon.home/src/io/openems/edge/battery/fenecon/home/FeneconHomeBatteryImpl.java b/io.openems.edge.battery.fenecon.home/src/io/openems/edge/battery/fenecon/home/FeneconHomeBatteryImpl.java index ae6e69866f3..9e2ed9a704c 100644 --- a/io.openems.edge.battery.fenecon.home/src/io/openems/edge/battery/fenecon/home/FeneconHomeBatteryImpl.java +++ b/io.openems.edge.battery.fenecon.home/src/io/openems/edge/battery/fenecon/home/FeneconHomeBatteryImpl.java @@ -115,8 +115,10 @@ protected void setModbus(BridgeModbus modbus) { void activate(ComponentContext context, Config config) throws OpenemsException { this.config = config; - super.activate(context, config.id(), config.alias(), config.enabled(), config.modbusUnitId(), this.cm, "Modbus", - config.modbus_id()); + if (super.activate(context, config.id(), config.alias(), config.enabled(), config.modbusUnitId(), this.cm, + "Modbus", config.modbus_id())) { + return; + } // Initialize Battery-Protection this.batteryProtection = BatteryProtection.create(this) // @@ -531,8 +533,10 @@ private synchronized void initializeTowerModulesChannels(int numberOfTowers, int OpenemsType.BOOLEAN)) // .bit(7, this.generateTowerChannel(tower, "PRE_ALARM_BCU_TEMP_DIFFERENCE", OpenemsType.BOOLEAN)) // - .bit(8, this.generateTowerChannel(tower, "PRE_ALARM_UNDER_SOC", OpenemsType.BOOLEAN)) // - .bit(9, this.generateTowerChannel(tower, "PRE_ALARM_UNDER_SOH", OpenemsType.BOOLEAN)) // + .bit(8, this.generateTowerChannel(tower, "PRE_ALARM_UNDER_SOC", + OpenemsType.BOOLEAN)) // + .bit(9, this.generateTowerChannel(tower, "PRE_ALARM_UNDER_SOH", + OpenemsType.BOOLEAN)) // .bit(10, this.generateTowerChannel(tower, "PRE_ALARM_OVER_CHARGING_POWER", OpenemsType.BOOLEAN)) // .bit(11, this.generateTowerChannel(tower, "PRE_ALARM_OVER_DISCHARGING_POWER", @@ -558,8 +562,10 @@ private synchronized void initializeTowerModulesChannels(int numberOfTowers, int OpenemsType.BOOLEAN)) // .bit(7, this.generateTowerChannel(tower, "LEVEL_1_BCU_TEMP_DIFFERENCE", OpenemsType.BOOLEAN)) // - .bit(8, this.generateTowerChannel(tower, "LEVEL_1_UNDER_SOC", OpenemsType.BOOLEAN)) // - .bit(9, this.generateTowerChannel(tower, "LEVEL_1_UNDER_SOH", OpenemsType.BOOLEAN)) // + .bit(8, this.generateTowerChannel(tower, "LEVEL_1_UNDER_SOC", + OpenemsType.BOOLEAN)) // + .bit(9, this.generateTowerChannel(tower, "LEVEL_1_UNDER_SOH", + OpenemsType.BOOLEAN)) // .bit(10, this.generateTowerChannel(tower, "LEVEL_1_OVER_CHARGING_POWER", OpenemsType.BOOLEAN)) // .bit(11, this.generateTowerChannel(tower, "LEVEL_1_OVER_DISCHARGING_POWER", @@ -591,22 +597,28 @@ private synchronized void initializeTowerModulesChannels(int numberOfTowers, int Level.WARNING)) // .bit(10, this.generateTowerChannel(tower, "LEVEL_2_EXTERNAL_COMMUNICATION", Level.WARNING)) // - .bit(11, this.generateTowerChannel(tower, "LEVEL_2_PRECHARGE_FAIL", Level.WARNING)) // - .bit(12, this.generateTowerChannel(tower, "LEVEL_2_PARALLEL_FAIL", Level.WARNING)) // + .bit(11, this.generateTowerChannel(tower, "LEVEL_2_PRECHARGE_FAIL", + Level.WARNING)) // + .bit(12, this.generateTowerChannel(tower, "LEVEL_2_PARALLEL_FAIL", + Level.WARNING)) // .bit(13, this.generateTowerChannel(tower, "LEVEL_2_SYSTEM_FAIL", Level.WARNING)) // - .bit(14, this.generateTowerChannel(tower, "LEVEL_2_HARDWARE_FAIL", Level.WARNING)) // + .bit(14, this.generateTowerChannel(tower, "LEVEL_2_HARDWARE_FAIL", + Level.WARNING)) // .bit(14, this.generateTowerChannel(tower, "LEVEL_2_BAT_UNDER_VOLTAGE", Level.WARNING))), // m(new BitsWordElement(towerOffset + 6, this) .bit(0, this.generateTowerChannel(tower, "HW_AFE_COMMUNICAITON_FAULT", Level.WARNING)) // - .bit(1, this.generateTowerChannel(tower, "HW_ACTOR_DRIVER_FAULT", Level.WARNING)) // + .bit(1, this.generateTowerChannel(tower, "HW_ACTOR_DRIVER_FAULT", + Level.WARNING)) // .bit(2, this.generateTowerChannel(tower, "HW_EEPROM_COMMUNICATION_FAULT", Level.WARNING)) // - .bit(3, this.generateTowerChannel(tower, "HW_VOLTAGE_DETECT_FAULT", Level.WARNING)) // + .bit(3, this.generateTowerChannel(tower, "HW_VOLTAGE_DETECT_FAULT", + Level.WARNING)) // .bit(4, this.generateTowerChannel(tower, "HW_TEMPERATURE_DETECT_FAULT", Level.WARNING)) // - .bit(5, this.generateTowerChannel(tower, "HW_CURRENT_DETECT_FAULT", Level.WARNING)) // + .bit(5, this.generateTowerChannel(tower, "HW_CURRENT_DETECT_FAULT", + Level.WARNING)) // .bit(6, this.generateTowerChannel(tower, "HW_ACTOR_NOT_CLOSE", Level.WARNING)) // .bit(7, this.generateTowerChannel(tower, "HW_ACTOR_NOT_OPEN", Level.WARNING)) // .bit(8, this.generateTowerChannel(tower, "HW_FUSE_BROKEN", Level.WARNING))), // @@ -615,7 +627,8 @@ private synchronized void initializeTowerModulesChannels(int numberOfTowers, int Level.WARNING)) // .bit(1, this.generateTowerChannel(tower, "SYSTEM_AFE_UNDER_TEMPERATURE", Level.WARNING)) // - .bit(2, this.generateTowerChannel(tower, "SYSTEM_AFE_OVER_VOLTAGE", Level.WARNING)) // + .bit(2, this.generateTowerChannel(tower, "SYSTEM_AFE_OVER_VOLTAGE", + Level.WARNING)) // .bit(3, this.generateTowerChannel(tower, "SYSTEM_AFE_UNDER_VOLTAGE", Level.WARNING)) // .bit(4, this.generateTowerChannel(tower, @@ -626,7 +639,8 @@ private synchronized void initializeTowerModulesChannels(int numberOfTowers, int "SYSTEM_HIGH_CELL_VOLTAGE_PERMANENT_FAILURE", Level.WARNING)) // .bit(7, this.generateTowerChannel(tower, "SYSTEM_LOW_CELL_VOLTAGE_PERMANENT_FAILURE", Level.WARNING)) // - .bit(8, this.generateTowerChannel(tower, "SYSTEM_SHORT_CIRCUIT", Level.WARNING))), // + .bit(8, this.generateTowerChannel(tower, "SYSTEM_SHORT_CIRCUIT", + Level.WARNING))), // m(this.generateTowerChannel(tower, "_SOC", OpenemsType.INTEGER), new UnsignedWordElement(towerOffset + 8), // [%] ElementToChannelConverter.SCALE_FACTOR_MINUS_1), // diff --git a/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/BatteryInverterConstraint.java b/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/BatteryInverterConstraint.java index cb71904da74..017e6f59b3c 100644 --- a/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/BatteryInverterConstraint.java +++ b/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/BatteryInverterConstraint.java @@ -15,7 +15,7 @@ public class BatteryInverterConstraint { public final Relationship relationship; public final double value; - public static BatteryInverterConstraint[] NO_CONSTRAINTS = new BatteryInverterConstraint[] {}; + public static BatteryInverterConstraint[] NO_CONSTRAINTS = {}; public BatteryInverterConstraint(String description, Phase phase, Pwr pwr, Relationship relationship, double value) { diff --git a/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/HybridManagedSymmetricBatteryInverter.java b/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/HybridManagedSymmetricBatteryInverter.java index c437ec3d204..87edce970b1 100644 --- a/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/HybridManagedSymmetricBatteryInverter.java +++ b/io.openems.edge.batteryinverter.api/src/io/openems/edge/batteryinverter/api/HybridManagedSymmetricBatteryInverter.java @@ -24,7 +24,7 @@ public interface HybridManagedSymmetricBatteryInverter public enum ChannelId implements io.openems.edge.common.channel.ChannelId { /** * DC Discharge Power. - * + * *