My idea is to automatically arm/disarm my domoticz alarm system by checking presence of beacon. I plan to equip all the familly keys with beacon. Domoticz will trigger the alarm on when the last beacon leaves the home. (Small home. 7m is enough. And as my domoticz speaks, i don't fear false alarms).

So: did someone already have experience with that ?
How domoticz can test presence of beacon ? I read topic on the opposite usage (raspberry is the beacon, and phone made the check). For me, the raspberry must be the receiver. Not the Beacon.

Last edited by jmleglise on Sunday 22 May 2016 11:44, edited 2 times in total.

I have the same ble trackers but they disabled if are not connected after a while. If have a way to keep them alive and broadcast their mac address it is an info I like to hear.
instead i bought, also from same shop, a set of NUT tracker ( http://www.banggood.com/Mini-Smart-Patc ... 88462.html ) that can be active even they are not connected.
FHEM (another home automation platform: http://fhem.de/fhem.html )has a script (as you may find building your project) that check the presence of a bluetooth mac address and can trigger a commnad.

no need to worry that these iTags you bought are useless. you can use it as Panic Button (if they detected, run a alarm/start recording from cameras,ryc).

1/ The trick is that I installed the application on mobile, I paired them and after I removed application. NUT2 still broadcast their MAC address!
2/ I used a lot of scripts, commands and as always NUT are available!
Right now as I told i use FHEM (especially bluetooth presence module). I try to find a way to trigger domoticz from FHEM on presence/absence of NUT.
It is not a clean way as I have to use 2 different home automation systems.

I hope someone who knows better coding to port the previous script on domoticz and get a native bluetooth solution. Looking deeper on bluetooth le, I see that some ble tags like these you bought can be programmed via bluetooth. We need people from comminity to get involved on bluetooth solutions.

if you omit the second line, FHEM will repeat send every 30 sec a new status. You see 30 is how much time will recheck status. lower= faster BUT as I see when using values smaller than 10 secs, BT detection gets unstable or FHEM crash.
take your time and check how can lower this value. I believe that it also depends of the devices to check you have on FHEM.

Edit: As I imagine you need it for presence detection, you may consider bluetooth range. increasing bluetooth dongle range can give you early detection (before entering home) and coverage. I suggest to get a class 1 BT v4 dongle as in theory can reach 100m coverage (50m in radius on open enviroment). I confirm that it getting better results. I can also suggest the following as it gave me more coverage that the cheap i replaced. http://www.ebay.co.uk/itm/271983450417? ... EBIDX%3AIT

It the next weeks I ll get an extra bluetooth dongle and an extra raspberry-like to install it to the other side of house, so to complete the full coverage of house. The idea is to trigger domoticz only NUT can not be found from any bluetooth dongle. If you know FHEM how can treat this scenario please drop a message!

I have problems with geofencing etc and all decent beacon ideas have been very apple orientated

To me the concept of multiple RasPi/BLE boxes dotted about looks quite cool. I'd be interested in being able to recognise the approach of either my wife's car or my own and turn on external lighting and open an electric gate.

I think I'll be buying some NUT tags soon, but what is their range like?

korniza wrote: I'm glad to hear it!
It took me long time to find how to put fhem connected with domoticz. here is the way I do: it's just sends once a nut it recognised only ONE trigger using the following

if you omit the second line, FHEM will repeat send every 30 sec a new status. You see 30 is how much time will recheck status. lower= faster BUT as I see when using values smaller than 10 secs, BT detection gets unstable or FHEM crash.
take your time and check how can lower this value. I believe that it also depends of the devices to check you have on FHEM.

Edit: As I imagine you need it for presence detection, you may consider bluetooth range. increasing bluetooth dongle range can give you early detection (before entering home) and coverage. I suggest to get a class 1 BT v4 dongle as in theory can reach 100m coverage (50m in radius on open enviroment). I confirm that it getting better results. I can also suggest the following as it gave me more coverage that the cheap i replaced. http://www.ebay.co.uk/itm/271983450417? ... EBIDX%3AIT

It the next weeks I ll get an extra bluetooth dongle and an extra raspberry-like to install it to the other side of house, so to complete the full coverage of house. The idea is to trigger domoticz only NUT can not be found from any bluetooth dongle. If you know FHEM how can treat this scenario please drop a message!

guys, hcitool can not provide by itself a real interface (at least not aby itslef) to domoticz.
I used FHEM (http://fhem.de/fhem.html ) .

FHEM (TM) is a GPL'd perl server for house automation. It is used to automate some common tasks in the household like switching lamps / shutters / heating / etc. and to log events like temperature / humidity / power consumption.
The program runs as a server, you can control it via web or smartphone frontends, telnet or TCP/IP directly.
In order to use FHEM you'll need a 24/7 server (Fritz!Box, NAS, RPi, PC, MacMini, etc) with a perl interpreter and some attached hardware like the CUL, FHZ1300PC, etc. to access the actors and sensors.

So in practice I run a second home automation system to the same raspberry (no conflict on ports/resources) and trigger domoticz. FHEM is very stable as I used it till now but the frontend interface is poor comparing with domoticz.

using the following part to fhem.cfg, you can trigger a switch to domoticz.

NUT_Maria: the internal name of BLE NUT (not the real that is been broadcasted by NUT device)
xx:xx:xx:xx:xx:xx : Mac Address of the BLE NUT (http://www.banggood.com/Mini-Smart-Patc ... 88462.html)
localhost:5333 30 60 : the host:port that runs FHEM. 30 60 it is the seconds for checking the status of this BLE NUT
attr NUT_Maria event-on-change-reading state : FHEM sends status update to domoticz ONLY when FHEM find a change of state. Ommiting this will send every 30 secs the status of BLE NUT
Maria_p : Name of Presence status (you can put anything you like)
Maria_a: Name of Absence status (you can put anything you like)
curl -s "http://aa.aaaa.aa:8080/json.htm?type=co ... itchcmd=On : Send the Precence status to domoticz. please chance the idx inside link to match to you idx of your switch.
curl -s "http://aa.aaaa.aa:8080/json.htm?type=co ... itchcmd=On : Send the Absence status to domoticz. please chance the idx inside link to match to you idx of your switch.

That's it, I got it ! I have a satisfactory solution to detect the presence of beacon (Bluetooth 4.0 Low Energy Tag tracker) with Domoticz on linux (raspberry).

This beacon works fine : http://eu.banggood.com/Wholesale-Wareho ... 88462.html
Presence is detected in 4 to 8 secondes. (Thus on the contrary, the absence may be decided in less than 15 secondes when the tracker get out of range...)
The dongle below detects it to a distance of 12m (in direct view) or upstairs across 2 floors.

First install the last Bluetooth stack. Check the last version here : http://www.kernel.org/pub/linux/bluetooth/ (mine was 5.39). The compilation take around 20 minutes. And at the end, you will need to reboot :

jmleglise wrote:I choose to update Domoticz only when the status changes. (beacon arrives in range or disappear).

Thank you for sharing this script. I just tried it and I found a small bug: putting capital letters on MAC, it did not match with scanned MAC.
I suppose something has to do with string.
ALSO, there is no update for tags that are away but on status they seem to be HOME. I used the iTags and they stay on status HOME.

Some requests:
Can you please add a switch for devices to keep send updates even status has not changed? As you also have the BLE keys that stop broadcasting, I used them for PANIC button, so I like to trigger some devices to do repeated tasks (take snapshots, send repeated emails, etc).

Also can you softcode the delay for each device (you have 15 secs), so on some critical devices to be less or on other more (for example bluetooth speakers)

Thanks again for sharing your ideas & code

Last edited by korniza on Saturday 07 May 2016 0:04, edited 1 time in total.