Skip to content

rose53/bpm-fun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Have fun with workflows

Soil moisture

To measure to soil moisture, the Sensor delivers an electrical voltage representing the moisture. This value is calibrated for water and air and a value for the dryness is calculated.

Dryness d Description
0 <= d <= 9 saturated
9 < d <= 19 adequately wet
19 < d <= 59 irrigation advice
59 < d <= 99 irrigation
99 < d <= 100 dangerously dry

Mailbox

The mailbox is based on this Adafruit project.

Pump

A 5V pump is used for irrigation.

Workflow

The three devices are connected and controlled by a business workflow.

Read soil moisture

var httpConnector = org.camunda.connect.Connectors.http(); 
var system = java.lang.System;

var resp = httpConnector.createRequest()
                                        .get()
                                        .url("http://192.168.0.40/soilmoisture")
                                        .execute();

var result = JSON.parse(resp.getResponse());
resp.close();

system.err.print("dryness: ");
system.err.println(parseInt(result.value, 10));

system.err.print("description: ");
system.err.println(result.description);

execution.setVariable('dryness', parseInt(result.value, 10));
execution.setVariable('description', result.description);

Flag up

var payload = { status : true };

var httpConnector = org.camunda.connect.Connectors.http(); 
var resp = httpConnector.createRequest()
                                        .put()
                                        .url("http://192.168.0.95/flag")
                                        .contentType("application/json")
                                        .payload(JSON.stringify(payload ))
                                        .execute();

var result = resp.getResponse();
resp.close();

Flag down

var payload = { status : false };

var httpConnector = org.camunda.connect.Connectors.http(); 
var resp = httpConnector.createRequest()
                                        .put()
                                        .url("http://192.168.0.95/flag")
                                        .contentType("application/json")
                                        .payload(JSON.stringify(payload ))
                                        .execute();

var result = resp.getResponse();
resp.close();

Pump

var payload = { duration : 1500 };

var httpConnector = org.camunda.connect.Connectors.http(); 
var resp = httpConnector.createRequest()
                                        .put()
                                        .url("http://192.168.0.40/pump")
                                        .contentType("application/json")
                                        .payload(JSON.stringify(payload ))
                                        .execute();

var result = resp.getResponse();
resp.close();

Releases

No releases published

Packages

No packages published