NEW : Introducing Nica System
parent
f66fb9dd95
commit
af0bf649dc
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
17
pom.xml
17
pom.xml
|
@ -109,6 +109,23 @@
|
|||
<!-- <version>${runtime.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>5.2.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>5.2.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jbpm</groupId>
|
||||
<artifactId>jbpm-test</artifactId>
|
||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
|||
MmfFR7KvbrelQJAsfKnmLKfdIATdIuHOTZc0H4B9gJweQ3Ifx6SJjVoBs59hW1iY
|
||||
936JzYXxJIzzITnuVOGYMDHRCYtKuaF4EOSY3p8jUPeZNV9HeqPBYXQ0WybUy11V
|
|
@ -0,0 +1,17 @@
|
|||
package Files;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import static Credentials.UserCredentials.getHomeRoot;
|
||||
|
||||
|
||||
public class ReadExcelFile {
|
||||
|
||||
public void readExcel() throws IOException {
|
||||
// Create an instance of the class that reads Excel files
|
||||
|
||||
// Read XLSX file
|
||||
FileInputStream file = new FileInputStream(getHomeRoot() + "Spritztagebuch.xlsx");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
package Files;
|
||||
|
||||
import Credentials.UserCredentials;
|
||||
import HttpCall.PlonkHttpGet;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
public class UnZipFile {
|
||||
// public static void main(String[] args) {
|
||||
//
|
||||
// UserCredentials userCredentials = new UserCredentials();
|
||||
// String workPath = userCredentials.getHomeRoot();
|
||||
//
|
||||
// Path source = Paths.get(workPath+"PlonkData.zip");
|
||||
// Path target = Paths.get(workPath);
|
||||
//
|
||||
// try {
|
||||
//
|
||||
// unzipFolder(source, target);
|
||||
// System.out.println("Done");
|
||||
//
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
public static void unzipFolder(Path source, Path target) throws IOException {
|
||||
|
||||
try (ZipInputStream zis = new ZipInputStream(new FileInputStream(source.toFile()))) {
|
||||
|
||||
// list files in zip
|
||||
ZipEntry zipEntry = zis.getNextEntry();
|
||||
|
||||
while (zipEntry != null) {
|
||||
|
||||
boolean isDirectory = false;
|
||||
// example 1.1
|
||||
// some zip stored files and folders separately
|
||||
// e.g data/
|
||||
// data/folder/
|
||||
// data/folder/file.txt
|
||||
if (zipEntry.getName().endsWith(File.separator)) {
|
||||
isDirectory = true;
|
||||
}
|
||||
|
||||
Path newPath = zipSlipProtect(zipEntry, target);
|
||||
|
||||
if (isDirectory) {
|
||||
Files.createDirectories(newPath);
|
||||
} else {
|
||||
|
||||
// example 1.2
|
||||
// some zip stored file path only, need create parent directories
|
||||
// e.g data/folder/file.txt
|
||||
if (newPath.getParent() != null) {
|
||||
if (Files.notExists(newPath.getParent())) {
|
||||
Files.createDirectories(newPath.getParent());
|
||||
}
|
||||
}
|
||||
|
||||
// copy files, nio
|
||||
Files.copy(zis, newPath, StandardCopyOption.REPLACE_EXISTING);
|
||||
|
||||
// copy files, classic
|
||||
/*try (FileOutputStream fos = new FileOutputStream(newPath.toFile())) {
|
||||
byte[] buffer = new byte[1024];
|
||||
int len;
|
||||
while ((len = zis.read(buffer)) > 0) {
|
||||
fos.write(buffer, 0, len);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
zipEntry = zis.getNextEntry();
|
||||
|
||||
}
|
||||
zis.closeEntry();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// protect zip slip attack
|
||||
public static Path zipSlipProtect(ZipEntry zipEntry, Path targetDir)
|
||||
throws IOException {
|
||||
|
||||
// test zip slip vulnerability
|
||||
// Path targetDirResolved = targetDir.resolve("../../" + zipEntry.getName());
|
||||
|
||||
Path targetDirResolved = targetDir.resolve(zipEntry.getName());
|
||||
|
||||
// make sure normalized file still has targetDir as its prefix
|
||||
// else throws exception
|
||||
Path normalizePath = targetDirResolved.normalize();
|
||||
if (!normalizePath.startsWith(targetDir)) {
|
||||
throw new IOException("Bad zip entry: " + zipEntry.getName());
|
||||
}
|
||||
|
||||
return normalizePath;
|
||||
}
|
||||
|
||||
}
|
|
@ -42,7 +42,7 @@ public class ApiCall {
|
|||
|
||||
ReadSensors4Partner readSensors4Partner = new ReadSensors4Partner();
|
||||
ArrayList<String> outputValue =
|
||||
(readSensors4Partner.FetchSensor4Box("Germes", token));
|
||||
(readSensors4Partner.FetchSensor4Box("Nica", token));
|
||||
|
||||
for (int i = 0; i < outputValue.size(); i++) {
|
||||
Device device;
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
public class Greenhouse {
|
||||
|
||||
private String id = "8bdbe6ae-eafb-4e99-bb01-db8784dd9633";
|
||||
private String id2="e5ec9f15-f214-455d-9f02-3c134c770dc1";//Nica
|
||||
private Severity state = Severity.Unknown;
|
||||
|
||||
public Greenhouse() {
|
||||
|
@ -16,6 +17,14 @@ public class Greenhouse {
|
|||
this.devices = devices;
|
||||
}
|
||||
|
||||
public String getId2() {
|
||||
return id2;
|
||||
}
|
||||
|
||||
public void setId2(String id2) {
|
||||
this.id2 = id2;
|
||||
}
|
||||
|
||||
public void addDevice(Device device) {
|
||||
this.devices.add(device);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
package eu.hsrw.ias.ggd;
|
||||
|
||||
import Credentials.PlonkTest;
|
||||
import Credentials.UserCredentials;
|
||||
import Files.ReadExcelFile;
|
||||
import Files.UnZipFile;
|
||||
import HttpCall.PlonkHttpGet;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class PlonkDataRequest {
|
||||
public static String x() throws Exception {
|
||||
String token;
|
||||
|
@ -14,7 +22,7 @@ public class PlonkDataRequest {
|
|||
String outputToken = PlonkHttpPostRequest.OnCallMethod();
|
||||
JSONObject obj = new JSONObject(outputToken);
|
||||
token = obj.getString("access_token");
|
||||
String urlExtension= plonkTest.getServer()+"/api/pre/objects";
|
||||
String urlExtension= plonkTest.getServer()+"/api/pre/ ubersicht/data/Gießen-Düngen%20(Stufen)";
|
||||
result = plonkHttpGet.PlonkHttpGetCall(urlExtension,token);
|
||||
|
||||
}
|
||||
|
@ -23,10 +31,30 @@ public class PlonkDataRequest {
|
|||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
//if we want to fetch data from PlonkApi
|
||||
|
||||
// try {
|
||||
// String output = x();
|
||||
// System.out.println(output);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
//This part is unziping the excel file from the url
|
||||
UnZipFile unZipFile = new UnZipFile();
|
||||
UserCredentials userCredentials = new UserCredentials();
|
||||
String workPath = userCredentials.getHomeRoot();
|
||||
|
||||
Path source = Paths.get(workPath+"PlonkData.zip");
|
||||
Path target = Paths.get(workPath);
|
||||
ReadExcelFile DT = new ReadExcelFile();
|
||||
|
||||
try {
|
||||
String output = x();
|
||||
System.out.println(output);
|
||||
} catch (Exception e) {
|
||||
|
||||
unZipFile.unzipFolder(source, target);
|
||||
DT.readExcel();
|
||||
System.out.println("Done");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,8 +16,9 @@ rule "CriticalBattery"
|
|||
then
|
||||
|
||||
String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";
|
||||
String greenhouse2="e5ec9f15-f214-455d-9f02-3c134c770dc1";//Nica
|
||||
HttpPost httpPost = new HttpPost();
|
||||
final String criticalBatteryOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Battery %s in the following sensor %s \", \"battery\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
final String criticalBatteryOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Battery %s in the following sensor %s \", \"battery\": %s}]}}",greenhouse2, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalBatteryOutput);
|
||||
insert(new Notification("battery", sensorData, Severity.Critical));
|
||||
|
||||
|
|
|
@ -13,8 +13,9 @@ rule "CriticalPrecipitation"
|
|||
sensorData: SensorData(tag == "precipitation", value > 15.5) from sensorDatas
|
||||
then
|
||||
String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";
|
||||
String greenhouse2="e5ec9f15-f214-455d-9f02-3c134c770dc1";//Nica
|
||||
HttpPost httpPost = new HttpPost();
|
||||
final String criticalPrecipitationOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Precipitation %s in the following sensor %s \", \"precipitation\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
final String criticalPrecipitationOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Precipitation %s in the following sensor %s \", \"precipitation\": %s}]}}",greenhouse2, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalPrecipitationOutput);
|
||||
insert(new Notification("precipitation", sensorData, Severity.Warning));
|
||||
|
||||
|
|
|
@ -12,9 +12,10 @@ rule "CriticalSoilMoisture"
|
|||
device: Device(sensorDatas: sensorData)
|
||||
sensorData: SensorData(tag == "soilMoisture", value < 28.0) from sensorDatas
|
||||
then
|
||||
String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";
|
||||
// String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";//Germes
|
||||
String greenhouse2="e5ec9f15-f214-455d-9f02-3c134c770dc1";//Nica
|
||||
HttpPost httpPost = new HttpPost();
|
||||
final String criticalSoilMoistureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Soil Moisture %s in the following device %s \", \"soilMoisture\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
final String criticalSoilMoistureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Soil Moisture %s in the following device %s. It’s too dry and the field needs fertilizer \", \"soilMoisture\": %s}]}}",greenhouse2, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalSoilMoistureOutput);
|
||||
final String deviceCritical = String.format("{\"id\":\"%s-status\",\"data\":{\"measured\":[{ \"criticalStatus\": \"The status of %s device is critical\"}]}}",device.IdMapper(device.getId()),device.getId());
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",deviceCritical);
|
||||
|
|
|
@ -13,8 +13,9 @@ rule "CriticalTemperature"
|
|||
sensorData: SensorData(tag == "temperature", value < 10.0 || value > 30.0) from sensorDatas
|
||||
then
|
||||
String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";
|
||||
String greenhouse2="e5ec9f15-f214-455d-9f02-3c134c770dc1";//Nica
|
||||
HttpPost httpPost = new HttpPost();
|
||||
final String criticalTemperatureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Temperature %s in the following device %s \", \"temperature\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
final String criticalTemperatureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Temperature %s in the following device %s \", \"temperature\": %s}]}}",greenhouse2, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalTemperatureOutput);
|
||||
final String deviceCritical = String.format("{\"id\":\"%s-status\",\"data\":{\"measured\":[{ \"criticalStatus\": \"The status of %s device is critical\"}]}}",device.IdMapper(device.getId()),device.getId());
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",deviceCritical);
|
||||
|
|
|
@ -13,8 +13,9 @@ rule "DielectricPermittivity"
|
|||
sensorData: SensorData(tag == "dielectricPermittivity", value > 20.0) from sensorDatas
|
||||
then
|
||||
String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";
|
||||
String greenhouse2="e5ec9f15-f214-455d-9f02-3c134c770dc1";//Nica
|
||||
HttpPost httpPost = new HttpPost();
|
||||
final String dielectricPermittivityOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical dielectricPermittivity %s in the following sensor %s \", \"dielectricPermittivityOutput\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
final String dielectricPermittivityOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical dielectricPermittivity %s in the following sensor %s \", \"dielectricPermittivityOutput\": %s}]}}",greenhouse2, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",dielectricPermittivityOutput);
|
||||
insert(new Notification("dielectricPermittivity", sensorData, Severity.Warning));
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ when
|
|||
|
||||
then
|
||||
HttpPost httpPost = new HttpPost();
|
||||
final String optimalGreenhouse = String.format("{\"id\":\"germes-greenhouse-status\",\"data\":{\"measured\":[{ \"status\": \"The status of the greenhouse is optimal\"}]}}");
|
||||
final String optimalGreenhouse = String.format("{\"id\":\"nica-greenhouse-status\",\"data\":{\"measured\":[{ \"status\": \"The status of the greenhouse is optimal\"}]}}");
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",optimalGreenhouse);
|
||||
System.out.println("Green House optimal, because of: '"+warning.getType()+"'");
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ when
|
|||
warning: Notification(severity > Severity.Warning)
|
||||
then
|
||||
HttpPost httpPost = new HttpPost();
|
||||
final String criticalGreenhouse = String.format("{\"id\":\"germes-greenhouse-status\",\"data\":{\"measured\":[{ \"status\": \"The status of the greenhouse is critical\"}]}}");
|
||||
final String criticalGreenhouse = String.format("{\"id\":\"nica-greenhouse-status\",\"data\":{\"measured\":[{ \"status\": \"The status of the greenhouse is critical\"}]}}");
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalGreenhouse);
|
||||
System.out.println(criticalGreenhouse);
|
||||
System.out.println("Green House critical, because of: '"+warning.getType()+"'");
|
||||
|
|
|
@ -16,8 +16,9 @@ rule "CriticalBattery"
|
|||
then
|
||||
|
||||
String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";
|
||||
String greenhouse2="e5ec9f15-f214-455d-9f02-3c134c770dc1";//Nica
|
||||
HttpPost httpPost = new HttpPost();
|
||||
final String criticalBatteryOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Battery %s in the following sensor %s \", \"battery\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
final String criticalBatteryOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Battery %s in the following sensor %s \", \"battery\": %s}]}}",greenhouse2, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalBatteryOutput);
|
||||
insert(new Notification("battery", sensorData, Severity.Critical));
|
||||
|
||||
|
|
|
@ -13,8 +13,9 @@ rule "CriticalPrecipitation"
|
|||
sensorData: SensorData(tag == "precipitation", value > 15.5) from sensorDatas
|
||||
then
|
||||
String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";
|
||||
String greenhouse2="e5ec9f15-f214-455d-9f02-3c134c770dc1";//Nica
|
||||
HttpPost httpPost = new HttpPost();
|
||||
final String criticalPrecipitationOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Precipitation %s in the following sensor %s \", \"precipitation\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
final String criticalPrecipitationOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Precipitation %s in the following sensor %s \", \"precipitation\": %s}]}}",greenhouse2, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalPrecipitationOutput);
|
||||
insert(new Notification("precipitation", sensorData, Severity.Warning));
|
||||
|
||||
|
|
|
@ -12,9 +12,10 @@ rule "CriticalSoilMoisture"
|
|||
device: Device(sensorDatas: sensorData)
|
||||
sensorData: SensorData(tag == "soilMoisture", value < 28.0) from sensorDatas
|
||||
then
|
||||
String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";
|
||||
// String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";//Germes
|
||||
String greenhouse2="e5ec9f15-f214-455d-9f02-3c134c770dc1";//Nica
|
||||
HttpPost httpPost = new HttpPost();
|
||||
final String criticalSoilMoistureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Soil Moisture %s in the following device %s \", \"soilMoisture\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
final String criticalSoilMoistureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Soil Moisture %s in the following device %s. It’s too dry and the field needs fertilizer \", \"soilMoisture\": %s}]}}",greenhouse2, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalSoilMoistureOutput);
|
||||
final String deviceCritical = String.format("{\"id\":\"%s-status\",\"data\":{\"measured\":[{ \"criticalStatus\": \"The status of %s device is critical\"}]}}",device.IdMapper(device.getId()),device.getId());
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",deviceCritical);
|
||||
|
|
|
@ -13,8 +13,9 @@ rule "CriticalTemperature"
|
|||
sensorData: SensorData(tag == "temperature", value < 10.0 || value > 30.0) from sensorDatas
|
||||
then
|
||||
String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";
|
||||
String greenhouse2="e5ec9f15-f214-455d-9f02-3c134c770dc1";//Nica
|
||||
HttpPost httpPost = new HttpPost();
|
||||
final String criticalTemperatureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Temperature %s in the following device %s \", \"temperature\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
final String criticalTemperatureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical Temperature %s in the following device %s \", \"temperature\": %s}]}}",greenhouse2, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalTemperatureOutput);
|
||||
final String deviceCritical = String.format("{\"id\":\"%s-status\",\"data\":{\"measured\":[{ \"criticalStatus\": \"The status of %s device is critical\"}]}}",device.IdMapper(device.getId()),device.getId());
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",deviceCritical);
|
||||
|
|
|
@ -13,8 +13,9 @@ rule "DielectricPermittivity"
|
|||
sensorData: SensorData(tag == "dielectricPermittivity", value > 20.0) from sensorDatas
|
||||
then
|
||||
String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";
|
||||
String greenhouse2="e5ec9f15-f214-455d-9f02-3c134c770dc1";//Nica
|
||||
HttpPost httpPost = new HttpPost();
|
||||
final String dielectricPermittivityOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical dielectricPermittivity %s in the following sensor %s \", \"dielectricPermittivityOutput\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
final String dielectricPermittivityOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical dielectricPermittivity %s in the following sensor %s \", \"dielectricPermittivityOutput\": %s}]}}",greenhouse2, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",dielectricPermittivityOutput);
|
||||
insert(new Notification("dielectricPermittivity", sensorData, Severity.Warning));
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ when
|
|||
warning: Notification(severity > Severity.Warning)
|
||||
then
|
||||
HttpPost httpPost = new HttpPost();
|
||||
final String criticalGreenhouse = String.format("{\"id\":\"germes-greenhouse-status\",\"data\":{\"measured\":[{ \"status\": \"The status of the greenhouse is critical\"}]}}");
|
||||
final String criticalGreenhouse = String.format("{\"id\":\"nica-greenhouse-status\",\"data\":{\"measured\":[{ \"status\": \"The status of the greenhouse is critical\"}]}}");
|
||||
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",criticalGreenhouse);
|
||||
System.out.println(criticalGreenhouse);
|
||||
System.out.println("Green House critical, because of: '"+warning.getType()+"'");
|
||||
|
|
Loading…
Reference in New Issue