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.
micbou
Posts: 88
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou » Sunday 29 May 2016 17:45

Ok back to square one. I figured I messed up some things in my install so I went for a fresh install and in the process of setting everyting up again now.
However

Code: Select all

sudo python /usr/local/bin/check_beacon_presence.py
Results in nothing. It just hangs and only way to get out of it is CTRL+C

Starting the service seems to work

Code: Select all

[email protected]:/home/pi# sudo /etc/init.d/check_beacon_presence start
[ ok ] Starting check_beacon_presence (via systemctl): check_beacon_presence.service.
checking the status is giving me this:

Code: Select all

[email protected]:/home/pi# sudo /etc/init.d/check_beacon_presence status
● check_beacon_presence.service - LSB: This daemon manages the bluetooth low energy device detector : check_beacon_presence
   Loaded: loaded (/etc/init.d/check_beacon_presence)
   Active: active (running) since Sun 2016-05-29 17:31:31 CEST; 13min ago
  Process: 1437 ExecStop=/etc/init.d/check_beacon_presence stop (code=exited, status=0/SUCCESS)
  Process: 1484 ExecStart=/etc/init.d/check_beacon_presence start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/check_beacon_presence.service
           └─1491 /usr/bin/python /usr/local/bin/check_beacon_presence.py

May 29 17:31:31 raspberrypi sudo[1518]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/local/bin/hciconfig hci0 down
May 29 17:31:31 raspberrypi sudo[1518]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 29 17:31:31 raspberrypi sudo[1518]: pam_unix(sudo:session): session closed for user root
May 29 17:31:31 raspberrypi sudo[1533]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/local/bin/hciconfig hci0 up
May 29 17:31:31 raspberrypi sudo[1533]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 29 17:31:32 raspberrypi sudo[1533]: pam_unix(sudo:session): session closed for user root
May 29 17:31:32 raspberrypi sudo[1548]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/local/bin/hciconfig
May 29 17:31:32 raspberrypi sudo[1548]: pam_unix(sudo:session): session opened for user root by (uid=0)
May 29 17:31:32 raspberrypi sudo[1548]: pam_unix(sudo:session): session closed for user root
May 29 17:38:46 raspberrypi systemd[1]: Started LSB: This daemon manages the bluetooth low energy device detector : check...esence.
Hint: Some lines were ellipsized, use -l to show in full.
[email protected]:/home/pi# 
Opening the log I get nothing

This is part of the check_beacon_presence.py

Code: Select all

#
# Configure your Beacons in the TAG_DATA table with : [Name,MacAddress,Timeout,0,idx,mode]
# Name : the name of the uservariable used in Domoticz
# macAddress : case insensitive
# Timeout is in secondes the elapsed time  without a detetion for switching the beacon AWAY. Ie :if your beacon emits every 3 to 8$
# 0 : used by the script (will keep the time of the last broadcast) 
# idx of the uservariable in Domoticz for this beacon
# mode : SWITCH_MODE = One update per status change / REPEAT_MODE = continuous updating the RSSI every 3 secondes

TAG_DATA = [
            ["Tag_MIC","D3:28:DC:59:B5:3E",15,0,1,SWITCH_MODE],
            ["Tag_VANEZ","F9:26:9F:29:BA:39",15,0,2,SWITCH_MODE]
           ]


import logging

# choose between DEBUG (log every information) or CRITICAL (only error)
logLevel=logging.DEBUG
#logLevel=logging.CRITICAL

logOutFilename='/var/log/check_beacon_presence.log'       # output LOG : File or console (comment this line to console output)
ABSENCE_FREQUENCY=5  # frequency of the test of absence. in seconde. (without detection, switch "AWAY".

Any advice to get this working again?

woody4165
Posts: 412
Joined: Monday 14 March 2016 14:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: How to check presence of Beacon ?

Post by woody4165 » Sunday 29 May 2016 17:50

"active (running)" seems to be ok.

When you launched directly check_beacon_presence.py habe you seen if RSSI was changing or if ibeacon were changing status if you move it outside the range?

micbou
Posts: 88
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou » Sunday 29 May 2016 17:52

woody4165 wrote:"active (running)" seems to be ok.

When you launched directly check_beacon_presence.py habe you seen if RSSI was changing or if ibeacon were changing status if you move it outside the range?
Both have been in AWAY mode since I set them up
Schermafbeelding 2016-05-29 om 17.52.38.png
Schermafbeelding 2016-05-29 om 17.52.38.png (71.2 KiB) Viewed 1358 times

woody4165
Posts: 412
Joined: Monday 14 March 2016 14:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: How to check presence of Beacon ?

Post by woody4165 » Sunday 29 May 2016 17:55

Check the log

Code: Select all

tail /var/log/check_beacon_presence.log

micbou
Posts: 88
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou » Sunday 29 May 2016 18:00

woody4165 wrote:Check the log

Code: Select all

tail /var/log/check_beacon_presence.log
"tail" doesnt work for me. Going in with 'nano' shows an empty file

woody4165
Posts: 412
Joined: Monday 14 March 2016 14:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: How to check presence of Beacon ?

Post by woody4165 » Sunday 29 May 2016 18:03

try the tail command with sudo.

strange that the service says active(running), that is normal when running properly, and nothing is updated.
I may imagine that the configuration in the check_beacon_presence.py is correct...

micbou
Posts: 88
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou » Sunday 29 May 2016 19:19

woody4165 wrote:try the tail command with sudo.

strange that the service says active(running), that is normal when running properly, and nothing is updated.
I may imagine that the configuration in the check_beacon_presence.py is correct...
Sudo is giving me

Code: Select all

[email protected]:/home/pi# sudo /var/log/check_beacon_presence.log
sudo: /var/log/check_beacon_presence.log: command not found
[email protected]:/home/pi# 
triple checked the config file and everything seems to be correct

woody4165
Posts: 412
Joined: Monday 14 March 2016 14:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: How to check presence of Beacon ?

Post by woody4165 » Sunday 29 May 2016 19:47

Should be sudo tail /var/log/check_beacon_presence.log

jmleglise
Posts: 192
Joined: Tuesday 13 January 2015 0:27
Target OS: Raspberry Pi
Domoticz version: V3.5113
Location: FRANCE
Contact:

Re: How to check presence of Beacon ?

Post by jmleglise » Sunday 29 May 2016 19:56

in "switch_mode", you will not get the RSSI. only AWAY or HOME.

always check what is running with
ps -ef |grep python
Maybe you are running several instances of the script ...
Raspberry Pi2 + RFXTRX433E + KMTronic USB relay card
Blinds Somfy RTS, Blinds Bubendorff, Portal Somfy Evolvia 400, IP Video Doorbell ATZ-DBV01P, chacon IO, Oregon THN132ES, THN122N, Chinese PIR sensor PT2262, Bluetooth low energy dongle, iBeacon

micbou
Posts: 88
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou » Sunday 29 May 2016 20:07

jmleglise wrote:in "switch_mode", you will not get the RSSI. only AWAY or HOME.

always check what is running with
ps -ef |grep python
Maybe you are running several instances of the script ...

ah, I think you're right.. how to I stop the extra 2?

Code: Select all

[email protected]:~$ ps -ef |grep python
root      1094     1  0 17:21 ?        00:00:00 sudo python /usr/local/bin/check_beacon_presence.py
root      1101  1094  0 17:21 ?        00:00:08 python /usr/local/bin/check_beacon_presence.py
root      1491     1  0 17:31 ?        00:00:07 /usr/bin/python /usr/local/bin/check_beacon_presence.py
pi        6749  6680  0 20:06 pts/1    00:00:00 grep python

woody4165
Posts: 412
Joined: Monday 14 March 2016 14:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: How to check presence of Beacon ?

Post by woody4165 » Sunday 29 May 2016 20:29

You can do it with the first three with the kill command using the PIDs

micbou
Posts: 88
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou » Sunday 29 May 2016 21:26

Tnx. Everything is running except for the autorun script after reboot.

jmleglise
Posts: 192
Joined: Tuesday 13 January 2015 0:27
Target OS: Raspberry Pi
Domoticz version: V3.5113
Location: FRANCE
Contact:

Re: How to check presence of Beacon ?

Post by jmleglise » Sunday 29 May 2016 22:59

Hi,

I read that you are interested in Multiroom. It's possible with my script too. Here is how :

Install my script on a RaspberryPi in each room. They will detect the beacons and send their data to 1 domoticz.

- On Domoticz , create a uservariable for each beacon for each room. (Example : for 2 beacons and 2 rooms = 4 variables : Tag_Orange_livingroom, Tag_Green_livingroom, Tag_Orange_bedroom, Tag_Green_bedroom)

- On each RPi in each room, execute my script to get the Signal strength of all beacons in this room :
Example on the RPi in the livingroom :
TAG_DATA = [
["Tag_Orange_livingroom","Fb:14:78:38:18:5e",15,0,idx1,REPEAT_MODE],
["Tag_Green_livingroom","ff:ff:60:00:22:ae",15,0,idx2,REPEAT_MODE]
]

Example on the RPi in the bedroom :
TAG_DATA = [
["Tag_Orange_bedroom","Fb:14:78:38:18:5e",15,0,idx3,REPEAT_MODE],
["Tag_Green_bedroom","ff:ff:60:00:22:ae",15,0,idx4,REPEAT_MODE]
]

That's it. You have a multiroom system... The beacon is in the room that has the biggest Signal Strength.
Example : Compare the value of Tag_Orange_livingroom and Tag_Orange_bedroom

If you are rich, with a lot of beacons and a lot rooms and a lot of RPis :lol: So you will have to create a lot of uservariable (Like 10x10 :? ) . In this case, you may try to automatize the creation (with domoticz's API) and the use. Use beacon name with a pattern like Tag_1_1 (tag num 1 room 1).
Raspberry Pi2 + RFXTRX433E + KMTronic USB relay card
Blinds Somfy RTS, Blinds Bubendorff, Portal Somfy Evolvia 400, IP Video Doorbell ATZ-DBV01P, chacon IO, Oregon THN132ES, THN122N, Chinese PIR sensor PT2262, Bluetooth low energy dongle, iBeacon

joshimosh
Posts: 97
Joined: Friday 29 May 2015 7:03
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by joshimosh » Monday 13 June 2016 6:47

Thank you for this script - works like charm with my El Cheapo BLE Tag.
This tag has a button, which (from the description) can be not only used to switch the tag on and off, but in combination with an app can be paired with a mobile used as a remote to make pictures. So I guess that some blutooth message is sent every time the button is pressed.
I would like to make use of that to start an action in Domoticz. Any idea how to check that the button has been pressed ?

Thank you.
Cheers Josh

paulD
Posts: 18
Joined: Wednesday 20 January 2016 15:46
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by paulD » Monday 13 June 2016 13:49

Hi joshimosh,

what tag do you use ? Can you post a link ?

I'am looking a cheap one.


Thank you,

joshimosh
Posts: 97
Joined: Friday 29 May 2015 7:03
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by joshimosh » Monday 13 June 2016 16:42

Hi paulD,
I've got a couple of those:

http://www.aliexpress.com/item/NEW-1pcs ... 39b73c957a

Cost me 1,52€ at the time I have ordered. In the meantime the Euro went up against USD :-)

Cheers
Josh

Raspberry Piet
Posts: 459
Joined: Saturday 11 January 2014 17:21
Target OS: Raspberry Pi
Domoticz version: Beta
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by Raspberry Piet » Monday 13 June 2016 20:24

joshimosh wrote:Hi paulD,
I've got a couple of those:

http://www.aliexpress.com/item/NEW-1pcs ... 39b73c957a

Cost me 1,52€ at the time I have ordered. In the meantime the Euro went up against USD :-)

Cheers
Josh

Doesn't these BLE-tags power themselves off when there is no connection? (I think these tags were mentioned before in this thread and/or in the wiki)

joshimosh
Posts: 97
Joined: Friday 29 May 2015 7:03
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by joshimosh » Tuesday 14 June 2016 6:49

Raspberry Piet wrote:
joshimosh wrote:Hi paulD,
I've got a couple of those:

http://www.aliexpress.com/item/NEW-1pcs ... 39b73c957a

Cost me 1,52€ at the time I have ordered. In the meantime the Euro went up against USD :-)

Cheers
Josh

Doesn't these BLE-tags power themselves off when there is no connection? (I think these tags were mentioned before in this thread and/or in the wiki)
I have one of them running for a couple of days. The tiny blue LED keeps blinking ...

Raspberry Piet
Posts: 459
Joined: Saturday 11 January 2014 17:21
Target OS: Raspberry Pi
Domoticz version: Beta
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by Raspberry Piet » Tuesday 14 June 2016 7:26

joshimosh wrote:
Raspberry Piet wrote:
joshimosh wrote:Hi paulD,
I've got a couple of those:

http://www.aliexpress.com/item/NEW-1pcs ... 39b73c957a

Cost me 1,52€ at the time I have ordered. In the meantime the Euro went up against USD :-)

Cheers
Josh

Doesn't these BLE-tags power themselves off when there is no connection? (I think these tags were mentioned before in this thread and/or in the wiki)
I have one of them running for a couple of days. The tiny blue LED keeps blinking ...
Ok, thanks. I ordered one to try. :)

edit: This MLE-15 BLE tag arrived. It is powering itself off :( after a short time when not connect to an app. This makes it useless.
Last edited by Raspberry Piet on Wednesday 29 June 2016 22:37, edited 1 time in total.

jnoel68
Posts: 11
Joined: Tuesday 14 June 2016 15:44
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by jnoel68 » Tuesday 14 June 2016 15:56

Hi,

Does anybody have an idea how to setup the same on Synology ?
I've bought a Bluetooth adapter, which is perfectly recognized by the Synology.
I've bought Chipolo beacons.
How can I setup bluez on my Synology to automatically update my beacons status in domoticz ?

Thx in advance,
Jerome

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests