oliexdev / openScale

Open-source weight and body metrics tracker, with support for Bluetooth scales
GNU General Public License v3.0
1.66k stars 290 forks source link

Korehealth Korescale G2 (QN-Scale) #1017

Open Swoodus opened 7 months ago

Swoodus commented 7 months ago

Describe the bug Open scale crashes when connecting to scale

To Reproduce Steps to reproduce the behavior:

  1. Pair Openscale to QN-scale
  2. Enable Bluetooth in Openscale
  3. Openscale crashes

Reproduced with latest dev version: Yes

Expected behavior Openscale should connect to the scale and receive data when weighing occurs

Additional Context Appears to be the same issue encountered by other QN-Scales from other manufacturers

Debug log 2024-01-01 23:50:59.005 Debug [2] AboutPreferences: Debug log enabled, openScale v2.5.2 (64), SDK 31, LGE LM-G850 2024-01-01 23:50:59.013 Debug [2] AboutPreferences: Selected user id(1) name(Art) birthday(Thu Jan 01 23:49:31 EST 2004) age(20) body height(182.88) scale unit(lb) gender(male) initial weight(79.38) goal enabled(false) goal weight(-1.00) goal date(Mon Jan 01 23:49:51 EST 2024) measure unt(in) activity level(2) assisted weighing(false) 2024-01-01 23:51:09.690 Debug [2] MainActivity: Main Activity Bluetooth permission check 2024-01-01 23:51:09.702 Debug [2] MainActivity: SDK >= 31 request for Bluetooth Scan and Bluetooth connect permissions 2024-01-01 23:51:09.708 Debug [2] MainActivity: Permission already granted: android.permission.BLUETOOTH_SCAN 2024-01-01 23:51:09.710 Debug [2] MainActivity: Permission already granted: android.permission.BLUETOOTH_CONNECT 2024-01-01 23:51:09.722 Debug [2] OpenScale: Trying to connect to bluetooth device [D8:0B:CB:58:AA:71] (QN-Scale) 2024-01-01 23:51:09.731 Debug [2] BluetoothCommunication: Do LE scan before connecting to device 2024-01-01 23:51:09.765 Info [2] BluetoothCentralManager: scan started 2024-01-01 23:51:09.768 Debug [2] BluetoothCommunication: Stop machine state 2024-01-01 23:51:09.816 Debug [2] BluetoothCommunication: Found peripheral 'QN-Scale' 2024-01-01 23:51:09.822 Info [2] BluetoothCentralManager: scan stopped 2024-01-01 23:51:10.834 Debug [2] BluetoothCommunication: Try to connect to BLE device D8:0B:CB:58:AA:71 2024-01-01 23:51:10.950 Info [2] BluetoothPeripheral: connect to 'QN-Scale' (D8:0B:CB:58:AA:71) using transport LE 2024-01-01 23:51:10.967 Info [2] BluetoothPeripheral: peripheral 'D8:0B:CB:58:AA:71' is connecting 2024-01-01 23:51:11.174 Info [52] BluetoothPeripheral: connected to 'QN-Scale' (NONE) in 0.2s 2024-01-01 23:51:11.179 Debug [2] BluetoothPeripheral: discovering services of 'QN-Scale' with delay of 0 ms 2024-01-01 23:51:11.673 Debug [52] BluetoothPeripheral: connection parameters: interval=7.5ms latency=0 timeout=5s 2024-01-01 23:51:11.928 Info [52] BluetoothPeripheral: discovered 5 services for 'QN-Scale' 2024-01-01 23:51:11.937 Debug [2] BluetoothCommunication: connected to 'QN-Scale' 2024-01-01 23:51:11.942 Debug [2] BluetoothCommunication: Successful Bluetooth services discovered 2024-01-01 23:51:11.946 Debug [2] BluetoothCommunication: Resume machine state 2024-01-01 23:51:11.948 Debug [2] BluetoothCommunication: Step Nr 0 2024-01-01 23:51:11.963 Debug [2] BluetoothCommunication: Invoke set notification on 0xffe1 2024-01-01 23:51:11.968 Debug [2] BluetoothCommunication: Step Nr 1 2024-01-01 23:51:11.971 Debug [2] BluetoothCommunication: Invoke set indication on 0xffe2 2024-01-01 23:51:11.974 Debug [2] BluetoothCommunication: Step Nr 2 2024-01-01 23:51:11.978 Debug [2] BluetoothCommunication: Invoke write bytes [13 09 15 02 10 00 00 00 43] on 0xffe3 2024-01-01 23:51:12.022 Debug [52] BluetoothPeripheral: connection parameters: interval=45.0ms latency=0 timeout=5s

Error Details Build version: 2.5.2 Build date: 1981-01-01 01:01:02 Current date: 2024-01-01 23:55:15 Device: LGE LM-G850 OS version: Android 12 (SDK 31)

Stack trace:
java.lang.NullPointerException: no valid characteristic provided at j$.util.Objects.requireNonNull(Objects.java:244) at com.welie.blessed.BluetoothPeripheral.writeCharacteristic(BluetoothPeripheral.java:1229) at com.health.openscale.core.bluetooth.BluetoothCommunication.writeBytes(BluetoothCommunication.java:303) at com.health.openscale.core.bluetooth.BluetoothCommunication.writeBytes(BluetoothCommunication.java:291) at com.health.openscale.core.bluetooth.BluetoothQNScale.onNextStep(BluetoothQNScale.java:111) at com.health.openscale.core.bluetooth.BluetoothCommunication.nextMachineStep(BluetoothCommunication.java:610) at com.health.openscale.core.bluetooth.BluetoothCommunication.nextMachineStep(BluetoothCommunication.java:612) at com.health.openscale.core.bluetooth.BluetoothCommunication.nextMachineStep(BluetoothCommunication.java:612) at com.health.openscale.core.bluetooth.BluetoothCommunication.resumeMachineState(BluetoothCommunication.java:210) at com.health.openscale.core.bluetooth.BluetoothCommunication$1.onServicesDiscovered(BluetoothCommunication.java:464) at com.welie.blessed.BluetoothPeripheral$1$1.run(BluetoothPeripheral.java:210) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:8001) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1039)