ADD : New feature for Nica System

master
Kevin Shehu 2022-04-10 23:20:14 +02:00
parent af0bf649dc
commit 182f58e2f8
6 changed files with 20 additions and 20 deletions

View File

@ -1 +1 @@
936JzYXxJIzzITnuVOGYMDHRCYtKuaF4EOSY3p8jUPeZNV9HeqPBYXQ0WybUy11V
ZW6n3ZlQ5NFeWjfjhX3aQmdUJJxkCGy6tsZbMeZqHLiyAcHOAiR0f7QCQj655VBV

View File

@ -12,12 +12,12 @@ rule "CriticalPrecipitation"
device: Device(sensorDatas: sensorData)
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}]}}",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));
// 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}]}}",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));
// modify(sensorData){
// setState(Severity.Critical)

View File

@ -15,7 +15,7 @@ rule "CriticalSoilMoisture"
// 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. Its too dry and the field needs fertilizer \", \"soilMoisture\": %s}]}}",greenhouse2, 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. Its 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);
@ -27,9 +27,9 @@ rule "OptimalSoilMoisture"
device: Device(sensorDatas: sensorData)
sensorData: SensorData(tag == "soilMoisture", value > 28.0) from sensorDatas
then
String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";
String greenhouse1="e5ec9f15-f214-455d-9f02-3c134c770dc1";
HttpPost httpPost = new HttpPost();
final String optimalSoilMoistureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal Soil Moisture %s in the following device %s \", \"soilMoisture\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
final String optimalSoilMoistureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal Soil Moisture %s in the following device %s. Everything is in order. \", \"soilMoisture\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",optimalSoilMoistureOutput);
insert(new Notification("soilMoisture", sensorData, Severity.Optimal));
//device.setState(Severity.Optimal);

View File

@ -12,12 +12,12 @@ rule "CriticalPrecipitation"
device: Device(sensorDatas: sensorData)
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}]}}",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));
// 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}]}}",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));
// modify(sensorData){
// setState(Severity.Critical)

View File

@ -15,7 +15,7 @@ rule "CriticalSoilMoisture"
// 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. Its too dry and the field needs fertilizer \", \"soilMoisture\": %s}]}}",greenhouse2, 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. Its 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);
@ -32,9 +32,9 @@ rule "OptimalSoilMoisture"
device: Device(sensorDatas: sensorData)
sensorData: SensorData(tag == "soilMoisture", value > 28.0) from sensorDatas
then
String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";
String greenhouse1="e5ec9f15-f214-455d-9f02-3c134c770dc1";
HttpPost httpPost = new HttpPost();
final String optimalSoilMoistureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal Soil Moisture %s in the following device %s \", \"soilMoisture\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
final String optimalSoilMoistureOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal Soil Moisture %s in the following device %s. Everything is in order. \", \"soilMoisture\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",optimalSoilMoistureOutput);
insert(new Notification("soilMoisture", sensorData, Severity.Optimal));
//device.setState(Severity.Optimal);

View File

@ -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