ADD : New feature for Nica System
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
| @@ -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. It’s 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. 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); | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user