Skip to content

Commit

Permalink
Merge branch 'release/2023.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeilmeier committed Nov 1, 2023
2 parents 1308add + b522a06 commit c8a21b7
Show file tree
Hide file tree
Showing 408 changed files with 12,532 additions and 5,012 deletions.
2 changes: 1 addition & 1 deletion .gitpod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ENV TRIGGER_REBUILD 4
RUN npm install -g @angular/cli

# Install odoo
ENV ODOO_VERSION 15.0
ENV ODOO_VERSION 16.0
ENV ODOO_RELEASE latest
RUN curl -o odoo.deb -sSL http://nightly.odoo.com/${ODOO_VERSION}/nightly/deb/odoo_${ODOO_VERSION}.${ODOO_RELEASE}_all.deb \
&& sudo apt-get update \
Expand Down
6 changes: 3 additions & 3 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ tasks:
cd /workspace/odoo
mkdir -p addons-available addons-enabled
cd addons-available
git clone --depth=1 -b 15.0 https://github.com/OCA/partner-contact
git clone --depth=1 -b 15.0 https://github.com/OCA/web.git
git clone --depth=1 -b 15.0 https://github.com/OpenEMS/odoo-openems.git
git clone --depth=1 -b 16.0 https://github.com/OCA/partner-contact
git clone --depth=1 -b 16.0 https://github.com/OCA/web.git
git clone --depth=1 -b 16.0 https://github.com/OpenEMS/odoo-openems.git
cd ../addons-enabled
ln -s ../addons-available/partner-contact/partner_firstname
ln -s ../addons-available/web/web_m2x_options
Expand Down
Binary file modified .gradle-wrapper/gradle-wrapper.jar
Binary file not shown.
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.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion cnf/build.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ buildpath: \
org.osgi.service.metatype;version='1.4.1',\
org.osgi.service.metatype.annotations;version='1.4.1',\
org.osgi.util.promise;version='1.2.0',\
com.google.guava;version='32.1.2.jre',\
com.google.guava;version='32.1.3.jre',\
com.google.gson;version='2.10.1',\

testpath: \
Expand Down
33 changes: 13 additions & 20 deletions cnf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!-- On update: also update gradle.properties file -->
<groupId>biz.aQute.bnd.workspace</groupId>
<artifactId>biz.aQute.bnd.workspace.gradle.plugin</artifactId>
<version>6.4.0</version>
<version>7.0.0</version>
</dependency>
<!-- com -->
<dependency>
Expand All @@ -37,30 +37,30 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.2-jre</version>
<version>32.1.3-jre</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>failureaccess</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
</dependency>
<dependency>
<!-- Used by com.influxdb: influxdb -->
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>4.11.0</version>
<version>4.12.0</version>
</dependency>
<dependency>
<!-- Used by com.influxdb: influxdb -->
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.11.0</version>
<version>4.12.0</version>
</dependency>
<dependency>
<!-- Used by com.squareup.okhttp3: okhttp -->
<groupId>com.squareup.okio</groupId>
<artifactId>okio-jvm</artifactId>
<version>3.5.0</version>
<version>3.6.0</version>
</dependency>
<dependency>
<!-- Used by com.influxdb: influxdb-client -->
Expand Down Expand Up @@ -109,15 +109,15 @@
<!-- Changelog: https://commons.apache.org/proper/commons-io/changes-report.html -->
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.13.0</version>
<version>2.15.0</version>
</dependency>
<!-- de -->
<dependency>
<!-- PgBulkInsert is a Java library for Bulk Inserts to PostgreSQL using the Binary COPY Protocol. -->
<!-- Changelog: https://github.com/PgBulkInsert/PgBulkInsert/blob/master/CHANGELOG.md-->
<groupId>de.bytefish</groupId>
<artifactId>pgbulkinsert</artifactId>
<version>8.1.1</version>
<version>8.1.2</version>
</dependency>
<!-- eu -->
<dependency>
Expand Down Expand Up @@ -154,7 +154,7 @@
<dependency>
<groupId>io.reactivex.rxjava3</groupId>
<artifactId>rxjava</artifactId>
<version>3.1.7</version>
<version>3.1.8</version>
</dependency>
<!-- javax -->
<dependency>
Expand Down Expand Up @@ -208,13 +208,13 @@
<!-- Changelog: https://github.com/apache/felix-dev/commits/master/http -->
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.http.jetty</artifactId>
<version>5.1.0</version>
<version>5.1.2</version>
</dependency>
<dependency>
<!-- Apache Felix Servlet API -->
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.http.servlet-api</artifactId>
<version>2.1.0</version>
<version>3.0.0</version>
</dependency>
<dependency>
<!-- Apache Felix Inventory -->
Expand Down Expand Up @@ -242,7 +242,7 @@
<!-- Changelog: https://github.com/apache/felix-dev/blob/master/webconsole/README.md#releases -->
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.webconsole</artifactId>
<version>4.9.4</version>
<version>4.9.6</version>
</dependency>
<dependency>
<!-- Apache Felix Web Console Service Component Runtime/Declarative Services Plugin -->
Expand All @@ -256,13 +256,6 @@
<artifactId>org.apache.servicemix.bundles.junit</artifactId>
<version>4.13.2_1</version>
</dependency>
<dependency>
<!-- Checker Qual: annotations for type-checking by the Checker Framework -->
<!-- Changelog: https://github.com/typetools/checker-framework/blob/master/docs/CHANGELOG.md -->
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<version>3.38.0</version>
</dependency>
<dependency>
<groupId>org.dhatim</groupId>
<artifactId>fastexcel</artifactId>
Expand Down Expand Up @@ -313,7 +306,7 @@
<!-- HTML processing -->
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.16.1</version>
<version>1.16.2</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 43 additions & 1 deletion doc/modules/ROOT/pages/ui/implementing-a-widget.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,46 @@ Shows a horizontal line, that is used to divide children of AbstractFlatWidgetLi
Passing data can be done two ways:

- @Input() channelAddress: provide channel, which will be subscribed in AbstractFlatWidgetLine.
- @Input() value: subscribe in the ts-file and pass the subscribed value.
- @Input() value: subscribe in the ts-file and pass the subscribed value.

### Creating a modal

Creating a `modal-widget` is pretty similar to creating a `flat-widget`.
The model should act as the detailed view of a `flat-widget` and can also fit the purpose of user interaction.

There are multiple implementations of `modals` at the creation time of this page, but the one thats considered best practice is the unit-testable version.

#### Creating a Line

Lets take a look at one link:https://github.com/OpenEMS/openems/blob/develop/ui/src/app/edge/live/common/consumption/modal/modal.ts[example].

[source, html]
----
public static generateView(
config: EdgeConfig, role: Role, translate: TranslateService)
:OeFormlyView {
// Total
lines.push({
type: 'channel-line',
name: translate.instant('General.TOTAL'),
channel: '_sum/ConsumptionActivePower',
converter: Converter.ONLY_POSITIVE_POWER_AND_NEGATIVE_AS_ZERO
});
return {
title: translate.instant('General.grid'),
lines: lines
};
}
----

Predefined fields in link:https://github.com/OpenEMS/openems/blob/develop/ui/src/app/shared/genericComponents/shared/oe-formly-component.ts[OeFormlyField] can be used here.

For this line we use the type 'channel-line'. This represents a line, where a channel has to be subscribed. You also need to specify the link:https://github.com/OpenEMS/openems/blob/develop/ui/src/app/shared/genericComponents/shared/converter.ts[converter], that uses the data coming from this channel and mutates it. A link:https://github.com/OpenEMS/openems/blob/develop/ui/src/app/shared/genericComponents/shared/filter.ts[filter], which has to return a boolean, decides if the line will be shown or not.

NOTE: Lines should always present one line of data visualisation. It could be consisting of a identifier and a value or just a value. The value or channel will be shown at the end of the line, the name, if provided, at the start.

This line will be looking like this:

image::modal-line-example-consumption.png[]
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bnd_version=6.4.0
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
3 changes: 2 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ protected void tryRemoveEdge(Edge edge) {
protected void tryAddEdge(Edge edge) {
if (this.isValidEdge(edge)) {
var msg = this.getEdgeMessage(edge);
if (msg != null) {
var msgScheduler = this.msgScheduler;
if (msg != null && msgScheduler != null) {
this.msgScheduler.schedule(msg);
}
}
Expand Down
17 changes: 8 additions & 9 deletions io.openems.backend.application/BackendApp.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@

-runbundles: \
Java-WebSocket;version='[1.5.4,1.5.5)',\
checker-qual;version='[3.38.0,3.38.1)',\
com.google.gson;version='[2.10.1,2.10.2)',\
com.google.guava;version='[32.1.2,32.1.3)',\
com.google.guava.failureaccess;version='[1.0.1,1.0.2)',\
com.squareup.okio;version='[3.5.0,3.5.1)',\
com.google.guava;version='[32.1.3,32.1.4)',\
com.google.guava.failureaccess;version='[1.0.2,1.0.3)',\
com.squareup.okio;version='[3.6.0,3.6.1)',\
com.zaxxer.HikariCP;version='[5.0.1,5.0.2)',\
io.openems.backend.alerting;version=snapshot,\
io.openems.backend.application;version=snapshot,\
Expand Down Expand Up @@ -99,19 +98,19 @@
io.openems.wrapper.retrofit-converter-gson;version=snapshot,\
io.openems.wrapper.retrofit-converter-scalars;version=snapshot,\
io.openems.wrapper.retrofit2;version=snapshot,\
io.reactivex.rxjava3.rxjava;version='[3.1.7,3.1.8)',\
io.reactivex.rxjava3.rxjava;version='[3.1.8,3.1.9)',\
org.apache.commons.commons-csv;version='[1.10.0,1.10.1)',\
org.apache.commons.commons-fileupload;version='[1.5.0,1.5.1)',\
org.apache.commons.commons-io;version='[2.13.0,2.13.1)',\
org.apache.commons.commons-io;version='[2.15.0,2.15.1)',\
org.apache.felix.configadmin;version='[1.9.26,1.9.27)',\
org.apache.felix.eventadmin;version='[1.6.4,1.6.5)',\
org.apache.felix.fileinstall;version='[3.7.4,3.7.5)',\
org.apache.felix.http.jetty;version='[5.1.0,5.1.1)',\
org.apache.felix.http.servlet-api;version='[2.1.0,2.1.1)',\
org.apache.felix.http.jetty;version='[5.1.2,5.1.3)',\
org.apache.felix.http.servlet-api;version='[3.0.0,3.0.1)',\
org.apache.felix.inventory;version='[2.0.0,2.0.1)',\
org.apache.felix.metatype;version='[1.2.4,1.2.5)',\
org.apache.felix.scr;version='[2.2.6,2.2.7)',\
org.apache.felix.webconsole;version='[4.9.4,4.9.5)',\
org.apache.felix.webconsole;version='[4.9.6,4.9.7)',\
org.apache.felix.webconsole.plugins.ds;version='[2.3.0,2.3.1)',\
org.jetbrains.kotlin.osgi-bundle;version='[1.9.10,1.9.11)',\
org.jsr-305;version='[3.0.2,3.0.3)',\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import io.openems.backend.common.metadata.Metadata;
import io.openems.backend.common.timedata.TimedataManager;
import io.openems.common.utils.ThreadPoolUtils;
import io.openems.common.websocket.AbstractWebsocketServer.DebugMode;

@Designate(ocd = Config.class, factory = true)
@Component(//
Expand All @@ -37,6 +36,8 @@
})
public class Backend2BackendWebsocket extends AbstractOpenemsBackendComponent implements EventHandler {

private static final String COMPONENT_ID = "b2bwebsocket0";

public static final int DEFAULT_PORT = 8076;

protected final ScheduledExecutorService executor = Executors.newScheduledThreadPool(10,
Expand Down Expand Up @@ -64,6 +65,10 @@ public Backend2BackendWebsocket() {
@Activate
private void activate(Config config) {
this.config = config;

if (this.metadata.isInitialized()) {
this.startServer();
}
}

@Deactivate
Expand All @@ -74,14 +79,13 @@ private void deactivate() {

/**
* Create and start new server.
*
* @param port the port
* @param poolSize number of threads dedicated to handle the tasks
* @param debugMode activate a regular debug log about the state of the tasks
*/
private synchronized void startServer(int port, int poolSize, DebugMode debugMode) {
this.server = new WebsocketServer(this, this.getName(), port, poolSize, debugMode);
this.server.start();
private synchronized void startServer() {
if (this.server == null) {
this.server = new WebsocketServer(this, this.getName(), this.config.port(), this.config.poolSize(),
this.config.debugMode());
this.server.start();
}
}

/**
Expand Down Expand Up @@ -112,8 +116,13 @@ protected void logError(Logger log, String message) {
public void handleEvent(Event event) {
switch (event.getTopic()) {
case Metadata.Events.AFTER_IS_INITIALIZED:
this.startServer(this.config.port(), this.config.poolSize(), this.config.debugMode());
this.startServer();
break;
}
}

public String getId() {
return COMPONENT_ID;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void run(WebSocket ws, JsonObject handshake) throws OpenemsNamedException
try {
// Read "Authorization" header for Simple HTTP authentication. Source:
// https://stackoverflow.com/questions/16000517/how-to-get-password-from-http-basic-authentication
final var authorization = JsonUtils.getAsString(handshake, "Authorization");
final var authorization = JsonUtils.getAsString(handshake, "authorization");
if (authorization == null || !authorization.toLowerCase().startsWith("basic")) {
throw OpenemsError.COMMON_AUTHENTICATION_FAILED.exception();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public WebsocketServer(Backend2BackendWebsocket parent, String name, int port, i
var data = TreeBasedTable.<Long, String, JsonElement>create();
var now = Instant.now().toEpochMilli();
ThreadPoolUtils.debugMetrics(executor).forEach((key, value) -> {
data.put(now, "b2bwebsocket/" + key, new JsonPrimitive(value));
data.put(now, parent.getId() + "/" + key, new JsonPrimitive(value));
});
parent.timedataManager.write("backend0", new TimestampedDataNotification(data));
});
Expand Down
Loading

0 comments on commit c8a21b7

Please sign in to comment.