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 optimalBatteryOutput = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal Battery %s in the following sensor %s \", \"battery\": %s}]}}",greenhouse1, sensorData.getValue(),sensorData.getTag(),sensorData.getValue());
System.out.println("Low Battery"+level+"in the following sensor"+tag);
*/
/*HttpPost httpPost = new HttpPost();
final String finalOutput;
boolean critical = false;
HashMap<String,Double> test = new HashMap<>();
if (tag.equals("fd694041-581e-4c2c-9810-505e62b762e6")){ // This matches 70B3D570500042D7
if (level < 7.2 && k.equals("battery") ) {
JOptionPane.showMessageDialog(null,"Low Battery : "+level+"! Please swap the battery soon of the following sensor:"+tag,"Low Battery Level",JOptionPane.INFORMATION_MESSAGE);
System.out.println("Low Battery"+level+"in the following sensor"+tag);
critical = true;
test.put("battery",level);
}
if (level > 80 && k.equals("temperature") ) {
JOptionPane.showMessageDialog(null,"High Temperature : "+level+" in the following sensor: "+tag+"in the following device id: "+id,"Temperature",JOptionPane.INFORMATION_MESSAGE);
final String temperature = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical!High Temperature %s \", \"temperature\": %s}]}}", fixedIdG1,level,level);
System.out.println("High water level"+level +" in the following sensor:"+tag);
critical = true;
}
if (level < 22 && k.equals("soilTemperature") ) {
JOptionPane.showMessageDialog(null,"Low soil temperature : "+level+" in the following sensor: "+tag+"in the following device id: "+id,"soil Temperature",JOptionPane.INFORMATION_MESSAGE);
final String soilTemperature = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Low soil temperature %s in the following sensor: %s \", \"soilTemperature\": %s}]}}", fixedIdG1,level, tag,level);
System.out.println("Low soil Temperature"+level+" in the following sensor "+tag);
critical = true;
test.put("soilTemperature",level);
}
if (level <= 30 && k.equals("soilMoisture") ) {
JOptionPane.showMessageDialog(null,"Be Careful the soil is dry : "+level+" in the following sensor :"+tag +"in the device:"+id,"Soil Moisture",JOptionPane.INFORMATION_MESSAGE);
final String soilMoisture = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Be Careful the soil sensor %s is dry: %s \", \"soilMoisture\": %s}]}}", fixedIdG1,tag,level,level);
JOptionPane.showMessageDialog(null,"Optimal EC levels in the soil : "+level+" in the following sensor"+tag,"Soil Conductivity",JOptionPane.INFORMATION_MESSAGE);
final String soilConductivity = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal EC levels in the soil %s\", \"soilConductivity\": %s}]}}", fixedIdG1, level,level);
System.out.println("Optimal EC levels in the soil"+level +" in the following sensor:"+tag);
critical = true;
}
if (level > 20 && k.equals("dielectricPermittivity") ) {
JOptionPane.showMessageDialog(null,"High dielectricPermittivity : "+level+" in the following sensor"+tag,"dielectricPermittivity",JOptionPane.INFORMATION_MESSAGE);
System.out.println("High dielectricPermittivity"+level +" in the following sensor:"+tag);
critical = true;
}
// if(critical == true){
// finalOutput
// }
finalOutput = String.format("{\"id\":\"70B3D570500042D7-status\",\"data\":{\"measured\":[{ \"status\": \"The status of the device 1 is critical\",}]}}");