Visual indicators can be the best way to get the attention of the user or operator of equipment (you have already looked at the one below several times, haven't you?). Colors can be effectively used to indicate the current status, with red and green having almost universal meaning. One practical example is the Kuando Busylight IoT from Plenom, which uses LoRaWAN for communications. The RGB LEDs can be programmed to a very wide range of colors, brightness, and flash intervals (duty cycle) if desired.
Plenom Kuando Busylight IoT
Integrating the Busylight IoT with a JEDI Pro Private LoRaWAN system is straightforward. Once the Busylight device has been added to ChirpStack, a Python3 script can be used to enqueue a downlink to the Busylight, the technical jargon for sending a message to the light to turn off, change color, or flash. This Python3 script can be run by JEDI Pro when a rule is met.
For this example, if the RPM of a motor exceeds 5000 RPM, turn the Busylight red and if below 5000, turn the light green. The mechanism to run a program when a rule is met, is known within JEDI Pro as an action plugin.
Step 1: Install the needed Python library from a Linux terminal window:
sudo python3 -m pip install chirpstack_api
Step 2: Download the source code from here: Python3 Script. Make sure to download it as 'raw' or as a ZIP file since Python is picky about tabs, spaces, etc. Put this code in a file (i.e., "busylight.py"). Now edit the file to change the IP address at line 65 to the IP address:port of your ChirpStack API (by default the port is 8080, your IP will be different, use ifconfig command to find it). Also change line 70 to the device eui of your Busylight.
Create a key using ChirpStack's web interface:
Replace "PutYourUniqueTokenHere" at line 79 with the key from above (in quotes):
Finally save the modified Python file into the JEDI Pro plugins sub-directory.
Step 3: Make sure the file is executable and test it out from the command line like this:
First command makes the file executable, second command turns the Busylight solid purple, third command turns it off, forth command shows the syntax. Note: The order of parameters is the same as the Busylight documentation (RBG vs RGB). on_time and off_time are in 1/10 of seconds, i.e. 0x0A = 1 second. Setting on and off to 0x0A the light will blink on and off once a second using the requested color.
Step 4: Create a rule in JEDI Pro and tie it to the custom action plugin, busylight.py:
And setup the action plugin:
When you click on validate the plugin, it will ask for additional data to send plugin, just type "0".
Now you can create a second rule for when RPM < 5000 and create an action to turn the Busylight green. Use the same plugin name as above, busylight.py just send it different parameters (0x00 0x00 0xff 0xff 0x00), which is green on.
You have just added a very useful visual indicator to your private LoRaWAN system!