sputnikdev / eclipse-smarthome-bluetooth-binding

Eclipse SmartHome Bluetooth Binding
46 stars 10 forks source link

Problem with multiple characteristic with same/similar UUID #87

Open tomasz-kos opened 4 years ago

tomasz-kos commented 4 years ago

I'm using Silicon Labs Thunderboard Sense - to evaluate development of BLE device and using BLE with OpenHab. Default application provide a lot of senor characteristic some with standard UUID some with non-standard. I started with parsing strategy "Recognised Only" First problem I got was error because of the duplicate characteristic with this same UUID - for service Automation IO(0x1815) in app they ware 2 characteristic Digital(0x2A56). According bluetooth standard it is correct - 2 android application correctly handle that situation. So I changed firmware and removed 1 characteristic - from that point rest of standard UUID was discovered and parameters as temperature, humidity, pressure were displayed correctly. But I think multiple characteristic with same UUID should be correctly handled.

So my next step was to try see binary data for non-standard characteristic - I switched parsing strategy to "Recognised + System + .. + unrecognised as binary". And I got again problem with duplicating channels.

2019-08-07 18:34:51.703 [vent.ItemStateChangedEvent] - ThunderSense21404_Temperature changed from 28.64 to 28.16 ==> /var/log/openhab2/openhab.log <== 2019-08-07 18:34:51.704 [ERROR] [ager.impl.CombinedDeviceGovernorImpl] - Execution error of a authenticated listener java.lang.IllegalArgumentException: Duplicate channels bluetooth:ble:000B57BE539C:F598DBC5-F598DBC5 at org.eclipse.smarthome.core.thing.util.ThingHelper.ensureUniqueChannels(ThingHelper.java:159) ~[?:?] at org.eclipse.smarthome.core.thing.util.ThingHelper.ensureUniqueChannels(ThingHelper.java:151) ~[?:?] at org.eclipse.smarthome.core.thing.util.ThingHelper.ensureUniqueChannels(ThingHelper.java:147) ~[?:?] at org.eclipse.smarthome.core.thing.binding.builder.ThingBuilder.withChannel(ThingBuilder.java:74) ~[?:?] at org.sputnikdev.esh.binding.bluetooth.handler.BluetoothHandler.lambda$updateThingWithChannels$9(BluetoothHandler.java:193) ~[?:?] at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:?] at org.sputnikdev.esh.binding.bluetooth.handler.BluetoothHandler.updateThingWithChannels(BluetoothHandler.java:189) ~[?:?] at org.sputnikdev.esh.binding.bluetooth.handler.BluetoothDeviceHandler.buildChannels(BluetoothDeviceHandler.java:213) ~[?:?] at org.sputnikdev.esh.binding.bluetooth.handler.BluetoothDeviceHandler.authenticated(BluetoothDeviceHandler.java:137) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerUtils.lambda$forEachSilently$2(BluetoothManagerUtils.java:71) ~[?:?] at java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:891) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerUtils.forEachSilently(BluetoothManagerUtils.java:69) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerUtils.forEachSilently(BluetoothManagerUtils.java:56) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.CombinedDeviceGovernorImpl$DeviceGovernorHandler.lambda$authenticated$6(CombinedDeviceGovernorImpl.java:759) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.ConcurrentBitMap.lambda$handleNotifications$2(ConcurrentBitMap.java:152) ~[?:?] at java.util.Collection.removeIf(Collection.java:414) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.ConcurrentBitMap.handleNotifications(ConcurrentBitMap.java:151) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.ConcurrentBitMap.exclusiveSet(ConcurrentBitMap.java:122) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.ConcurrentBitMap.exclusiveSet(ConcurrentBitMap.java:72) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.CombinedDeviceGovernorImpl$DeviceGovernorHandler.authenticated(CombinedDeviceGovernorImpl.java:758) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerUtils.lambda$forEachSilently$2(BluetoothManagerUtils.java:71) ~[?:?] at java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:891) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerUtils.forEachSilently(BluetoothManagerUtils.java:69) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.BluetoothManagerUtils.forEachSilently(BluetoothManagerUtils.java:56) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.DeviceGovernorImpl.authenticate(DeviceGovernorImpl.java:836) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.DeviceGovernorImpl.access$800(DeviceGovernorImpl.java:63) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.DeviceGovernorImpl$ServicesResolvedNotification.notify(DeviceGovernorImpl.java:817) ~[?:?] at org.sputnikdev.bluetooth.manager.impl.DeviceGovernorImpl$ServicesResolvedNotification.notify(DeviceGovernorImpl.java:807) ~[?:?] at org.sputnikdev.bluetooth.manager.transport.tinyb.TinyBDevice.lambda$null$6(TinyBDevice.java:203) ~[?:?] at org.sputnikdev.bluetooth.manager.transport.tinyb.TinyBFactory.lambda$notifySafely$0(TinyBFactory.java:237) ~[?:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?] at java.lang.Thread.run(Thread.java:748) [?:?] 2019-08-07 18:34:51.840 [DEBUG] [ooth.manager.impl.DeviceGovernorImpl] - Updating device governor characteristics: /00:1A:7D:DA:71:13/00:0B:57:BE:53:9C

None of previously working characteristic is displayed. Learned from past I checked if I don't have multiple same 128 bits UUID, but no. There are 4 128-bit UUIDs with "F598DBC5" - but they are different. 0x7f, 0x95, 0x4f, 0xaa, 0xd1, 0xb3, 0x36, 0x99, 0xc5, 0x4e, 0x00, 0x2f, 0xc5, 0xdb, 0x98, 0xf5, 0x7f, 0x95, 0x4f, 0xaa, 0xd1, 0xb3, 0x36, 0x99, 0xc5, 0x4e, 0x01, 0x2f, 0xc5, 0xdb, 0x98, 0xf5, 0x7f, 0x95, 0x4f, 0xaa, 0xd1, 0xb3, 0x36, 0x99, 0xc5, 0x4e, 0x02, 0x2f, 0xc5, 0xdb, 0x98, 0xf5, 0x7f, 0x95, 0x4f, 0xaa, 0xd1, 0xb3, 0x36, 0x99, 0xc5, 0x4e, 0x03, 0x2f, 0xc5, 0xdb, 0x98, 0xf5, Could you check where is a problem? I'm not using custom GATT files.

My setup OH2.4, BlueZ 5.47, Binding 1.1.6 tinyb 1.1.3