Skip to content

Commit

Permalink
Merge branch 'release/2024.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeilmeier committed Mar 3, 2024
2 parents 3e1cc29 + 08c2380 commit a8734be
Show file tree
Hide file tree
Showing 370 changed files with 21,203 additions and 10,096 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup Java 17
- name: Setup Java 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'
cache: gradle

- uses: kiancross/checkstyle-annotations-action@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup Java 17
- name: Setup Java 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'
cache: gradle

- name: Build Javadocs
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup Java 17
- name: Setup Java 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'
cache: gradle

- uses: kiancross/checkstyle-annotations-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM gitpod/workspace-postgres

RUN bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh \
&& sdk install java 17.0.6-tem"
&& sdk install java 21.0.2-tem"

# disable angular analytics
ENV NG_CLI_ANALYTICS=false
Expand Down
2 changes: 1 addition & 1 deletion .gradle-wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies {

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
languageVersion = JavaLanguageVersion.of(project.java_source as Integer)
}
}

Expand All @@ -35,6 +35,7 @@ subprojects {
}

tasks.withType(JavaCompile) {
options.release.set(project.java_target as Integer)
options.encoding = 'UTF-8'
options.fork = true
options.incremental = true
Expand Down
16 changes: 8 additions & 8 deletions cnf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<!-- Used by com.squareup.okhttp3: okhttp -->
<groupId>com.squareup.okio</groupId>
<artifactId>okio-jvm</artifactId>
<version>3.7.0</version>
<version>3.8.0</version>
</dependency>
<dependency>
<!-- Used by com.influxdb: influxdb-client -->
Expand Down Expand Up @@ -259,7 +259,7 @@
<dependency>
<groupId>org.dhatim</groupId>
<artifactId>fastexcel</artifactId>
<version>0.16.6</version>
<version>0.17.0</version>
</dependency>
<dependency>
<!-- Eclipse Paho MQTTv5 Client -->
Expand All @@ -270,22 +270,22 @@
<dependency>
<groupId>com.influxdb</groupId>
<artifactId>influxdb-client-java</artifactId>
<version>6.12.0</version>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>com.influxdb</groupId>
<artifactId>influxdb-client-core</artifactId>
<version>6.12.0</version>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>com.influxdb</groupId>
<artifactId>influxdb-client-utils</artifactId>
<version>6.12.0</version>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>com.influxdb</groupId>
<artifactId>flux-dsl</artifactId>
<version>6.12.0</version>
<version>7.0.0</version>
</dependency>
<dependency>
<groupId>org.java-websocket</groupId>
Expand All @@ -300,7 +300,7 @@
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-core-jvm</artifactId>
<version>1.7.3</version>
<version>1.8.0</version>
</dependency>
<dependency>
<!-- HTML processing -->
Expand Down Expand Up @@ -393,7 +393,7 @@
<!-- Used by io.openems.backend.metadata.odoo -->
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.7.1</version>
<version>42.7.2</version>
</dependency>
<dependency>
<!-- Used by com.influxdb: influxdb -->
Expand Down
7 changes: 6 additions & 1 deletion doc/modules/ROOT/pages/contribute/coding-guidelines.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@

While IntelliJ also works, Eclipse IDE is the officially supported development environment. It also provides tool support for guided assistance via bndtools.

.Eclipse Version

Some Eclipse default code formatting rules and warning settings change over time. Therefore,
always use the latest Version of the Eclipse IDE for Java Developers (4.30.0 +).

.Eclipse Code formatter

Use `Eclipse [built-in]` Code Formatting Rules
Use `Eclipse [built-in]` code formatting rules

* Eclipse -> Window -> Preferences -> Java -> Code Style -> Formatter -> ActiveProfile -> select -> `Eclipse [built-in]`

Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
java_source=21
java_target=17

bnd_version=7.0.0
bnd_snapshots=https://bndtools.jfrog.io/bndtools/libs-snapshot-local
bnd_releases=https://bndtools.jfrog.io/bndtools/libs-release-local
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.gson.JsonElement;

import io.openems.backend.alerting.handler.OfflineEdgeHandler;
import io.openems.backend.alerting.handler.SumStateHandler;
import io.openems.backend.alerting.scheduler.Scheduler;
import io.openems.backend.common.component.AbstractOpenemsBackendComponent;
import io.openems.backend.common.debugcycle.DebugLoggable;
Expand All @@ -39,6 +40,7 @@
)
@EventTopics({ //
Edge.Events.ON_SET_ONLINE, //
Edge.Events.ON_SET_SUM_STATE, //
Metadata.Events.AFTER_IS_INITIALIZED //
})
public class Alerting extends AbstractOpenemsBackendComponent implements EventHandler, DebugLoggable {
Expand All @@ -65,7 +67,7 @@ private static final ThreadPoolExecutor createDefaultExecutorService() {

private final Scheduler scheduler;

protected final List<Handler<?>> handler = new ArrayList<>(1);
protected final List<Handler<?>> handler = new ArrayList<>(2);

protected Alerting(Scheduler scheduler, ThreadPoolExecutor executor) {
super("Alerting");
Expand All @@ -82,9 +84,17 @@ protected void activate(Config config) {
this.logInfo(this.log, "Activate");
this.scheduler.start();

var handler = new OfflineEdgeHandler(this.scheduler, this.scheduler, this.mailer, this.metadata, //
config.initialDelay());
this.handler.add(handler);
if (config.notifyOnOffline()) {
var handler = new OfflineEdgeHandler(this.scheduler, this.scheduler, this.mailer, this.metadata, //
config.initialDelay());
this.handler.add(handler);
}

if (config.notifyOnSumStateChange()) {
var handler = new SumStateHandler(this.scheduler, this.scheduler, this.mailer, this.metadata, //
config.initialDelay());
this.handler.add(handler);
}
}

@Deactivate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@
@AttributeDefinition(name = "Initial Delay", description = "Delay in minutes, after Backend start, before Offline-Edge detection starts.")
int initialDelay() default 15;

@AttributeDefinition(name = "Notify On Offline", description = "Enable E-Mail-Notifications on Edge connection losses.")
boolean notifyOnOffline() default true;

@AttributeDefinition(name = "Notify On SumStateChange", description = "Enable E-Mail-Notifications on Edge SumStateChange conditions.")
boolean notifyOnSumStateChange() default true;

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import io.openems.backend.alerting.scheduler.MessageSchedulerService;
import io.openems.backend.alerting.scheduler.TimedExecutor;
import io.openems.backend.alerting.scheduler.TimedExecutor.TimedTask;
import io.openems.backend.common.metadata.UserAlertingSettings;
import io.openems.backend.common.alerting.OfflineEdgeAlertingSetting;
import io.openems.backend.common.metadata.Edge;
import io.openems.backend.common.metadata.Mailer;
import io.openems.backend.common.metadata.Metadata;
Expand Down Expand Up @@ -156,13 +156,13 @@ protected OfflineEdgeMessage getEdgeMessage(Edge edge) {
return null;
}
try {
var alertingSettings = this.metadata.getUserAlertingSettings(edge.getId());
var alertingSettings = this.metadata.getEdgeOfflineAlertingSettings(edge.getId());
if (alertingSettings == null || alertingSettings.isEmpty()) {
return null;
}
var message = new OfflineEdgeMessage(edge.getId(), edge.getLastmessage());
for (var setting : alertingSettings) {
if (setting.getDelayTime() > 0 && this.shouldReceiveMail(edge, setting)) {
if (setting.delay() > 0 && this.shouldReceiveMail(edge, setting)) {
message.addRecipient(setting);
}
}
Expand All @@ -175,15 +175,15 @@ protected OfflineEdgeMessage getEdgeMessage(Edge edge) {
return null;
}

private boolean shouldReceiveMail(Edge edge, UserAlertingSettings setting) {
final var lastMailRecievedAt = setting.getLastNotification();
private boolean shouldReceiveMail(Edge edge, OfflineEdgeAlertingSetting setting) {
final var lastMailRecievedAt = setting.lastNotification();
final var edgeOfflineSince = edge.getLastmessage();

var hasNotRecievedMailYet = true;
var neverRecievedAnyMail = lastMailRecievedAt == null;

if (!neverRecievedAnyMail) {
var nextMailRecieveAt = edgeOfflineSince.plus(setting.getDelayTime(), ChronoUnit.MINUTES);
var nextMailRecieveAt = edgeOfflineSince.plus(setting.delay(), ChronoUnit.MINUTES);
hasNotRecievedMailYet = nextMailRecieveAt.isAfter(lastMailRecievedAt);
}

Expand Down
Loading

0 comments on commit a8734be

Please sign in to comment.