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

Compare with Current View Page History

« Previous Version 5 Next »

Introduction

Our Bluetooth tags and the KNOT can be used in different scenarios for IoT asset tracking.

The scenario we will be showing in this guide is receiving a notification on your phone as soon as the tag gets into the KNOT's Bluetooth range and as soon as the tag gets outside of the Bluetooth operating range.

That scenario can be achieved with the help of the IFTTT services. IFTTT will generate an URL for you. You can, then use /tool fetch from RouterOS, to post HTTP/web request to IFTTT generated URL and that will trigger APP notification to your phone.

Once the IFTTT service is set up and KNOT has been configured accordingly, you can attach the Bluetooth tag (TG-BT5-IN or OUT model) to any piece of equipment you wish to track.

Let's say, you attached the tag to an expensive piece of machinery or just ... your keys. Then, you install and position your KNOT so that the tag is within the KNOT's Bluetooth range. What is going to happen next and how is it going to work?

The KNOT is going to run a script on a schedule (with an interval that you choose). Based on the MAC address of the tag that was configured in the script →  the script is going to check the latest received Bluetooth packet's time (the time when the latest packet was received). In case:

  • the packet's time of reception is within 1 minute of /system clock time (for example, /system clock time is 16:02:00, and the tag's payload was received at 16:01:50) → a "TAG IS WITHIN RANGE" notification will be triggered, and sent to your phone.
  • the packet's reception time is older than 1 minute of /system clock time (for example, /system clock time is 16:02:00, and the tag's payload was received at 16:00:50) → a "TAG IS NOT IN RANGE" notification will be triggered and send to your phone.

Because there is no other way to know whether the tag is actually within or outside of the operating range, the script uses the "time" parameter to confirm it. So when the payload's reception time is getting refreshed constantly → it means the tag is present and the KNOT receives the packets successfully. When 1 minute has passed since the last packet was received by the KNOT→ it means that the KNOT did not receive any updates from the tag for a whole minute and that confirms that the tag is not in range.

IFTTT setup

The first step is to register an IFTTT account or log in to an existing one following the link.

After you are logged in, press the "Create" button in the right upper corner:

This will take you to the applet creation screen:

Select the "Add" button in the "If This" field. Choose a service called "Webhooks". Then, select an option called "Receive a web request".

Enter an "Event Name", for example, "tag is in range" and select "Create trigger". This will take you back to:

Select the "Add" button in the "Then That" field and find an action called "Notifications". Choose an option called "Send a notification from the IFTTT app" and confirm the decision by clicking on "Create Action".

Click on "Continue" and review the applet. Click on "Finish".


Now, do the same steps again to create a second applet, but for the second one, enter another "Event Name", for example, "tag is NOT in range".


Once you have two applets created → check the web request URL that was generated for you. Go to the link and click on the "Documentation" button:

The page will indicate the URL that you need to use:

Copy this URL - you will need to use it in the script later.

Bluetooth tag configuration

Check our guide at:

MikroTik Beacon Manager for Android devices#Beaconsettings

for Android configuration, and:

MikroTik Beacon Manager for iOS devices#Advertismenetsettings

for iOS configuration.

In this specific use case, the KNOT is going to check the time of the received Bluetooth payload, so it does not matter which packet type is configured for the tag.

The only important setting is "Advertisement interval". Make sure that this parameter is configured.

Or you can just leave the tag in its default settings without changing anything.

RouterOS configuration




  • No labels