You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Introduction

In this guide, we will show a quick step-by-step on how you can set up your KNOT to send an e-mail notification, whenever it detects a "triggered" condition reported by the TG-BT5-IN or TG-BT5-OUT tag.

As per tag's guides for iOS and Android, the tags have a built-in accelerometer that is able to detect free-falling, wakeup/movement, and tilted states. When the tag is set up to broadcast MikroTik format payloads and accelerometer triggers are enabled (using the MikroTik Beacon Manager app) → the tag will instantly broadcast an advertising payload/report whenever the trigger is going to be detected.

For iOS, the trigger setting looks like this (in a disabled state/default settings):

For Android, the trigger setting looks like this (in a disabled state/default settings):

To active trigger detection, just enable the corresponding "checkbox".

After the Bluetooth payload is broadcasted by the tag →  the payload's 21st octet will indicate which exact trigger was detected. You can view the payloads under the IoT>Bluetooth>Advertisng reports tab:

As per the screenshot above, the 21st octet is "04", which indicates, that the payload was sent when a freefalling condition was detected by the tag (these payloads were broadcasted when we "accidentally" dropped or threw the tag).

You can find more information about MikroTik format octet values by following the link.

Once everything is configured the following is going to happen:

  1. The KNOT will run a script on a schedule. 
  2. The script will "read/scan" the payloads that are shown in the IoT>Bluetooth>Advertising reports tab.
  3. If the stored/captured payload's 21st octet value equals the configured trigger value (which is set up in the script) → email notification is going to be sent.

In other words, when the KNOT scans through the payloads and finds one where the 21st octet equals the configured trigger value → you will get an email notification that the trigger was detected.

TG-BT5 tag configuration

In this specific example, we need to set up our tags to work in the MikroTik format. In the MikroTik format, the 21st octet of each payload will indicate the reason it was triggered.

You can find a manual on how to enable the triggers by following the iOS and/or Android guides ("Advertisement"/Beacon settings sections).

In our example, we would like to monitor "freefalling" state detection, so just enable the checkbox for the "Freefall trigger/detection". You can use other triggers instead but you will need to alter a couple of lines in the script that will be shown later.

To easier "activate" the trigger, we can also alter the trigger's settings as per the iOS and/or Android guides (Free Fall Threshold and Duration sections). For the purpose of the test and to, basically, just "trigger" the detection "easier", we can change the "Free Fall Threshold" to the maximally available value (this will result in any acceleration within this threshold on all axis to be considered a "trigger"). We can also change the "Free Fall Duration" parameter to "0" seconds, for the purpose of the test (this will make sure that any acceleration that is within the threshold on all axis will be instantly detected as a "freefalling" event).

RouterOS configuration

noteiot package is required. You can get it from our download page - under "Extra packages".

The configuration can be completed in 4 steps:

  1. enabling scanner (and, preferably, confirming that the tag is broadcasting payloads when the trigger is detected);
  2. setting up email server;
  3. importing the script (and altering a few script lines depending on the requirement);
  4. setting up the scheduler.

IoT>Bluetooth>Scanners

Go to the IoT>Bluetooth>Scanners tab and make sure that it is enabled:

Go to the Advertising reports tab and filter the list using the MAC address filtering option (you can find the MAC address of the MikroTik tag printed on the label on the tag itself).

Try to "trigger" the configured detection and confirm it by checking the 21 octet's value.

In our example, we configured the "freefalling" detection for our tag and we dropped it. We got reports from the tag indicating the "falling" state (21st octet = 04):

We have confirmed, that the tag is reporting the trigger properly.

Tools>Email



  • No labels