Bluetooth Presense Detection executing AppleScript

Posted on
Fri Dec 05, 2014 5:53 am
Vangelis offline
Posts: 167
Joined: Mar 18, 2014
Location: Southampton (UK)

Bluetooth Presense Detection executing AppleScript

Got a programming issue which I just can't get my head around the best way to code...

Setup is as follows...

Run Bluetooth Proximity program that allows you to pair and set the sensitivity of a device.
It will execute an AppleScript when it detects a BT signal that is above the set threshold..
It will also execute and AppleScript when it detects loss of the BT signal below the set threshold.

There is a configuarble delay you can set before it execute the AppleScript, however it does not differentiate between detection of signal and loss of signal, it just waits.
This causes a problem whereby if the signal is lost (the delay starts), and will only execute the script when the delay expires (all good) This caters for temporary loss of signal
When the signal is detected (I have a trigger to make an annoucement through Sonos), again the delay is started (which is not really what I wanted) as I am further into the house before the annoucement is made.

Sooo, is there a way, through Indigo, via additional delays or setting variables, I could remove the delay from the app, and build it into some logic within Indigo so I could say check for an excessive amounts of loss of BT signal (say 5) in a 15 min window before Triggering and 'Away' event, whilst still maintaining the BT detection with the Sonos event???

Vangelis

Posted on
Fri Dec 05, 2014 6:52 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Bluetooth Presense Detection executing AppleScript

I don't quite follow this:

There is a configuarble delay you can set before it execute the AppleScript, however it does not differentiate between detection of signal and loss of signal, it just waits.


I understand the purpose of the delay, but I don't get the last part...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Dec 07, 2014 3:42 am
Vangelis offline
Posts: 167
Joined: Mar 18, 2014
Location: Southampton (UK)

Re: Bluetooth Presense Detection executing AppleScript

Sorry Jay - Let me try to clarify.....

The program will execute an AppleScript if detects a BT signal, or when it has signal, it will execute another script when it looses BT signal.

There is an overarching configurable delay built into the program that you can set (in seconds), whereby it will wait for this delay period before executing each script. I suppose this is to mitigate against spurious loss of signal as I move about the house. This delay acts upon both detection and loss of signal (i.e there is not a separate configurable delay for each)

Problem is this doesn't work very well, so I wanted to move this into Indigo, so the program would execute the AppleScript as soon as it detected a BT signal (this in turn executes a Trigger in Indigo to make an announcement).

When the BT signal is lost, the program would again execute the AppleScript which would trigger Indigo, however Indigo would hold off executing anything further, say for 10 mins, to REALLY detect that there is no BT signal (mitigating against loss of signal for short period of time). If the program execute the BT detection script within this time then it would reset the timer in Indigo, but NOT execute any announcements

I can't do this with the program's delay as it act both on detection and loss of BT signal.

Vangelis

Posted on
Sun Dec 07, 2014 12:02 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Bluetooth Presense Detection executing AppleScript

Gotcha. So, I think you answered your own question: use a Timer device. Start it running when you get the device loss signal. You can stop the timer at any time, and you can trigger on the timer expiring. I believe it has all the features you're looking for.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests