2022-02-09 19:19:09 +01:00
import java.util.HashMap;
import java.util.Map;
import eu.hsrw.ias.ggd.SensorData
import javax.swing.JOptionPane
import HttpCall.HttpPost
import eu.hsrw.ias.ggd.Notification
import eu.hsrw.ias.ggd.Severity;
import eu.hsrw.ias.ggd.Device;
rule "DielectricPermittivity"
when
device: Device(sensorDatas: sensorData)
sensorData: SensorData(tag == "dielectricPermittivity", value > 20.0) from sensorDatas
then
String greenhouse1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633";
2022-04-06 09:59:48 +02:00
String greenhouse2="e5ec9f15-f214-455d-9f02-3c134c770dc1";//Nica
2022-02-09 19:19:09 +01:00
HttpPost httpPost = new HttpPost();
2022-04-06 09:59:48 +02:00
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());
2022-02-09 19:19:09 +01:00
httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",dielectricPermittivityOutput);
insert(new Notification("dielectricPermittivity", sensorData, Severity.Warning));
end