A custom plug-in is a program that executes on the same machine where JEDI One is running and that has customized print statements to pass information to JEDI One. It can be written in ANY programming language and can aggregate all or some of the locally connected sensors. JEDI One supports up to 16 Custom plug-ins.
The program can either be written to output the sensor data and end, or it can be written as a service (basically an endlessly looping program) which JEDI One will launch and sample at defined intervals. (A service makes sense if the sensor requires extensive setup or if the program needs to perform a great deal of work prior to sampling and outputting the sensor values).
Delivering data to JEDI One requires just simple modifications to existing print statements. Here is an example using Python; this is the original code that output sensor values to the terminal window (stdout):
print("Temperature: %0.1f C" % temperature)
print("Humidity: %0.1f %%" % humidity)
print("Pressure: %0.1f hPa" % pressure)
And now modified for JEDI One:
devID = "BME280Sensor1"
print("metric:id=%s,n=Temperature,vd=%0.1f,u=C" % (devID, temperature))
print("metric:id=%s,n=Humidity,vd=%0.1f,u=%%" % (devID, humidity))
print("metric:id=%s,n=Pressure,vd=%0.1f,u=hPa" % (devID, pressure))
Working in C?
Before:
printf("temperature:%0.1f C\r\n",temperature);
printf("humidity:%0.1f%%\r\n",humidity);
printf("pressure:%0.1fhPa\r\n",pressure);
After:
#define devID "BME280Sensor1
printf("metric:id=%s,n=temperature,vd=%0.1f,u=C\r\n",devID,temperature);
printf("metric:id=%s,n=humidity,vd=%0.1f,u=%%\r\n",devID,humidity);
printf("metric:id=%s,n=pressure,vd=%0.1f,u=hPa\r\n",devID,pressure);
It doesn’t matter what language the application is written in, just modify the print statements as per above (for more details on the syntax - see “Advanced details” below). Once the script is ready or the program compiled, make sure it is executable and move it into the plugins sub-directory (see NOTE 1 below) in the location where the JEDI One binary is located, like so:
(img)
plug-ins are added under the Data Collectors section of JEDI One. Here is a short video on how to add and test a plug-in:
If the program is a service, select the box: “Run As Background Process and Monitor”. JEDI One will take care of executing the program and gathering the output at the interval specified.
Advanced details
The syntax for the print statement modifications is derived from the [IEEE SenML RFC8428]. Here is the JEDI One syntax:
metric: id=<ID>, n=<name>, vd|vb|vs=<value>, u=<unit>, ts=<optional metric timestamp>
id: unique string representing a specific sensor (i.e. - “Environmental-Sensor1”)
n: unique string for a specific sensor output (i.e. - “Temperature” or “Humidity”)
vs: represents a string value
vb: represents a boolean
vd: represents data (float)
Each update will have one metric information. Each metric can have its own time stamp. (JEDI One also timestamps the data when it arrives).
To pass an error from your plug-in to JEDI One, that can be done by printing in the format below to STDERR.
error: id=<ID>, n=<name>, vs=<error string>
A counter will be created with the <name> and the <error string> and will be placed in the log.
NOTE 1: Plugins for Windows must be .BAT, .CMD, or .EXE files only. Python scripts can be wrapped in a .BAT batch file. Also see:
Python JEDI One plug-in won't run on Windows