WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

 « Return to Thread: Bluetooth Presence Monitoring

Re: Bluetooth Presence Monitoring

by Emmanuel Grout :: Rate this Message:

| View in Thread

Hi again,

I was too fast and forgot to tell what was wrong ;)
In fact when I restart MH the first check is working but all others are wrong.
from the shell it works fine.

Thanks,
Emmanuel
Emmanuel Grout wrote:
Hello the list :)

I want to monitor my presence using my Bluetooth cell phone so I did this :

######################################
use Net::Bluetooth;


########################################################################
# Ping BT device
########################################################################
sub Check_BT() {
  my $BT_obj = Net::Bluetooth->newsocket("RFCOMM");
  die "socket error $!\n" unless(defined($BT_obj));
  if($BT_obj->connect(@_, 1) != 0) { print_log "@_ is dead"; }
        else { print_log "@_ is alive"; }
  $BT_obj->close();
}

########################################################################
# Main
########################################################################
if (new_second 20) { &Check_BT('AC:A8:E5:18:5B:F1'); }


However this is working fine from the shell but not from MisterHouse ?!
I think I am doing something wrong with the socket inside MH but can't figure what.

Any ideas ?

Good day to all !
Emmanuel

 « Return to Thread: Bluetooth Presence Monitoring