Page 2 of 5

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Monday 25 July 2016 20:28
by remb0
I have an zwave card on my board indeed. but didn't use it.

I will remove it and try again.

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Monday 25 July 2016 20:31
by ben53252642
ok, you can use both if you get an external bluetooth usb dongle, mine cost about $5 :)

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Monday 25 July 2016 21:38
by remb0
I don't use this card anymore.

I have done this to fix this:
> sudo apt-get install raspberrypi-sys-mods
When prompted to overwrite the config, type Y

> sudo apt-get install --reinstall pi-bluetooth
Still shows an error, let's reboot to pick up the new UART config

> sudo shutdown -r now
Note that we no longer get an hciuart error message during boot

Once rebooted, do:
> systemctl status hciuart.service
Now shows Bluetooth loaded and active (running)

for a video how to use bluetooth on linux:
http://www.cnet.com/how-to/how-to-setup ... erry-pi-3/

Now I'm gonna test the presence script :)
feedback on script:

- Update doesn't work when using ssl (htps) because links starting with http
http/https variable in settingsblock?
- cooldown period?
- examples how to change ping frequency?

I experience a lot of online/offline with my samsung s7. while the telephone is in range (even next to it) and pingable /scanable.
I will test it a little bit longer.

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Saturday 30 July 2016 10:10
by remb0
pinging works create but the bleutooth not.
l2ping -c1 -s32 -t1 "34:14:5f:17:2e:f6"
I got: Can't connect: No route to host

what can I check?

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Sunday 31 July 2016 1:24
by ben53252642
remb0 do you have more than 1 bluetooth dongle on that system?

Can you run hcitool scan and detect a bluetooth device in discover mode?

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Sunday 31 July 2016 12:26
by remb0
I started with a fresh rpi image and guess what: it works out of the box!!

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Thursday 18 August 2016 0:21
by deejc
this is working great for me right off the bat!! on my iPhone 5s
how might this affect battery life ?

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Thursday 18 August 2016 9:33
by deejc
Actually I may have been a bit premature in my celebration. I put notifications on the switch for each on and off and it can't ping it quite often. It seems to goto deep sleep and even Bluetooth fails, shame, I thought it had it sorted with this script. Oh well back to the drawing board!


Sent from my iPhone using Tapatalk

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Thursday 18 August 2016 12:44
by ben53252642
Well obviously if the device won't respond at all via either Wifi or Bluetooth then no script is going to be able to see it... That said it works perfectly with my iPhone 6s, I haven't noticed any additional drain on the battery. Also keep in mind the short range of Bluetooth.

Another option for you might be to use the iBeacon feature within Pilot to turn on a Domoticz device when the phone detects an iBeacon.

viewtopic.php?t=12906

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Thursday 18 August 2016 22:27
by deejc
not sure why the phone drops off both the wifi and BT but it does.
i tried the iBeacon script but it seems my bt dongle is an old one and won't work properly
Can't set advertise mode on hci0: Input/output error (5), maybe i'll get a BTLE dongle

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Thursday 18 August 2016 22:43
by ben53252642
It must be Bluetooth 4.0 or higher to be able to broadcast an iBeacon.

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Friday 19 August 2016 0:55
by jnoel68
Works fine for me, with a CSR 4.0 USB dongle plugged on my synology.
I'm able to detect my iPhone via Wifi or Bluetooth.
But I would like to go further and try to detect my beacons (chipolos), but I'm not able to find their ble mac address.
Any idea guys ?
Thx

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Friday 19 August 2016 5:52
by trixwood
If you mean scanning ibeacons, there are also for the iphone apps available, but I used on my mac

https://itunes.apple.com/us/app/beacon- ... 4474?mt=12

but thats ibeacons,... not sure if that is the same...

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Friday 19 August 2016 10:44
by jnoel68
Finally, I've got the iBeacon bluetooth mac address in my synology interface, they have been detected by the system :D
BUT, because there is always a BUT, l2ping doesn't work with the 2 address of my iBeacons :(
Is l2ping able to dialog with BLE devices (I don't have any issue with my iPhone or mac detection with l2ping) ?
Thx
PS : I'm running on synology, not on PI, not sure if I have the latest version of l2ping

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Friday 19 August 2016 11:55
by deejc
Why are you trying to ping the beacons? They usually are in fixed positions and the phone uses them for location


Sent from my iPhone using Tapatalk

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Friday 19 August 2016 14:11
by jnoel68
deejc wrote:Why are you trying to ping the beacons? They usually are in fixed positions and the phone uses them for location


Sent from my iPhone using Tapatalk
iBeacons may not be the correct term. I have bought bluetooth trackers (chipolo), and I want to know when they are at home (as my iPhone), that's why I want to ping them.
Thx

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Monday 22 August 2016 22:07
by deejc
got my £6 dongle today, working right away!!! thanks for the script

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Tuesday 23 August 2016 0:56
by ben53252642
$3 mod for my $5 USB bluetooth adapter. :D
IMG_05044.JPG
IMG_05044.JPG (334.29 KiB) Viewed 7960 times
IMG_05054.JPG
IMG_05054.JPG (306.31 KiB) Viewed 7960 times
IMG_05094.JPG
IMG_05094.JPG (244.96 KiB) Viewed 7960 times

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Wednesday 31 August 2016 12:35
by siebke
Hi,

Really liked the presence detection script but somehow it doesn’t seems to work the right way. The output I’m getting is:

Code: Select all

pi@raspberrypi:~/domoticz/scripts$ sudo ./iphone_roger.sh
./iphone_roger.sh: 1: ./iphone_roger.sh: #!/bin/bash: not found
./iphone_roger.sh: 25: ./iphone_roger.sh: [[: not found
./iphone_roger.sh: 35: ./iphone_roger.sh: [[: not found
./iphone_roger.sh: 45: ./iphone_roger.sh: [[: not found
./iphone_roger.sh: 55: ./iphone_roger.sh: [[: not found
Status in sync
./iphone_roger.sh: 25: ./iphone_roger.sh: [[: not found
./iphone_roger.sh: 35: ./iphone_roger.sh: [[: not found
./iphone_roger.sh: 45: ./iphone_roger.sh: [[: not found
./iphone_roger.sh: 55: ./iphone_roger.sh: [[: not found
Status in sync
Tried manually pinging both Wifi and Bluetooth and this works perfectly.

Code: Select all

pi@raspberrypi:~/domoticz/scripts$ sudo l2ping -c1 -s32 -t1 "34:A3:95:DE:2B:A2"
Ping: 34:A3:95:DE:2B:A2 from B8:27:EB:60:5E:3A (data size 32) ...
32 bytes from 34:A3:95:DE:2B:A2 id 0 time 6.96ms
1 sent, 1 received, 0% loss

pi@raspberrypi:~/domoticz/scripts$ fping -c1 -b 32 -t1000 192.168.2.40
192.168.2.40 : [0], 60 bytes, 112 ms (112 avg, 0% loss)
192.168.2.40 : xmt/rcv/%loss = 1/1/0%, min/avg/max = 112/112/112
pi@raspberrypi:~/domoticz/scripts$

Any ideas guys what could be wrong?

Thanks!

Re: Ultimate Wifi and Bluetooth Presence Detection

Posted: Wednesday 31 August 2016 12:40
by ben53252642
That error usually appears when you try to run the script via SH, example:

sh script.sh

The correct way to run the script is sudo ./script.sh

In this case however there may be something wrong with your linux installation.

Try running the command:

sudo /bin/bash

Post the output