JEDI One has always had support for notification actions via e-mail and text messages (SMS) when the conditions of a rule were met. Now in v1.9, it is possible to call a program or script when a rule is satisfied. The possibilities are endless! The data that triggered the rule is also made available to the external program, i.e. if the rule is "motor_speed > 1000" and the motor sensor reports "1030", JEDI One will send "1030" in JSON format, to the action plugin via stdin. The action plugin can also be passed additional metrics and command line arguments as defined when setting it up. Like custom plugins for data collection, action plugins can be written in any language that executes on the platform where JEDI One is installed (see footnote 1).
Here is a quick video of setting up an action plugin (say_temp_macOS.py) that speaks aloud the temperature if a rule is met. It uses the native "say" command in macOS (see footnote 2). Turn the volume up to hear the results:
Here is the example source code for say_temp_macOS.py:
The custom action plugin will be sent a list of datasources which are part of the condition. It will be in the below JSON format on stdin. In this example two metrics are being sent, each with a value and a timestamp.
{
"/Sensor1/tempC": [{"value": "29.1", "time": "2020-06-21T16:25:23.833347-07:00"}],
"/Sensor2/tempC": [{"value": "33.6", "time": "2020-06-21T16:25:24.912453-07:00"}]
}
Footnotes:
- On Microsoft Windows, Python scripts must be wrapped in a .BAT or .CMD file.
- There are text to speech packages for Raspberry PI, Linux, and Windows (check out espeak)