BLE Presence Detection: problem

Hi.
I have orange pi pc and distro dietpi. Bluetooth CSR v4.0, and a bunch of devices (tags, bracelets) that work on LE. But it is impossible to adjust anything in any way to make it work. I took the instruction (https://home-assistant.io/components/device_tracker.bluetooth_le_tracker/ )
But in the end I get an error
2018-01-25 16:04:58 WARNING (SyncWorker_11) [homeassistant.components.device_tracker.bluetooth_le_tracker] No Bluetooth LE devices to track!
2018-01-25 16:04:58 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform bluetooth_le_tracker
2018-01-25 16:10:33 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting

Env=​/home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/bin/python3

Logs:

(homeassistant-3.6.3) root@DietPi:~# getcap $(eval readlink -f `which python3`)
/home/homeassistant/.pyenv/versions/3.6.3/bin/python3.6 = cap_net_admin,cap_net_raw+eip

and:

(homeassistant-3.6.3) root@DietPi:~# sudo setcap cap_net_raw,cap_net_admin+eip /home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/bin/python3
Failed to set capabilities on file `/home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/bin/python3' (Invalid argument)
The value of the capability argument is not permitted for a file. Or the file is not a regular (non-symlink) file

I’m already confused, what I did, and what to do.
And I apologize for my English, I used an interpreter.
Thank you!

For the third day I am suffering, and I still do not have an answer

I’m hearing this problem a bit, here’s an alternative you might find useful :slight_smile:

Oh, thank you, that’s what you need!
But tell me, where it is better to create this script, and how to call it? I’m using env

If you’re running the script & BLe detection on the same device, I would auto-run the script via /etc/rc.local

The how-to are in the link comments. The script will run on most things debian, and another venv user had no problems.

You certainly won’t break anything by running the script.

Thank you!

1 Like

Oh…

hcitool lescan sees my devices, and HA why it does not, all the time it’s not true. What am I doing wrong?

root@MusicServer:~# sudo python3 bt_le.py
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [31/Jan/2018 21:52:12] "GET /api/search/FF:FF:80:01:75:90 HTTP/1.1" 200 -
127.0.0.1 - - [31/Jan/2018 21:52:15] "GET /api/search/88:0F:10:49:62:77 HTTP/1.1" 200 -
127.0.0.1 - - [31/Jan/2018 21:52:18] "GET /api/search/FF:FF:10:10:D1:52 HTTP/1.1" 200 -

Its ok?

  - platform: rest
    name: Key2
    resource: http://127.0.0.1:5000/api/search/FF:FF:10:10:D1:52
  - platform: rest
    name: test
    resource: http://127.0.0.1:5000/api/search/88:0F:10:49:62:77
  - platform: rest
    name: Keys
    resource: http://127.0.0.1:5000/api/search/FF:FF:80:01:75:90

Here too, no errors were found. In the NA logs there is nothing to worry about.

All looks good, though I have the MAC addresses in lower case - that may be the cause here.

Also if you used phone apps to connect to the tags / bracelets you will need to turn off those apps to free up access so the code can query them.

MAC addresses in lower case :+1::+1::+1:

1 Like