Hi @vkolotov. I’ve installed your awesome binding following all the documentation available, made sure that permissions are given, and the bluetooth service is running. I have a Raspberry pi 3B / Raspbian Stretch / OH 2.3 / RPI Internal bluetooth hardware / Bluez 5.47 / TinyB transport environment and I’m just trying to detect presence with a simple beacon (but without actually connecting to it).
I’m using a beacon like this: https://www.beaconzone.co.uk/Sanwo, which is flawlessly seen by both the oficial bluetooth binding and my own android device. However, by installing your binding the device is not recognized. I forced the recognition somewhat by uninstalling and installing the binding and the transport. The device is temporarily recognized and added to the inbox, then I added it as a Thing by using the PaperUI (I haven’t enabled the feature which does this automatically). After this I noticed that the Thing becomes online, but goes offline after some time (30 secs or so). (NOTE: The device/thing is also recognized if I execute bluetoothctl and enable scan. See below.)
By inspecting the log you find entries like this:
2018-12-07 13:39:39.710 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler BluetoothDeviceHandler of thing bluetooth:ble:EC24B830ECD3 tried checking if channel online is linked although the handler was already disposed.
Initially, I was thinking the binding won’t work for my environment, but later found that if I run “sudo -u openhab bluetoothctl” and specify “scan on”, the following happens:
- The device (and also other nearby devices) gets discovered in OH without having warn messages in the log. It also becomes online.
- At the same time that bluetoothctl discovers, changes (e.g. RSSI) or removes the device, these changes are also recognized by OH. [DEL] changes make the device Offline. [NEW] changes make the device Online again.
- bluetoothctl seems to have frequent disconnects ([DEL]/[NEW]) with this device although it is positioned nearly (but this seems to be a separate issue). Disconnects have a frequency of one every 3-5 mins. Is this TinyB instability?
- If I exit from bluetoothctl or if I type “scan off”, the Thing becomes offline again and you don’t receive changes anymore in OH.
NOTE: This is NOT a device-specific issue. if scan is enabled I see that other things/devices are quickly recognized: Other owned devices, a TV from a neighbor :), even bluetooth equipment from the cars passing nearby. If scan is not enabled by using bluetoothctl, the binding just recognizes the Pi’s bluetooth adapter but nothing else.
Then it seems that, for my environment, discovery is not being automatically performed and also it seems that discovery needs to be enabled to perform basic presence recognition. BTW: I see that “Enable background discovery” is enabled in the binding config. Could you tell me If I’m missing something or if this is a bug?
UPDATE: I’m attaching my debug trace. Everything seems to be fine, but the binding apparently does not recognize the device as expected and enters a “Protocol is unknown” infinite cycle. However, this might be just related to the way in which the binding addresses the device. Note that if I execute bluetoothctl and enable the scan, the binding seems to work OK.
Debug trace.txt (28.0 KB)