Community discussions

MikroTik App
 
mkrabbendam
just joined
Topic Author
Posts: 4
Joined: Fri Jan 13, 2023 5:02 pm

KNOT Scripts - number of MAC Addresses per script

Fri Jan 13, 2023 5:14 pm

Hi,

Just starting with the KNOT and the TG-BT5-IN & TG-BT5-OUT BLE Tags - very impressed! I have managed to get it all up and running with an HTTP post to an ORDS Database method.

We are going to use multiple TG-BT5 devices for our solution.

Can you please advise whether more than one MAC Address can be used in the system script OR is it one script per MAC Address (per BLE Device)?
I couldn't find any examples in this regard - thus my only conclusion at this stage is one script per MAC Address (per BLE Device).

Best Regards
Mynhardt
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3250
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: KNOT Scripts - number of MAC Addresses per script

Sat Jan 14, 2023 10:45 pm

If your script is based it on: https://help.mikrotik.com/docs/display/ ... r+triggers, that will look at tags that match what in the "addressRegex" variable. So in their scheme, you likely can use a pipe "|" to have multiple MAC addresses per script like "00:00:00:12:34:54|89:78:65:12:34:54" – it's a regular expression, not just a the single MAC address to look for.

If you're more familiar with programming, I'd refactor their examples. The scripting language support arrays and functions, that allow way cleaner code than Mikrotik IoT doc's examples use – especially when you want to extend it to support multiple tags.
 
mkrabbendam
just joined
Topic Author
Posts: 4
Joined: Fri Jan 13, 2023 5:02 pm

Re: KNOT Scripts - number of MAC Addresses per script

Mon Jan 16, 2023 11:43 am

Many thanks for your quick response and direction. I am using the code you referenced in the link, and changed the code to send the notification/s via HTTP post. I will most definitely look at cleaner code options (arrays etc.)

One last question: is there a best practice/rule of thumb/advice for the number of tags a KNOT can handle/support?
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3250
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: KNOT Scripts - number of MAC Addresses per script  [SOLVED]

Mon Jan 16, 2023 6:01 pm

One last question: is there a best practice/rule of thumb/advice for the number of tags a KNOT can handle/support?
We use the KNOTs for LoRaWAN, so I don't know the limits of BLE tags... But I'd imagine the "limit" be more be how congested the 2.4Ghz environment is at the location (e.g. noise).

Now device and RouterOS scripting does have limits too, especially strings (4096 bytes). And, the example script uses a string to store a list of devices, so it be subject to that limit... Why I mention using arrays, since that type (unlike string) is limited by memory. But imagine you'd be fine for dozens of BLE tags using the Mikrotik's example (beyond that I bet you'd hit some limit and require different logic).

Essentially any script for BLE has to periodically poll (e.g.via /system/scheduler)
/iot bluetooth scanners advertisements print detail as-value where ...
So how "smart" your code is at using the "where" and managing state to know if/what to notify via HTTP (/tool/fetch) is likely where you could run into limits on the OS side.

If your new-ish to RouterOS scripting, I'd recommend taking a look at their older "tips and tricks": https://wiki.mikrotik.com/wiki/Manual:S ... and_Tricks

Who is online

Users browsing this forum: jvanhambelgium, nocc and 20 guests