You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2020/03/17 21:17:03 UTC

[incubator-streampipes-extensions] branch dev updated: Update NETIO adapters

This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes-extensions.git


The following commit(s) were added to refs/heads/dev by this push:
     new e333255  Update NETIO adapters
e333255 is described below

commit e333255f66eb7519e0e68859c0fde72ecaa6e319
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Tue Mar 17 22:16:35 2020 +0100

    Update NETIO adapters
---
 .../connect/adapters/netio/NetioUtils.java         | 28 ++++++++++++++++++++--
 .../strings.en                                     |  2 +-
 .../strings.en                                     |  2 +-
 3 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/streampipes-connect-adapters/streampipes-connect-adapter/src/main/java/org/apache/streampipes/connect/adapters/netio/NetioUtils.java b/streampipes-connect-adapters/streampipes-connect-adapter/src/main/java/org/apache/streampipes/connect/adapters/netio/NetioUtils.java
index 639471e..5a9ca0d 100644
--- a/streampipes-connect-adapters/streampipes-connect-adapter/src/main/java/org/apache/streampipes/connect/adapters/netio/NetioUtils.java
+++ b/streampipes-connect-adapters/streampipes-connect-adapter/src/main/java/org/apache/streampipes/connect/adapters/netio/NetioUtils.java
@@ -25,6 +25,8 @@ import org.apache.streampipes.sdk.builder.PrimitivePropertyBuilder;
 import org.apache.streampipes.sdk.helpers.EpProperties;
 import org.apache.streampipes.sdk.utils.Datatypes;
 
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -45,6 +47,24 @@ public class NetioUtils {
     public static final String LOAD_KEY = "load";
     public static final String ENERGY_KEY = "energy";
 
+    public static URI VOLT = null;
+    public static URI WATT = null;
+    public static URI AMPERE = null;
+    public static URI WATTHOUR = null;
+    public static URI HERTZ = null;
+
+    static {
+        try {
+            VOLT = new URI("http://qudt.org/vocab/unit#Volt");
+            WATT = new URI("http://qudt.org/vocab/unit#Watt");
+            AMPERE = new URI("http://qudt.org/vocab/unit#Ampere");
+            WATTHOUR = new URI("http://qudt.org/vocab/unit#Watthour");
+            HERTZ = new URI("http://qudt.org/vocab/unit#Hertz");
+        } catch (URISyntaxException e) {
+            e.printStackTrace();
+        }
+    }
+
 
     public static GuessSchema getNetioSchema() {
 
@@ -65,12 +85,14 @@ public class NetioUtils {
                         .create(Datatypes.Float, VOLTAGE_KEY)
                         .label("Voltage")
                         .description("Instantaneous voltage")
+                        .measurementUnit(VOLT)
                         .build());
         allProperties.add(
                 PrimitivePropertyBuilder
                         .create(Datatypes.Float, FREQUENCY_KEY)
                         .label("Frequency")
                         .description("Instantaneous frequency")
+                        .measurementUnit(HERTZ)
                         .build());
         allProperties.add(
                 PrimitivePropertyBuilder
@@ -94,19 +116,20 @@ public class NetioUtils {
                 PrimitivePropertyBuilder
                         .create(Datatypes.Integer, ACTION_KEY)
                         .label("Action")
-                        .description("TODO")
+                        .description("")
                         .build());
         allProperties.add(
                 PrimitivePropertyBuilder
                         .create(Datatypes.Integer, DELAY_KEY)
                         .label("Delay")
-                        .description("TODO")
+                        .description("")
                         .build());
         allProperties.add(
                 PrimitivePropertyBuilder
                         .create(Datatypes.Float, CURRENT_KEY)
                         .label("Current")
                         .description("Instantaneous current for the specific power output")
+                        .measurementUnit(AMPERE)
                         .build());
         allProperties.add(
                 PrimitivePropertyBuilder
@@ -125,6 +148,7 @@ public class NetioUtils {
                         .create(Datatypes.Float, ENERGY_KEY)
                         .label("Energy")
                         .description("Instantaneous energy counter for the value for the specific power output")
+                        .measurementUnit(WATTHOUR)
                         .build());
 
         eventSchema.setEventProperties(allProperties);
diff --git a/streampipes-connect-adapters/streampipes-connect-adapter/src/main/resources/org.apache.streampipes.connect.adapters.netio.mqtt/strings.en b/streampipes-connect-adapters/streampipes-connect-adapter/src/main/resources/org.apache.streampipes.connect.adapters.netio.mqtt/strings.en
index 32e5228..6682d1e 100644
--- a/streampipes-connect-adapters/streampipes-connect-adapter/src/main/resources/org.apache.streampipes.connect.adapters.netio.mqtt/strings.en
+++ b/streampipes-connect-adapters/streampipes-connect-adapter/src/main/resources/org.apache.streampipes.connect.adapters.netio.mqtt/strings.en
@@ -1,4 +1,4 @@
-org.apache.streampipes.connect.adapters.netio.mqtt.title=NETIO MQTT
+org.apache.streampipes.connect.adapters.netio.mqtt.title=NETIO MQTT M2M
 org.apache.streampipes.connect.adapters.netio.mqtt.description=Connect a NETIO power plugs over MQTT
 
 access-mode.title=Access Mode
diff --git a/streampipes-connect-adapters/streampipes-connect-adapter/src/main/resources/org.apache.streampipes.connect.adapters.netio.rest/strings.en b/streampipes-connect-adapters/streampipes-connect-adapter/src/main/resources/org.apache.streampipes.connect.adapters.netio.rest/strings.en
index 8d4da04..fd35347 100644
--- a/streampipes-connect-adapters/streampipes-connect-adapter/src/main/resources/org.apache.streampipes.connect.adapters.netio.rest/strings.en
+++ b/streampipes-connect-adapters/streampipes-connect-adapter/src/main/resources/org.apache.streampipes.connect.adapters.netio.rest/strings.en
@@ -1,4 +1,4 @@
-org.apache.streampipes.connect.adapters.netio.rest.title=NETIO REST
+org.apache.streampipes.connect.adapters.netio.rest.title=NETIO http JSON
 org.apache.streampipes.connect.adapters.netio.rest.description=Connect a NETIO REST power plug
 
 NETIO_IP.title=Netio endpoint