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.

Moderators: leecollings, remb0

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

Re: How to check presence of Beacon ?

Post by micbou »

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

root@raspberrypi:/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

root@raspberrypi:/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.
root@raspberrypi:/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: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: How to check presence of Beacon ?

Post by woody4165 »

"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?
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
micbou
Posts: 86
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou »

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 3582 times
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: How to check presence of Beacon ?

Post by woody4165 »

Check the log

Code: Select all

tail /var/log/check_beacon_presence.log
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
micbou
Posts: 86
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou »

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: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: How to check presence of Beacon ?

Post by woody4165 »

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...
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
micbou
Posts: 86
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou »

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

root@raspberrypi:/home/pi# sudo /var/log/check_beacon_presence.log
sudo: /var/log/check_beacon_presence.log: command not found
root@raspberrypi:/home/pi# 
triple checked the config file and everything seems to be correct
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: How to check presence of Beacon ?

Post by woody4165 »

Should be sudo tail /var/log/check_beacon_presence.log
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
jmleglise
Posts: 192
Joined: Monday 12 January 2015 23:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: FRANCE
Contact:

Re: How to check presence of Beacon ?

Post by jmleglise »

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 ...
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de maison de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
micbou
Posts: 86
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou »

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

pi@raspberrypi:~$ 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: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Re: How to check presence of Beacon ?

Post by woody4165 »

You can do it with the first three with the kill command using the PIDs
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
micbou
Posts: 86
Joined: Sunday 01 May 2016 0:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by micbou »

Tnx. Everything is running except for the autorun script after reboot.
jmleglise
Posts: 192
Joined: Monday 12 January 2015 23:27
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: FRANCE
Contact:

Re: How to check presence of Beacon ?

Post by jmleglise »

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).
My script : https://github.com/jmleglise
RFXTRX433E: Blind Somfy RTS, Portal Somfy Evolvia, chacon IO, Oregon, PIR sensor PT2262
My Last project : Location de maison de vacances a Ouistreham vue mer
KMTronic USB relay
Chinese Z-WAVE: Neo CoolCam
joshimosh
Posts: 58
Joined: Friday 29 May 2015 7:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by joshimosh »

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: 16
Joined: Wednesday 20 January 2016 14:46
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by paulD »

Hi joshimosh,

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

I'am looking a cheap one.


Thank you,
joshimosh
Posts: 58
Joined: Friday 29 May 2015 7:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by joshimosh »

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: 158
Joined: Saturday 11 January 2014 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by Raspberry Piet »

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: 58
Joined: Friday 29 May 2015 7:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: How to check presence of Beacon ?

Post by joshimosh »

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: 158
Joined: Saturday 11 January 2014 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: How to check presence of Beacon ?

Post by Raspberry Piet »

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: 12
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 »

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: No registered users and 1 guest