How to check presence of Beacon ?

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.
roblom
Posts: 554
Joined: Wednesday 26 February 2014 16:28
Target OS: Raspberry Pi
Domoticz version:
Location: the Netherlands
Contact:

Re: How to check presence of Beacon ?

Post by roblom » Wednesday 16 August 2017 19:30

I have this working but it only works for a few seconds. After that no updates are made. When I do a reset then it works for a few seconds again.

honselbonsel
Posts: 1
Joined: Thursday 17 August 2017 20:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by honselbonsel » Friday 18 August 2017 10:25

Hi jimieglise,
i installed your script and it is running as a service. All is fine Thanks for the Great Work.
But there is one thing which makes me crazy.
Example: i sit nearby the Bluetooth dongle location (with the beacon laying down on the desk) the Presence should be ok but on each checking of the script it returns the beacon Away then a value then Away then a Value and so on...
The Beacon is not Moving. But the status is flapping

any ideas? :-)

thx
jens

nizaga
Posts: 96
Joined: Monday 30 November 2015 12:36
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by nizaga » Thursday 24 August 2017 23:23

Hi! I just got a Mini Nut 2. Is it possible to call mi nut from domoticz like I can do from the iOS app? I want to be able to search my keys currently attached to the Nut. So, can I get my Nut to beep via domoticz? Thanks


Enviado desde mi iPhone utilizando Tapatalk Pro

guantolento
Posts: 164
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: How to check presence of Beacon ?

Post by guantolento » Monday 04 September 2017 16:48

hi, i have reinstall all bluez with fw 5.46.
in the folder attribute i can't find the file gatttool,so i can't take the command
sudo cp attrib/gatttool /usr/local/bin/ as in the wiki.
any info for me ?
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F

User avatar
emme
Posts: 507
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: How to check presence of Beacon ?

Post by emme » Monday 04 September 2017 17:00

mine gets at 30% after almost a year

battery check will drain the battery, so do not check it too much... once a week should be enough.
I use to check it every time the nut will appear back in the network... soon I'll move this to once a day as soon as it is back availble

ciao
M
That's one small step for a programmer, one giant leap for me!
- - - - -
Raspberry Pi3 + AeonStick G5 + RFXCOMM433 + iRTrans Server + NodeJS
There's no stress in the mess!!

TheCondor
Posts: 29
Joined: Thursday 18 June 2015 10:32
Target OS: Linux
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by TheCondor » Monday 04 September 2017 17:35

Hello, i'm using this script since 6 month ago circa with my PI3 internal BT. All is working fine but the signal is so strong that the variable "home/away" changes also when i'm out of the building and i go from my car to my garage :lol:

Any trick for set in the script an RSSI max value for the discovery?

User avatar
emme
Posts: 507
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: How to check presence of Beacon ?

Post by emme » Monday 04 September 2017 17:47

RSSI is gather once the beacon is discovered as available in the network...

this means that if your beacon bumps off and on it means that is not seen during the scan... this is possible for a wide range of reasons:

- BT atenna is shielded by walls, metals or other stuff
- BT interface is not availble by the time of scan (do you have other services that runs at the same time that use hci0?)
- Scan time is too short (specially when there are a lot of LE devices available)

my old script used to check 3 times in 10 seconds before setting off a device due to those bumps (my pi is inside a closet), than I placed a CRS bt4 dongle which was more efficient.. and did not get this issue anymore.

Sometimes the BLE itself won't beacon as it is supposed to do ;)
That's one small step for a programmer, one giant leap for me!
- - - - -
Raspberry Pi3 + AeonStick G5 + RFXCOMM433 + iRTrans Server + NodeJS
There's no stress in the mess!!

User avatar
solidum90
Posts: 21
Joined: Tuesday 01 August 2017 20:59
Target OS: NAS (Synology & others)
Domoticz version: Debian
Location: Milan
Contact:

Re: How to check presence of Beacon ?

Post by solidum90 » Tuesday 05 September 2017 22:40

Hello to everyone,
this script works great.. but I have two questions:

I have a nut 3 Beacon, when the Beacon is associated iphone's app this script doesn't see beacon, is it correct?
There's no way to works both ?

Otherwise, can not you run this script even to detect iphone?
(I try to add my iphone on TAG_DATA but it doesn't work)

Thanks to everyone and congratulations for this project! :)

guantolento
Posts: 164
Joined: Saturday 01 October 2016 14:48
Target OS: Raspberry Pi
Domoticz version: LastBeta
Location: Italy BG
Contact:

Re: How to check presence of Beacon ?

Post by guantolento » Tuesday 05 September 2017 23:40

solidum90 wrote:
Tuesday 05 September 2017 22:40
Hello to everyone,
this script works great.. but I have two questions:

I have a nut 3 Beacon, when the Beacon is associated iphone's app this script doesn't see beacon, is it correct?
There's no way to works both ?

Otherwise, can not you run this script even to detect iphone?
(I try to add my iphone on TAG_DATA but it doesn't work)

Thanks to everyone and congratulations for this project! :)
Hi, i think the nut can't work in 2 system. Actually i have 5 nut and all work ok, but no nut is connected to the app.
But i'm waiting a response from Mr. Emme.
Bye Bye.
Master (pi3) - MB sensors + Dummy + Sysfs gpio + 1 NodOn MSP-3 + 1 Aeotec DSB28 Energy Meter + 3 Danfoss RS Room + 7 Danfoss Z Thermostat + 1 Swiid Inter + 9 FGS222
Slave01 (pi2) - MB sensors + Dummy + Weather Underground + 2 FGS223 + 1 FGWPE/F

User avatar
emme
Posts: 507
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: How to check presence of Beacon ?

Post by emme » Wednesday 06 September 2017 8:35

solidum90 wrote:
Tuesday 05 September 2017 22:40
when the Beacon is associated iphone's app this script doesn't see beacon, is it correct?
unfortunately yes :(
if the BLE is paired than it disappear from the scan, unfortunately there is no workaround to have it works either way

presence of iOS devices is quite wired...
since they do NOT reply to WLAN ping, it looks they do on Bluetooth...
so you could use hcitool scan (instead of lescan) to identify it, of course you cannot use gatttool for battery, but you could only discover its presence

just remember to leave bt On on the device ;)
ciao
M
That's one small step for a programmer, one giant leap for me!
- - - - -
Raspberry Pi3 + AeonStick G5 + RFXCOMM433 + iRTrans Server + NodeJS
There's no stress in the mess!!

User avatar
solidum90
Posts: 21
Joined: Tuesday 01 August 2017 20:59
Target OS: NAS (Synology & others)
Domoticz version: Debian
Location: Milan
Contact:

Re: How to check presence of Beacon ?

Post by solidum90 » Wednesday 06 September 2017 10:28

emme wrote:
Wednesday 06 September 2017 8:35
solidum90 wrote:
Tuesday 05 September 2017 22:40
when the Beacon is associated iphone's app this script doesn't see beacon, is it correct?
unfortunately yes :(
if the BLE is paired than it disappear from the scan, unfortunately there is no workaround to have it works either way

presence of iOS devices is quite wired...
since they do NOT reply to WLAN ping, it looks they do on Bluetooth...
so you could use hcitool scan (instead of lescan) to identify it, of course you cannot use gatttool for battery, but you could only discover its presence

just remember to leave bt On on the device ;)
ciao
M
Thanks for reply (sei italiano? ;) )

I found a "workaround", I use l2ping on inside an ula script that they already use to detect presence with ping, but with iphone has no sense because when it is locked it does not respond to ping.
Then I use your script to query the nut.
In this way if the nut is connected to the ap I ping iphone via l2ping, otherwise I query the nut directly.
Every minute runs an ula script that verifies if at least one device responds to determining the presence.
Is it a good way?

This is a part of my ula script:

Code: Select all

DisposiviPresenza = {};
DisposiviPresenza[1] = {nome="iPhoneLorenzo", ip = "ip.xxx.xxx.xxx", bluetooth="mac:xx:xx:xx:xx:xx"}

-- ping dispositivi di presenza
for i, v in pairs(DisposiviPresenza) do
    local ping = false;
    local string;
    
    if v.bluetooth  ~= nil then
        
        string = 'l2ping -c1 -s32 -t1 '..v.bluetooth
        TraceLog ("l2ping : " .. string)
        ping = os.execute(string); 
        if (ping) then 
            TraceLog ("==> "..v.nome.." ping OK")
        else
            TraceLog ("==> "..v.nome.." ping NOK")
        end
        
    end
    
    if not ping and v.ip  ~= nil then
        
        string = 'ping -c 1 -w 1 '..v.ip
        TraceLog (">ping : " .. string)
        ping = os.execute(string); 
        if (ping) then 
            TraceLog ("==> "..v.nome.." ping OK")
        else
            TraceLog ("==> "..v.nome.." ping NOK")
        end
    
    end
   
    ping_success = ping_success or ping
end


User avatar
emme
Posts: 507
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: How to check presence of Beacon ?

Post by emme » Wednesday 06 September 2017 10:51

solidum90 wrote:
Wednesday 06 September 2017 10:28
Thanks for reply (sei italiano? )
..abbastanza :lol: (Milano ;) )

I think your script is GREAT solution
I did not knew the iOS device does not reply in standby mode (thanks Apple! :( ) and your way to seek for the device and then the nut is good!

ciao
M
That's one small step for a programmer, one giant leap for me!
- - - - -
Raspberry Pi3 + AeonStick G5 + RFXCOMM433 + iRTrans Server + NodeJS
There's no stress in the mess!!

User avatar
solidum90
Posts: 21
Joined: Tuesday 01 August 2017 20:59
Target OS: NAS (Synology & others)
Domoticz version: Debian
Location: Milan
Contact:

Re: How to check presence of Beacon ?

Post by solidum90 » Wednesday 06 September 2017 11:01

emme wrote:
Wednesday 06 September 2017 10:51
solidum90 wrote:
Wednesday 06 September 2017 10:28
Thanks for reply (sei italiano? )
..abbastanza :lol: (Milano ;) )

I think your script is GREAT solution
I did not knew the iOS device does not reply in standby mode (thanks Apple! :( ) and your way to seek for the device and then the nut is good!

ciao
M
Allora siamo anche vicini di casa (io Monza :p)
Always say thanks to Apple (my girlfriend given iphone, otherwise I would never have taken it! :p)

Post Reply

Who is online

Users browsing this forum: freakshock and 5 guests