Rasperry Pi component of the Vera Presence Sensor plugin. This component is a Raspberry Pi disk image that performs the actual presence checks and updates the status of the sensor on Vera.

This Presence Sensor has two components - a plugin for Vera that provides a new virtual device type for keeping track of presence states and a Raspberry Pi that does the actual polling and updates the virtual devices as changes are noted.

The Raspberry Pi image supports polling for known bluetooth devices (gets around iPhones going to sleep) and also continueously searches for ibeacons and can check them against known addresses as well.

Some experimentation may be needed to find the optimal placement to get the required coverage as the Pi does not have a high-gain antenna for Bluetooth. Better results may be had by using a USB bluetooth adaptor with external antenna.

The disk image for the Raspberry Pi is set up to simply be written to the Micro SD card for the Pi and then just one configuration setting to be set (the local IP address of your Vera unit). The instructions for writing the image to the SD card depend on the operating system that you're using, but are identical to the instructions for getting any other image for the Pi installed.

One difference in my image is that after it boots up it leaves the root filesystem mounting read-only and creates a few ram drives to run from. This means that power can be pulled at any time and there is absolutely no risk of corrupting the file system. If changes are needed to be made, there's a command called 'remountrw' which can be run to mount the disk into read-write mode so the changes can be made. Once the changes have been completed, don't forget to run 'remountro' to put it back into read-only mode. As the ramdrives shadow files that sometimes need to be edited (particularly /etc), the root filesystem is bind mounted under /ro - so you can make peristent changes to /etc by editing the files under /ro/etc/ and then rebooting.

First time configuration

Once the image has been written to the Micro SD card and the Raspberry Pi booted, log in to the Pi using your favourite terminal method (keyboard/monitor or SSH), remount the file system as read-write and edit the python scanner script at /ro/srv/scanner/run_scanner.py. All you need to set in this file is the IP address your Vera unit has on your local network.

Reboot your Raspberry Pi and it should automatically start the scanner script, connect to your Vera, find the PresenceSensor devices and start to poll them.

Updating

The image is using two main libraries to do the bluetooth work, plus my own containing the scanner script. All three can easily be updated using git.

ibeacon-scanner by John Shovic
     https://github.com/switchdoclabs/iBeacon-Scanner-

pyvera by Cyber MacGeddon
     http://forum.micasaverde.com/index.php/topic,37927.0.html
     https://github.com/cybermaggedon/pyvera
     (my fork) https://github.com/daemondazz/pyvera

scanner script
     https://github.com/daemondazz/vera-presence-scanner

Any of those libraries can be updated by remounting in read-write mode, changing into the appropriate directory under /ro/srv/ and running a 'git pull'

Downloads

  • Linux (bluetooth_scanner_0.1.0.img.zip - 446.7┬áMB)

Check the archive for older versions of the application.

History

10th Jul 2016 - Version 0.1.0

Initial release.

Customer Portal
Please log in to manage your AFOYI account.