Digital turnstile with Bluetooth and Linux

Blueproximity is a Linux program that (un)locks your PC detecting the presence/absence of a paired Bluetooth device (i.e. your mobile phone).

In its preference pane you can set a command to be executed when detecting the phone. I set it up with “checkmein in” and “checkmein out” commands, where the checkmein scritpt is this simple stuff:

#!/usr/bin/env perl
$in = shift;
$now = `date +"%Y-%m-%d|%H:%M"`;
if ($in eq 'in') {
$action = 'IN';
} elsif ($in eq 'out') {
$action = 'OUT';
} else {
$action = 'PING?';
$comment = $in;
open(LOG, ">>/home/telatin/bmr-log.txt");
print LOG "$now|$action|$comment\n";



Basically you write into a plain text file some lines. It looks like:



In my hands I have several false checkin/out… and that’s why I wanted to keep also the “pings”, to have a track of presence of the phone (me).

Then I parse them with this script (beta): This script assumes you want to know how many hours you spent near your PC in a day, and this version only keeps the first “checkin” and the last “checkout” to do this.

Output is like:

2013-12-30 16:30 18:21 1.85  
2013-12-31 08:47 10:05 1.30



One thought on “Digital turnstile with Bluetooth and Linux

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s