iBeacon...but in reverse
-
stuartcolman
- Posts: 81
- Joined: Sun Nov 01, 2015 2:56 pm
- Location: Essex, United Kingdom
iBeacon...but in reverse
So I am new to Indigo, but not to HA. I have been playing around with iBeacon at a very low level. So my idea is for a plugin which will scan via Bluetooth for the presence of an iBeacon. From my understanding iBeacon are fixed at a location and you phone then connects when in range and sends a webhook, which is picked by a plugin in Indigo.
My idea (which may have already been done, but my search didn't find anything) is to do away with the phone, and use just a small iBeacon and the bluetooth on the Mac.
So using something like this: http://www.ebay.co.uk/itm/BEACON101-IBe ... =undefined attached to your keyring. When you get within range the plugin would then detect you and either set a variable or be a virtual motion sensor. These iBeacons are relatively inexpensive £4.99, have unique ID's, have a range of about 40m, and the battery can last up to 12 months (with a poll of 1 sec). So seems like the ideal presence device. Plus you could put one on your key chain, one somewhere on the car, and one for the wife, and with a bit of logic it could work out if you have both left the house, who has taken the car, or if you have both gone etc etc.
I have found an App for the Mac (http://www.hugeinc.com/ideas/perspectiv ... ty-for-osx), which seems to do the bluetooth scanning side of things (works quite well testing with my Mac and my iPhone as an iBeacon).
Now comes the problems, I am not a programmer in any way, shape or form, so this is where I get stuck. Anyone willing to pick this up? Or at least point me in the right direction?
Thanks
Stuart
My idea (which may have already been done, but my search didn't find anything) is to do away with the phone, and use just a small iBeacon and the bluetooth on the Mac.
So using something like this: http://www.ebay.co.uk/itm/BEACON101-IBe ... =undefined attached to your keyring. When you get within range the plugin would then detect you and either set a variable or be a virtual motion sensor. These iBeacons are relatively inexpensive £4.99, have unique ID's, have a range of about 40m, and the battery can last up to 12 months (with a poll of 1 sec). So seems like the ideal presence device. Plus you could put one on your key chain, one somewhere on the car, and one for the wife, and with a bit of logic it could work out if you have both left the house, who has taken the car, or if you have both gone etc etc.
I have found an App for the Mac (http://www.hugeinc.com/ideas/perspectiv ... ty-for-osx), which seems to do the bluetooth scanning side of things (works quite well testing with my Mac and my iPhone as an iBeacon).
Now comes the problems, I am not a programmer in any way, shape or form, so this is where I get stuck. Anyone willing to pick this up? Or at least point me in the right direction?
Thanks
Stuart
-
stuartcolman
- Posts: 81
- Joined: Sun Nov 01, 2015 2:56 pm
- Location: Essex, United Kingdom
Re: iBeacon...but in reverse
So to follow up a little more on this I have found the following: http://www.freeibeaconapps.com/#page-bl ... 78y0mp9zfr
A couple of Apps of interest in this; the first being Beacon Launcher, this runs a script when a Mac enters the range of an iBeacon, however could also work in reverse when an iBeacon enters the range of a Mac.
The second would fit more with a plugin, and this is beaconscan. This is a command line tool which can output in a JSON format. I wonder if this can be used with the current Beacon plugin which takes an input on port 6192.
Anyway a few ideas.
A couple of Apps of interest in this; the first being Beacon Launcher, this runs a script when a Mac enters the range of an iBeacon, however could also work in reverse when an iBeacon enters the range of a Mac.
The second would fit more with a plugin, and this is beaconscan. This is a command line tool which can output in a JSON format. I wonder if this can be used with the current Beacon plugin which takes an input on port 6192.
Anyway a few ideas.
Re: iBeacon...but in reverse
I would be interested in jumping into that..
have to check where I can get cheap ibeacons in the us.
Karl
have to check where I can get cheap ibeacons in the us.
Karl
Re: iBeacon...but in reverse
the cheapest I could find was $11 at amazon,
what source / model are you looking at?
Karl
what source / model are you looking at?
Karl
Re: iBeacon...but in reverse
the 40m meter distance is likely only true without walls, we probably need more that one receiver .. raspberry pi looks like a valid tool, may be we can even use an ESP 8622 with a BLE board to submit the data to mac.
this looks interesting
Karl
this looks interesting
Karl
-
stuartcolman
- Posts: 81
- Joined: Sun Nov 01, 2015 2:56 pm
- Location: Essex, United Kingdom
Re: iBeacon...but in reverse
I have been using an App on my iPhone so it can act as a beacon. This seems to work ok. However I have one of the cheapy beacons coming from eBay, so will be able to test it once I get it.
-
stuartcolman
- Posts: 81
- Joined: Sun Nov 01, 2015 2:56 pm
- Location: Essex, United Kingdom
Re: iBeacon...but in reverse
Just to follow up, I have cross posted the idea here: http://forums.indigodomo.com/viewtopic. ... 88#p105288
It looks like the output from beaconscan can be sent to the Beacon Plugin via JSON. So now just need a script to run beaconscan, filter the results and send via HTTP POST to beacon.
It looks like the output from beaconscan can be sent to the Beacon Plugin via JSON. So now just need a script to run beaconscan, filter the results and send via HTTP POST to beacon.
Re: iBeacon...but in reverse
Code: Select all
karlMacMini:documents karlwachs$ ./beaconscan -scantime 10
RegionUUID:07775DD0-111B-11E4-9191-0800200C9A66 PowerCalibration:-60 Type:iBeacon MajorNumber:8977 MinorNumber:11236 RSSI:-31
RegionUUID:07775DD0-111B-11E4-9191-0800200C9A66 PowerCalibration:-60 Type:iBeacon MajorNumber:8977 MinorNumber:11236 RSSI:-35
RegionUUID:07775DD0-111B-11E4-9191-0800200C9A66 PowerCalibration:-60 Type:iBeacon MajorNumber:8971 MinorNumber:57940 RSSI:-68
RegionUUID:07775DD0-111B-11E4-9191-0800200C9A66 PowerCalibration:-60 Type:iBeacon MajorNumber:8977 MinorNumber:11236 RSSI:-31
RegionUUID:07775DD0-111B-11E4-9191-0800200C9A66 PowerCalibration:-60 Type:iBeacon MajorNumber:8977 MinorNumber:11236 RSSI:-35
RegionUUID:07775DD0-111B-11E4-9191-0800200C9A66 PowerCalibration:-60 Type:iBeacon MajorNumber:8977 MinorNumber:11236 RSSI:-31
RegionUUID:07775DD0-111B-11E4-9191-0800200C9A66 PowerCalibration:-60 Type:iBeacon MajorNumber:8971 MinorNumber:57940 RSSI:-67
RegionUUID:07775DD0-111B-11E4-9191-0800200C9A66 PowerCalibration:-60 Type:iBeacon MajorNumber:8977 MinorNumber:11236 RSSI:-35
RegionUUID:07775DD0-111B-11E4-9191-0800200C9A66 PowerCalibration:-60 Type:iBeacon MajorNumber:8977 MinorNumber:11236 RSSI:-34
RegionUUID:07775DD0-111B-11E4-9191-0800200C9A66 PowerCalibration:-60 Type:iBeacon MajorNumber:8977 MinorNumber:11236 RSSI:-31
RegionUUID:07775DD0-111B-11E4-9191-0800200C9A66 PowerCalibration:-60 Type:iBeacon MajorNumber:8971 MinorNumber:57940 RSSI:-69
RegionUUID:07775DD0-111B-11E4-9191-0800200C9A66 PowerCalibration:-60 Type:iBeacon MajorNumber:8969 MinorNumber:33108 RSSI:-73
RegionUUID:07775DD0-111B-11E4-9191-0800200C9A66 PowerCalibration:-60 Type:iBeacon MajorNumber:8969 MinorNumber:33108 RSSI:-68
RegionUUID:07775DD0-111B-11E4-9191-0800200C9A66 PowerCalibration:-60 Type:iBeacon MajorNumber:8971 MinorNumber:57940 RSSI:-61
RegionUUID:07775DD0-111B-11E4-9191-0800200C9A66 PowerCalibration:-60 Type:iBeacon MajorNumber:8969 MinorNumber:33108 RSSI:-68
The utility forks fine!
But the signal definitely does not go through 2 walls( wood). Through one wall signal goes from -35 down to -80.
One would need SEVERAL receivers throughout the house to get signal from everywhere, may be a job for a raspberry setup .
Karl
-
stuartcolman
- Posts: 81
- Joined: Sun Nov 01, 2015 2:56 pm
- Location: Essex, United Kingdom
Re: iBeacon...but in reverse
Look what i found: http://developer.radiusnetworks.com/201 ... eacon.html
This does pretty much exactly what is needed. The code here:
Would just need to be changed and the references to the gpio stuff removed. My view of the code would be:
Obviously changing the UUID, major and minor values for those of your own.
You could run this on several Pi's if needed, which maybe able to drill down on internal location too. For instance if you are inclose to one PI it could send a unique location instead of home for instance it could send "kitchen" or "garage".
Just need to figure out the leaving part of the script to send when you exit the beacon.
This does pretty much exactly what is needed. The code here:
Code: Select all
#!/bin/bash
gpio mode 1 out
trap "gpio write 1 0" exit
while read line
do
if [[ `echo $line | grep "2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6 1 1" ` ]]; then
gpio write 1 1
fi
doneCode: Select all
#!/bin/bash
while read line
do
if [[ `echo $line | grep "2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6 1 1" ` ]]; then
curl -H "Content-Type: application/json" -X POST -d '{"sender":"user","location":"home","event":"LocationEnter"}' http://INDIGO_IP:6192
fi
doneYou could run this on several Pi's if needed, which maybe able to drill down on internal location too. For instance if you are inclose to one PI it could send a unique location instead of home for instance it could send "kitchen" or "garage".
Just need to figure out the leaving part of the script to send when you exit the beacon.
Re: iBeacon...but in reverse
how to setup a pi with BLE scanner..
https://learn.adafruit.com/downloads/pd ... rry-pi.pdf
https://learn.adafruit.com/downloads/pd ... rry-pi.pdf
-
stuartcolman
- Posts: 81
- Joined: Sun Nov 01, 2015 2:56 pm
- Location: Essex, United Kingdom
Re: iBeacon...but in reverse
This is from Radius Networks, they have a prebuilt image with the Bluetooth stack and beaconscan built in: http://developer.radiusnetworks.com/pib ... pdate.html
Just choose your image and write it to the SD Card.
Just choose your image and write it to the SD Card.
Re: iBeacon...but in reverse
did anyone get this to work on a pi?
I tried the regular raspberry image ( with many sudo apt-get install ..) and got a very basic response , but not the python example to work
and with the radius image , the dongle is recognized but the beacon gives me an error message "set scan parameters failed"
anyone successful?
Karl
I tried the regular raspberry image ( with many sudo apt-get install ..) and got a very basic response , but not the python example to work
and with the radius image , the dongle is recognized but the beacon gives me an error message "set scan parameters failed"
anyone successful?
Karl
-
stuartcolman
- Posts: 81
- Joined: Sun Nov 01, 2015 2:56 pm
- Location: Essex, United Kingdom
Re: iBeacon...but in reverse
I got it running using the radius image and running
Shows up the beacon which is running on my iphone.
Code: Select all
sudo beacon scaniBeacon...but in reverse
Which ble device did u use and was it pi 1 or 2?
Sent from my iPhone using Tapatalk
Sent from my iPhone using Tapatalk
-
stuartcolman
- Posts: 81
- Joined: Sun Nov 01, 2015 2:56 pm
- Location: Essex, United Kingdom
Re: iBeacon...but in reverse
I'm using a Pi version 1 I think it's the B one of the early ones. I have a Plugable USB Bluetooth adapater (http://plugable.com/products/usb-bt4le).
I have also abandoned beacon scan for moment.
I found this article: http://www.makeuseof.com/tag/auto-locki ... ty-sensor/
This is a bluetooth proximity lock script. I have adapted the python script shown in it to run a shell command to send presence via the Beacon plugin. At the moment it's detecting my phone, so I'm waiting for the iBeacon to turn up and play around with that.
I have also abandoned beacon scan for moment.
I found this article: http://www.makeuseof.com/tag/auto-locki ... ty-sensor/
This is a bluetooth proximity lock script. I have adapted the python script shown in it to run a shell command to send presence via the Beacon plugin. At the moment it's detecting my phone, so I'm waiting for the iBeacon to turn up and play around with that.