sputnikdev / eclipse-smarthome-bluetooth-binding

Eclipse SmartHome Bluetooth Binding
46 stars 10 forks source link

Add support for Huawei scales #80

Open vkolotov opened 5 years ago

vkolotov commented 5 years ago

Ok, did a reboot, and now it can stay with ConnectionControl ON.

However, trying to connect to my Huwei AN100/CN100 I get the following:

2019-02-05 20:39:48.036 [vent.ItemStateChangedEvent] - ScaleCH100_Connected changed from OFF to ON
==> /var/log/openhab2/openhab.log <==
2019-02-05 20:39:48.749 [ERROR] [.manager.transport.tinyb.TinyBDevice] - Services resolved notification execution error
java.lang.NullPointerException: null
    at org.sputnikdev.bluetooth.gattparser.spec.BluetoothGattSpecificationReader.validate(BluetoothGattSpecificationReader.java:304) ~[?:?]
    at org.sputnikdev.bluetooth.gattparser.spec.BluetoothGattSpecificationReader.addCharacteristic(BluetoothGattSpecificationReader.java:294) ~[?:?]
    at org.sputnikdev.bluetooth.gattparser.spec.BluetoothGattSpecificationReader.getCharacteristicByUUID(BluetoothGattSpecificationReader.java:131) ~[?:?]
    at org.sputnikdev.bluetooth.gattparser.BluetoothGattParser.isKnownCharacteristic(BluetoothGattParser.java:86) ~[?:?]
    at org.sputnikdev.esh.binding.bluetooth.handler.AutomaticPinCodeAuthProvider.lambda$discoverPinCodeCharacteristic$1(AutomaticPinCodeAuthProvider.java:64) ~[?:?]
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) ~[?:?]

If I connect to the CH100 with the BLE Scanner app I actually see some apparently nice GATT fields, so I was hoping to get it to work i OpenHAB. I am still on Bluez 5.43. Again, any help would be appreciated.

–Jesper

jesperldk commented 5 years ago

I was actually running with GATT parsing strategy "Recognised + System + Unknown + unrecognised as binary" when I got the stack trace. I have tried with "Recognised only" and "All as binary" as well but that gives same stack trace.

vkolotov commented 5 years ago

Ok, what stack trace? Could you please remove your "thing", set "All as binary" and re-add your device from the inbox again?

jesperldk commented 5 years ago

Ok, I removed my thing, set "All as binary" and re-added, and set connection control to ON. The scale connects and then still makes the same stack trace as in the first message in the openhab log, and I get no extra channels. The stack trace starts with BluetoothGattSpecificationReader.validate() as you can see above.

vkolotov commented 5 years ago

Interesting. It tries to perform authentication and fails for some reason. Looks like your scales does not require any authentication, so you could try to disable "auto authentication" here:

image

Disable connection control, wait until it disconnects, and stays disconnected, then disable auth and enable connection control again.

jesperldk commented 5 years ago

sorry, same result: stack trace