<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>Mikrotik.moscow [тема: TG-BT5-IN - Скрипт Move]</title>
		<link>http://mikrotik.moscow</link>
		<description>Новое в теме TG-BT5-IN - Скрипт Move форума RouterOS на сайте Mikrotik.moscow [mikrotik.moscow]</description>
		<language>ru</language>
		<docs>http://backend.userland.com/rss2</docs>
		<pubDate>Wed, 15 Jul 2026 01:27:16 -0400</pubDate>
		<item>
			<title>TG-BT5-IN - Скрипт Move</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428424">TG-BT5-IN - Скрипт Move</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Огромное спасибо Mikrotik Support, они очень помогли. Вот как это работает: &nbsp;<br /># Введите MAC-адрес тега в кавычках "" &nbsp;<br />:local addressRegex "AC:2C:6E:13:05:9E" &nbsp;<br /><br /># POSIX-выражение для фильтрации Bluetooth-объявлений по их данным. Использование такое же, как и с 'addressRegex'. &nbsp;<br />:local advertisingDataRegex "" &nbsp;<br /><br /># Фильтр по силе сигнала. Например, -40 будет включать только Bluetooth-объявления, &nbsp;<br /># у которых сила сигнала больше -40dBm. &nbsp;<br /># Чтобы отключить фильтр, установите "" &nbsp;<br />:local rssiThreshold "" &nbsp;<br /><br /># Введите тему письма в кавычках "" &nbsp;<br />:local emailsubject "Move" &nbsp;<br /><br /># Введите email-адрес в кавычках "" &nbsp;<br />:local emailaddress "mail@domain.com" &nbsp;<br /><br /># Скрипт: &nbsp;<br />################################## Bluetooth ################################## &nbsp;<br />:local flagStr do={ &nbsp;<br /> &nbsp; &nbsp;:local str "" &nbsp;<br /><br /> &nbsp; &nbsp;:if ($1 & 0x01) do={ :set $str " switch" } &nbsp;<br /> &nbsp; &nbsp;:if ($1 & 0x02) do={ :set $str "$str tilt" } &nbsp;<br /> &nbsp; &nbsp;:if ($1 & 0x04) do={ :set $str "$str free_fall" } &nbsp;<br /> &nbsp; &nbsp;:if ($1 & 0x08) do={ :set $str "$str impact_x" } &nbsp;<br /> &nbsp; &nbsp;:if ($1 & 0x10) do={ :set $str "$str impact_y" } &nbsp;<br /> &nbsp; &nbsp;:if ($1 & 0x20) do={ :set $str "$str impact_z" } &nbsp;<br /><br /> &nbsp; &nbsp;:if ([:len $str] = 0) do={ :return "" }  <br /><br /> &nbsp; &nbsp;:return [:pick $str 1 [:len $str]]  <br />} &nbsp;<br /><br />:local triggernameF "free_fall" &nbsp;<br />:local triggernameT "tilt" &nbsp;<br />:local triggernameX "impact_x" &nbsp;<br />:local triggernameY "impact_y" &nbsp;<br />:local triggernameZ "impact_z" &nbsp;<br />:local triggernameS "switch" &nbsp;<br /><br /># Поиск свежих Bluetooth-объявлений &nbsp;<br />:global btOldestAdvertisementTimestamp &nbsp;<br />:if ([:typeof $btOldestAdvertisementTimestamp] = "nothing") do={  <br /> &nbsp; &nbsp;# Впервые скрипт запущен после перезагрузки, надо инициализировать &nbsp;<br /> &nbsp; &nbsp;# постоянные переменные &nbsp;<br /> &nbsp; &nbsp;:set $btOldestAdvertisementTimestamp 0 &nbsp;<br />} &nbsp;<br />:local advertisements [/iot bluetooth scanners advertisements print detail \  <br /> &nbsp; &nbsp;as-value where \ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp;epoch &gt; $btOldestAdvertisementTimestamp and \ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp;address ~ $addressRegex and \ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp;data ~ $advertisingDataRegex and \ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp;rssi &gt; $rssiThreshold &nbsp;<br />] &nbsp;<br />:local advCount 0 &nbsp;<br />:local lastAdvTimestamp 0 &nbsp;<br />:local triggerlist "" &nbsp;<br /><br />:local triggerF &nbsp;<br />:local triggerT &nbsp;<br />:local triggerX &nbsp;<br />:local triggerY &nbsp;<br />:local triggerZ &nbsp;<br />:local triggerS &nbsp;<br /><br />:local messageF "" &nbsp;<br />:local messageT "" &nbsp;<br />:local messageX "" &nbsp;<br />:local messageY "" &nbsp;<br />:local messageZ "" &nbsp;<br />:local messageS "" &nbsp;<br /><br />:local 21st "" &nbsp;<br /><br />:foreach adv in=$advertisements do={ &nbsp;<br /> &nbsp; &nbsp;:local address ($adv-&gt;"address") &nbsp;<br /> &nbsp; &nbsp;:local rssi ($adv-&gt;"rssi") &nbsp;<br /> &nbsp; &nbsp;:local epoch ($adv-&gt;"epoch") &nbsp;<br /> &nbsp; &nbsp;:local rtime ($adv-&gt;"time") &nbsp;<br /> &nbsp; &nbsp;:local ad ($adv-&gt;"data") &nbsp;<br /> &nbsp; &nbsp;:local flags [:tonum "0x$[:pick $ad 40 42]"]  <br /> &nbsp; &nbsp;:local fflags "$[$flagStr $flags]"  <br /> &nbsp; &nbsp;:if ($fflags="") do={:set $fflags "нет — периодически передаваемые данные"} &nbsp;<br /><br /> &nbsp; &nbsp;:local obj "# $advCount: &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; time: $rtime &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; trigger: $fflags &nbsp;<br /><br />" &nbsp;<br /> &nbsp; &nbsp;:set $advCount ($advCount + 1) &nbsp;<br /> &nbsp; &nbsp;:set $lastAdvTimestamp $epoch &nbsp;<br /> &nbsp; &nbsp;:set $triggerlist "$triggerlist$obj" &nbsp;<br /><br />:set triggerF [:pick $triggerlist ([find $triggerlist "free_fall"]-0) ([find $triggerlist "free_fall"]+9)]  <br />:if ($triggerF=$triggernameF) do={:set messageF "$triggernameF";:set 21st "not00";} &nbsp;<br />:set triggerT [:pick $triggerlist ([find $triggerlist "tilt"]-0) ([find $triggerlist "tilt"]+1)]  <br />:if ($triggerT=$triggernameT) do={:set messageT "$triggernameT";:set 21st "not00";} &nbsp;<br />:set triggerX [:pick $triggerlist ([find $triggerlist "impact_x"]-0) ([find $triggerlist "impact_x"]+1)]  <br />:if ($triggerX=$triggernameX) do={:set messageX "$triggernameX";:set 21st "not00";} &nbsp;<br />:set triggerY [:pick $triggerlist ([find $triggerlist "impact_y"]-0) ([find $triggerlist "impact_y"]+1)]  <br />:if ($triggerY=$triggernameY) do={:set messageY "$triggernameY";:set 21st "not00";} &nbsp;<br />:set triggerZ [:pick $triggerlist ([find $triggerlist "impact_z"]-0) ([find $triggerlist "impact_z"]+8)]  <br />:if ($triggerZ=$triggernameZ) do={:set messageZ "$triggernameZ";:set 21st "not00";} &nbsp;<br />:set triggerS [:pick $triggerlist ([find $triggerlist "switch"]-0) ([find $triggerlist "switch"]+6)]  <br />:if ($triggerS=$triggernameS) do={:set messageS "$triggernameS";:set 21st "not00";} &nbsp;<br /><br />} &nbsp;<br />:if ($advCount &gt; 0) do={ &nbsp;<br /> &nbsp; &nbsp;:set $btOldestAdvertisementTimestamp $lastAdvTimestamp &nbsp;<br />} &nbsp;<br /><br />:if ($21st="not00") do={/tool e-mail send to=$emailaddress subject="$emailsubject" body="TAG MOVED!"} else={:put "В 21-м октете не обнаружено триггеров!"} <br />
			<i>06.03.2023 19:52:00, dima1002.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428424</link>
			<guid>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428424</guid>
			<pubDate>Mon, 06 Mar 2023 19:52:00 -0500</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>TG-BT5-IN - Скрипт Move</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428423">TG-BT5-IN - Скрипт Move</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Спасибо, я уже кое-что посмотрел. А есть ли, случайно, поддержка по деньгам? Или можно где-то это узнать? <br />
			<i>13.12.2022 13:51:00, dima1002.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428423</link>
			<guid>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428423</guid>
			<pubDate>Tue, 13 Dec 2022 13:51:00 -0500</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>TG-BT5-IN - Скрипт Move</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428422">TG-BT5-IN - Скрипт Move</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			У нас есть несколько видео про использование тегов TG-BT, может, это поможет: <noindex><a href="https://youtube.com/playlist?list=PLXr-HoBo2VtWSXU2pMH7vd5D2Cgi5pOez" target="_blank" rel="nofollow" >https://youtube.com/playlist?list=PLXr-HoBo2VtWSXU2pMH7vd5D2Cgi5pOez</a></noindex> <br />
			<i>12.12.2022 06:52:00, normis.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428422</link>
			<guid>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428422</guid>
			<pubDate>Mon, 12 Dec 2022 06:52:00 -0500</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>TG-BT5-IN - Скрипт Move</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428421">TG-BT5-IN - Скрипт Move</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Это работает у меня, когда происходит наклон или удар, но, к сожалению, пока не работает, если просто двигаешь его.<br /><br />[admin@Knot] &gt; /system/script/export  <br /># 12 дек 2022 06:01:20, RouterOS 7.4 &nbsp;<br /># software id = LMW4-2MB9 &nbsp;<br /># &nbsp;<br /># модель = RB924i-2nD-BT5&BG77 &nbsp;<br /># серийный номер = F5750ECE0D59 &nbsp;<br /><br />/system script &nbsp;<br />add dont-require-permissions=no name=script4 owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="# Введите MAC-адрес метки в кавычках \"\"\r\n:local addressRegex \"DC:2C:6E:13:15:7E\"\r\n\r\n# POSIX-выражение для фильтрации Bluetooth-рекламных сообщений на основе их данных. Используется так же, как 'addressRegex'.\r\n:local advertisingDataRegex \"\"\r\n\r\n# Фильтр по силе сигнала. Например, -40 означает, что будут включены Bluetooth-сообщения с силой сигнала сильнее -40 дБм.\r\n# Чтобы отключить фильтр, установите значение \"\"\r\n:local rssiThreshold \"\"\r\n\r\n# Введите тему письма в кавычках \"\"\r\n:local emailsubject \"RouterOS report!\"\r\n\r\n# Введите email-адрес в кавычках \"\"\r\n:local emailaddress \"mail@domain.com\"\r\n\r\n# Скрипт:\r\n################################## Bluetooth ##################################\r\n:local flagStr do={\r\n &nbsp; &nbsp;:local str \"\"\r\n\r\n &nbsp; &nbsp;:if (\$1 & 0x01) do={ :set \$str \" switch\" }\r\n &nbsp; &nbsp;:if (\$1 & 0x02) do={ :set \$str \"\$str tilt\" }\r\n &nbsp; &nbsp;:if (\$1 & 0x04) do={ :set \$str \"\$str free_fall\" }\r\n &nbsp; &nbsp;:if (\$1 & 0x08) do={ :set \$str \"\$str impact_x\" }\r\n &nbsp; &nbsp;:if (\$1 & 0x10) do={ :set \$str \"\$str impact_y\" }\r\n &nbsp; &nbsp;:if (\$1 & 0x20) do={ :set \$str \"\$str impact_z\" }\r\n\r\n &nbsp; &nbsp;:if ([:len \$str] = 0) do={ :return \"\" }\r\n\r\n    :return [:pick \$str 1 [:len \$str]]\r\n}\r\n\r\n:local triggernameF \"free_fall\"\r\n:local triggernameT \"tilt\"\r\n:local triggernameX \"impact_x\"\r\n:local triggernameY \"impact_y\"\r\n:local triggernameZ \"impact_z\"\r\n:local triggernameS \"switch\"\r\n\r\n# Поиск новых Bluetooth-реклам\r\n:global btOldestAdvertisementTimestamp\r\n:if ([:typeof \$btOldestAdvertisementTimestamp] = \"nothing\") do={\r\n    # Первый запуск скрипта после перезагрузки — нужно инициализировать\r\n    # постоянные переменные\r\n    :set \$btOldestAdvertisementTimestamp 0\r\n}\r\n:local advertisements [/iot bluetooth scanners advertisements print detail \\\r\n    as-value where \\\r\n        epoch &gt; \$btOldestAdvertisementTimestamp and \\\r\n        address ~ \$addressRegex and \\\r\n        data ~ \$advertisingDataRegex and \\\r\n        rssi &gt; \$rssiThreshold\r\n]\r\n:local advCount 0\r\n:local lastAdvTimestamp 0\r\n:local triggerlist \"\"\r\n\r\n:local triggerF\r\n:local triggerT\r\n:local triggerX\r\n:local triggerY\r\n:local triggerZ\r\n:local triggerS\r\n\r\n:local messageF \"\"\r\n:local messageT \"\"\r\n:local messageX \"\"\r\n:local messageY \"\"\r\n:local messageZ \"\"\r\n:local messageS \"\"\r\n\r\n:local 21st \"\"\r\n\r\n:foreach adv in=\$advertisements do={\r\n    :local address (\$adv-&gt;\"address\")\r\n    :local rssi (\$adv-&gt;\"rssi\")\r\n    :local epoch (\$adv-&gt;\"epoch\")\r\n    :local rtime (\$adv-&gt;\"time\")\r\n    :local ad (\$adv-&gt;\"data\")\r\n    :local flags [:tonum \"0x\$[:pick \$ad 40 42]\"]\r\n    :local fflags \"\$[\$flagStr \$flags]\"\r\n    :if (\$fflags=\"\") do={:set \$fflags \"none - periodically broadcasted payload\"}\r\n\r\n    :local obj \"# \$advCount:\r\n                             time: \$rtime\r\n                             trigger: \$fflags\r\n\r\n\"\r\n\r\n    :set \$advCount (\$advCount + 1)\r\n    :set \$lastAdvTimestamp \$epoch\r\n    :set \$triggerlist \"\$triggerlist\$obj\"\r\n\r\n:set triggerF [:pick \$triggerlist ([find \$triggerlist \"free_fall\"]-0) ([find \$triggerlist \"free_fall\"]+9)]\r\n:if (\$triggerF=\$triggernameF) do={:set messageF \"\$triggernameF\";:set 21st \"not00\";}\r\n:set triggerT [:pick \$triggerlist ([find \$triggerlist \"tilt\"]-0) ([find \$triggerlist \"tilt\"]+4)]\r\n:if (\$triggerT=\$triggernameT) do={:set messageT \"\$triggernameT\";:set 21st \"not00\";}\r\n:set triggerX [:pick \$triggerlist ([find \$triggerlist \"impact_x\"]-0) ([find \$triggerlist \"impact_x\"]+8)]\r\n:if (\$triggerX=\$triggernameX) do={:set messageX \"\$triggernameX\";:set 21st \"not00\";}\r\n:set triggerY [:pick \$triggerlist ([find \$triggerlist \"impact_y\"]-0) ([find \$triggerlist \"impact_y\"]+8)]\r\n:if (\$triggerY=\$triggernameY) do={:set messageY \"\$triggernameY\";:set 21st \"not00\";}\r\n:set triggerZ [:pick \$triggerlist ([find \$triggerlist \"impact_z\"]-0) ([find \$triggerlist \"impact_z\"]+8)]\r\n:if (\$triggerZ=\$triggernameZ) do={:set messageZ \"\$triggernameZ\";:set 21st \"not00\";}\r\n:set triggerS [:pick \$triggerlist ([find \$triggerlist \"switch\"]-0) ([find \$triggerlist \"switch\"]+6)]\r\n:if (\$triggerS=\$triggernameS) do={:set messageS \"\$triggernameS\";:set 21st \"not00\";}\r\n\r\n}\r\n:if (\$advCount &gt; 0) do={\r\n    :set \$btOldestAdvertisementTimestamp \$lastAdvTimestamp\r\n}\r\n\r\n:if (\$21st=\"not00\") do={/tool e-mail send to=\$emailaddress subject=\"\$emailsubject\" body=\"\$triggerlist\"} else={:put \"21-й октет не содержит обнаруженных триггеров!\"}"<br /><br /><br />[admin@Knot] &gt; /system/scheduler/export  <br /># 12 дек 2022 06:01:25, RouterOS 7.4 &nbsp;<br /># software id = LMW4-2MB9 &nbsp;<br /># &nbsp;<br /># модель = RB924i-2nD-BT5&BG77 &nbsp;<br /># серийный номер = F5750ECE0D59 &nbsp;<br /><br />/system scheduler &nbsp;<br />add interval=10s name=schedule1 on-event="/system script run script4\r\n/system script run test" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=ноя/12/2022 start-time=19:33:27 &nbsp;<br />[admin@Knot] &gt; <br />
			<i>12.12.2022 05:06:00, dima1002.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428421</link>
			<guid>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428421</guid>
			<pubDate>Mon, 12 Dec 2022 05:06:00 -0500</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>TG-BT5-IN - Скрипт Move</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428420">TG-BT5-IN - Скрипт Move</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Кстати, у меня с tg5-in небольшие заморочки, иногда просто нужно почитать мануал. Вот пример скрипта от Mikrotik работает. Я его немного переделал под mqtt-domoticz — теперь отлично работает, реагирует на наклон и переключатель. <noindex><a href="https://help.mikrotik.com/docs/display/UM/Email+notification+on+the+MikroTik+BLE+tag%27s+accelerometer+triggers" target="_blank" rel="nofollow" >https://help.mikrotik.com/docs/display/UM/Email+notification+on+the+MikroTik+BLE+t<WBR/>&shy;ag's+accelerometer+triggers</a></noindex> А второй скрипт, мне кажется, полезнее, но у меня не работает... пытаюсь найти причину. Просто в терминале ничего не возвращает.<br /><br /># POSIX regex для фильтрации Bluetooth-адресов в рекламе. Например, "^BC:33:AC" &nbsp;<br /># будет включать только адреса, которые начинаются на эти три октета. &nbsp;<br /># Чтобы отключить фильтр, установите значение "" &nbsp;<br />:local addressRegex "00:CC:66:88:11:BB"<br /><br /># POSIX regex для фильтрации Bluetooth-рекламы по её данным. Аналогично 'addressRegex'. &nbsp;<br />:local advertisingDataRegex ""<br /><br /># Фильтр по мощности сигнала. Например, -40 включит только рекламу с уровнем сигнала выше -40dBm. &nbsp;<br /># Чтобы отключить — установите "" &nbsp;<br />:local rssiThreshold ""<br /><br />################################## Bluetooth ##################################<br /><br />:global invertU16 do={<br /> &nbsp; &nbsp;:local inverted 0<br /> &nbsp; &nbsp;:for idx from=0 to=15 step=1 do={<br /> &nbsp; &nbsp; &nbsp; &nbsp;:local mask (1 &lt;&lt; $idx)<br /> &nbsp; &nbsp; &nbsp; &nbsp;:if ($1 & $mask = 0) do={<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:set $inverted ($inverted | $mask)<br /> &nbsp; &nbsp; &nbsp; &nbsp;}<br /> &nbsp; &nbsp;}<br /> &nbsp; &nbsp;return $inverted<br />}<br /><br />:global le16ToHost do={<br /> &nbsp; &nbsp;:local lsb [:pick $1 0 2]<br /> &nbsp; &nbsp;:local msb [:pick $1 2 4]<br /><br /> &nbsp; &nbsp;:return [:tonum "0x$msb$lsb"]<br />}<br /><br />:local le32ToHost do={<br /> &nbsp; &nbsp;:local lsb [:pick $1 0 2]<br /> &nbsp; &nbsp;:local midL [:pick $1 2 4]<br /> &nbsp; &nbsp;:local midH [:pick $1 4 6]<br /> &nbsp; &nbsp;:local msb [:pick $1 6 8]<br /><br /> &nbsp; &nbsp;:return [:tonum "0x$msb$midH$midL$lsb"]<br />}<br /><br />:local from88 do={<br /> &nbsp; &nbsp;:global invertU16<br /> &nbsp; &nbsp;:global le16ToHost<br /> &nbsp; &nbsp;:local num [$le16ToHost $1]<br /><br /> &nbsp; &nbsp;# Обработка отрицательных чисел &nbsp;<br /> &nbsp; &nbsp;:if ($num & 0x8000) do={<br /> &nbsp; &nbsp; &nbsp; &nbsp;:set num (-1 * ([$invertU16 $num] + 1))<br /> &nbsp; &nbsp;}<br /><br /> &nbsp; &nbsp;# Конвертация из формата 8.8. Масштабирование на 1000, так как плавающая точка не поддерживается &nbsp;<br /> &nbsp; &nbsp;:return (($num * 125) / 32)<br />}<br /><br />:local flagStr do={<br /> &nbsp; &nbsp;:local str ""<br /><br /> &nbsp; &nbsp;:if ($1 & 0x01) do={ :set $str " переключатель" }<br /> &nbsp; &nbsp;:if ($1 & 0x02) do={ :set $str "$str наклон" }<br /> &nbsp; &nbsp;:if ($1 & 0x04) do={ :set $str "$str падение" }<br /> &nbsp; &nbsp;:if ($1 & 0x08) do={ :set $str "$str удар_x" }<br /> &nbsp; &nbsp;:if ($1 & 0x10) do={ :set $str "$str удар_y" }<br /> &nbsp; &nbsp;:if ($1 & 0x20) do={ :set $str "$str удар_z" }<br /><br /> &nbsp; &nbsp;:if ([:len $str] = 0) do={ :return "" }<br /><br /> &nbsp; &nbsp;:return [:pick $str 1 [:len $str]]<br />}<br /><br /># Поиск новых Bluetooth-объявлений &nbsp;<br />:global btOldestAdvertisementTimestamp &nbsp;<br />:if ([:typeof $btOldestAdvertisementTimestamp] = "nothing") do={  <br /> &nbsp; &nbsp;# Первый запуск скрипта после перезагрузки, нужно инициализировать переменные &nbsp;<br /> &nbsp; &nbsp;:set $btOldestAdvertisementTimestamp 0 &nbsp;<br />} &nbsp;<br />:local advertisements [/iot bluetooth scanners advertisements print detail as-value where epoch &gt; $btOldestAdvertisementTimestamp and address ~ $addressRegex and data ~ $advertisingDataRegex and rssi &gt; $rssiThreshold]  <br />:local advCount 0 &nbsp;<br />:local lastAdvTimestamp 0 &nbsp;<br />:local advJson "" &nbsp;<br />:local advSeparator ""<br /><br /># Убираем двоеточия из MAC/Bluetooth-адресов &nbsp;<br />:local minimizeMac do={ &nbsp;<br /> &nbsp; &nbsp;:local minimized &nbsp;<br /> &nbsp; &nbsp;:local lastIdx ([:len $address] - 1)  <br /> &nbsp; &nbsp;:for idx from=0 to=$lastIdx step=1 do={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp;:local char [:pick $address $idx]  <br /> &nbsp; &nbsp; &nbsp; &nbsp;:if ($char != ":") do={ &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:set $minimized "$minimized$char" &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp;} &nbsp;<br /> &nbsp; &nbsp;} &nbsp;<br /> &nbsp; &nbsp;:return $minimized &nbsp;<br />}<br /><br />:foreach adv in=$advertisements do={ &nbsp;<br /> &nbsp; &nbsp;:local address ($adv-&gt;"address") &nbsp;<br /> &nbsp; &nbsp;:local rssi ($adv-&gt;"rssi") &nbsp;<br /> &nbsp; &nbsp;:local epoch ($adv-&gt;"epoch") &nbsp;<br /> &nbsp; &nbsp;:local ad ($adv-&gt;"data") &nbsp;<br /> &nbsp; &nbsp;:local version [:tonum "0x$[:pick $ad 8 10]"]  <br /> &nbsp; &nbsp;:local encrypted [:tonum "0x$[:pick $ad 10 12]"]  <br /> &nbsp; &nbsp;:local salt [$le16ToHost [:pick $ad 12 16]]  <br /> &nbsp; &nbsp;:local accelX [$from88 [:pick $ad 16 20]]  <br /> &nbsp; &nbsp;:local accelY [$from88 [:pick $ad 20 24]]  <br /> &nbsp; &nbsp;:local accelZ [$from88 [:pick $ad 24 28]]  <br /> &nbsp; &nbsp;:local temp [$from88 [:pick $ad 28 32]]  <br /> &nbsp; &nbsp;:local uptime [$le32ToHost [:pick $ad 32 40]]  <br /> &nbsp; &nbsp;:local flags [:tonum "0x$[:pick $ad 40 42]"]  <br /> &nbsp; &nbsp;:local bat [:tonum "0x$[:pick $ad 42 44]"]<br /><br /> &nbsp; &nbsp;:put ("$advCount: address=$address ts=$epoch rssi=$rssi version=$version encrypted=$encrypted salt=$salt accelX=$accelX accelY=$accelY accelZ=$accelZ temp=$temp uptime=$uptime flags=\"$[$flagStr $flags]\" bat=$bat")  <br /> &nbsp; &nbsp;:set $advCount ($advCount + 1) &nbsp;<br /> &nbsp; &nbsp;:set $lastAdvTimestamp $epoch &nbsp;<br />} &nbsp;<br />:if ($advCount &gt; 0) do={ &nbsp;<br /> &nbsp; &nbsp;:set $btOldestAdvertisementTimestamp $lastAdvTimestamp &nbsp;<br /> &nbsp; &nbsp;:log info $advCount &nbsp;<br />} <br />
			<i>06.12.2022 19:30:00, martc.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428420</link>
			<guid>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428420</guid>
			<pubDate>Tue, 06 Dec 2022 19:30:00 -0500</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>TG-BT5-IN - Скрипт Move</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428419">TG-BT5-IN - Скрипт Move</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Возьми TG-BT5-in и посмотри, какие данные он получает на knot. У меня этого маячка пока нет. Заказал две штуки, думаю, получу через пару дней… Mikrotik имеет пару примеров для Bluetooth, думаю, этого вполне достаточно, чтобы начать. <br />
			<i>03.12.2022 21:43:00, martc.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428419</link>
			<guid>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428419</guid>
			<pubDate>Sat, 03 Dec 2022 21:43:00 -0500</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>TG-BT5-IN - Скрипт Move</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428418">TG-BT5-IN - Скрипт Move</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Я куплю тебе устройство, если ты поможешь мне. <br />
			<i>12.01.2023 19:54:00, dima1002.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428418</link>
			<guid>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428418</guid>
			<pubDate>Thu, 12 Jan 2023 19:54:00 -0500</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>TG-BT5-IN - Скрипт Move</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428417">TG-BT5-IN - Скрипт Move</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Даже если кто-то искренне захочет помочь вам с написанием сценария, без устройства у них ничего не получится… Свяжитесь напрямую с support@mikrotik.com и сообщите нам, что вам ответят. <br />
			<i>12.01.2023 14:53:00, rextended.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428417</link>
			<guid>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428417</guid>
			<pubDate>Thu, 12 Jan 2023 14:53:00 -0500</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>TG-BT5-IN - Скрипт Move</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428416">TG-BT5-IN - Скрипт Move</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Извините. Но кто-нибудь реально может помочь мне с этой темой? Или кто-то знает службу поддержки? <br />
			<i>12.01.2023 14:38:00, dima1002.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428416</link>
			<guid>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428416</guid>
			<pubDate>Thu, 12 Jan 2023 14:38:00 -0500</pubDate>
			<category>RouterOS</category>
		</item>
		<item>
			<title>TG-BT5-IN - Скрипт Move</title>
			<description><![CDATA[<b><a href="http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428415">TG-BT5-IN - Скрипт Move</a></b> <i>RouterOS</i> в форуме <a href="http://mikrotik.moscow/forum/forum57/">RouterOS</a>. <br />
			Привет! Я ищу скрипт, который бы присылал мне уведомление на почту, когда перемещается TG-BT5-IN по оси X или Y. Это реально сделать? Например, если кто-то откроет дверь серверной, мы хотим сразу об этом узнать. <br />
			<i>12.11.2022 19:02:00, dima1002.</i>]]></description>
			<link>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428415</link>
			<guid>http://mikrotik.moscow/forum/forum57/88589-tg_bt5_in-_-skript-move/message428415</guid>
			<pubDate>Sat, 12 Nov 2022 19:02:00 -0500</pubDate>
			<category>RouterOS</category>
		</item>
	</channel>
</rss>
