From c05e1ead3685f1a584a22884e2ae328f25b5cf9d Mon Sep 17 00:00:00 2001 From: kev Date: Mon, 24 Apr 2017 18:12:19 +0800 Subject: [PATCH] update ibeacon --- hass/arm/ibeacon.init | 25 +++++++++++++++++++++++++ hass/arm/ibeacon.service | 1 + 2 files changed, 26 insertions(+) create mode 100644 hass/arm/ibeacon.init diff --git a/hass/arm/ibeacon.init b/hass/arm/ibeacon.init new file mode 100644 index 0000000..ab57f52 --- /dev/null +++ b/hass/arm/ibeacon.init @@ -0,0 +1,25 @@ +#!/bin/sh /etc/rc.common +# (C) 2017 easypi.info +# +# See: https://wiki.openwrt.org/doc/howto/usb.bluetooth +# + +START=99 + +UUID="77 77 77 77 77 77 77 77 77 77 77 77 77 77 77 77" +MAJOR="00 00" +MINOR="00 00" +POWER="C8" + +start() { + /usr/bin/hciconfig hci0 up + /usr/bin/hciconfig hci0 noscan + /usr/bin/hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 $UUID $MAJOR $MINOR $POWER 00 + /usr/bin/hcitool -i hci0 cmd 0x08 0x0006 A0 00 A0 00 03 00 00 00 00 00 00 00 00 07 00 + /usr/bin/hcitool -i hci0 cmd 0x08 0x000a 01 +} + +stop() { + /usr/bin/hciconfig hci0 noleadv + /usr/bin/hciconfig hci0 down +} diff --git a/hass/arm/ibeacon.service b/hass/arm/ibeacon.service index 8386af8..abe33f8 100644 --- a/hass/arm/ibeacon.service +++ b/hass/arm/ibeacon.service @@ -19,6 +19,7 @@ ExecStart=/usr/bin/hcitool -i hci0 cmd 0x08 0x000a 01 # See: http://stackoverflow.com/questions/21124993/ # ExecStart=/bin/hciconfig hci0 leadv 3 ExecStop=/bin/hciconfig hci0 noleadv +ExecStop=/bin/hciconfig hci0 down RemainAfterExit=yes [Install]