From: Roman Bazalevsky Date: Tue, 27 Sep 2016 11:52:53 +0000 (+0300) Subject: Отлов пользовательских устройств с известными BT MAC-адресами. С точностью до комнаты. X-Git-Url: https://git.rvb.name/openhab-process.git/commitdiff_plain/e45fbbdab6046a52069555acca03c2cdad6896a6?ds=inline;hp=--cc Отлов пользовательских устройств с известными BT MAC-адресами. С точностью до комнаты. --- e45fbbdab6046a52069555acca03c2cdad6896a6 diff --git a/mqtt-bt/bt-macs b/mqtt-bt/bt-macs new file mode 100644 index 0000000..0c2bfca --- /dev/null +++ b/mqtt-bt/bt-macs @@ -0,0 +1,4 @@ +00:01:02:03:04:05 user1 +01:02:03:04:05:06 user2 + + diff --git a/mqtt-bt/bt-proximity b/mqtt-bt/bt-proximity new file mode 100755 index 0000000..bfbbfdb --- /dev/null +++ b/mqtt-bt/bt-proximity @@ -0,0 +1,21 @@ +#!/bin/sh + +. /etc/bt-proximity.conf + +host=`hostname` + +hciconfig hci0 up + +cat $1 | while read mac user +do + + if [ "$mac" != "" ] + then + l2ping -c 2 -t 10 $mac + if [ "$?" = "0" ] + then + mosquitto_pub -h $mqtt_host -p $mqtt_port -u $mqtt_user -P $mqtt_passwd -t $mqtt_topic/$user -m $host + fi + fi + +done diff --git a/mqtt-bt/bt-proximity.conf b/mqtt-bt/bt-proximity.conf new file mode 100644 index 0000000..ea85fe1 --- /dev/null +++ b/mqtt-bt/bt-proximity.conf @@ -0,0 +1,6 @@ +mqtt_host="server" +mqtt_port=1883 +mqtt_user="bt" +mqtt_passwd="password" +mqtt_topic="bt" +