GGD/target/classes/rules/optimal.drl

16 lines
698 B
Plaintext

import eu.hsrw.ias.ggd.Notification;
import eu.hsrw.ias.ggd.Severity
import HttpCall.HttpPost;
import eu.hsrw.ias.ggd.Device;
rule "Green House Optimal"
when
warning: Notification(severity == Severity.Optimal)
then
HttpPost httpPost = new HttpPost();
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