danielfett / bluebattery.py

6 stars 5 forks source link

bb_cli connection failed #3

Open kscheff opened 3 years ago

kscheff commented 3 years ago

when running bb_cli with the debug flag -vv on then the device does not connect:

pi@raspberrypi:~ $ bb_cli -vv 24:7D:4D:74:65:0B
INFO:root:Log level set to to 10.
INFO:Device 24:7d:4d:74:65:0b:Connection failed

When connecting the device by hand before running bb_cli then it works:

pi@raspberrypi:~ $ sudo hcitool lecc 24:7D:4D:74:65:0B
Connection handle 64
pi@raspberrypi:~ $ bb_cli -vv 24:7D:4D:74:65:0B 
INFO:root:Log level set to to 10.
DEBUG:Device 24:7d:4d:74:65:0b:Services resolved
DEBUG:Device 24:7d:4d:74:65:0b:Not subscribing to 4b616913-40bd-428b-bf06-698e5e422cd9.
DEBUG:Device 24:7d:4d:74:65:0b:Subscribing to 4b616912-40bd-428b-bf06-698e5e422cd9
DEBUG:Device 24:7d:4d:74:65:0b:Not subscribing to 4b616907-40bd-428b-bf06-698e5e422cd9.
DEBUG:Device 24:7d:4d:74:65:0b:Not subscribing to 4b616901-40bd-428b-bf06-698e5e422cd9.
DEBUG:Device 24:7d:4d:74:65:0b:Not subscribing to d6af9b3c-fe92-1cb2-f74b-7afb7de57e6d.
DEBUG:Device 24:7d:4d:74:65:0b:Not subscribing to c3fbc9e2-676b-9fb5-3749-2f471dcf07b2.
DEBUG:Device 24:7d:4d:74:65:0b:Not subscribing to 00002a50-0000-1000-8000-00805f9b34fb.
DEBUG:Device 24:7d:4d:74:65:0b:Not subscribing to 00002a29-0000-1000-8000-00805f9b34fb.
DEBUG:Device 24:7d:4d:74:65:0b:Not subscribing to 00002a26-0000-1000-8000-00805f9b34fb.
DEBUG:Device 24:7d:4d:74:65:0b:Not subscribing to 00002a24-0000-1000-8000-00805f9b34fb.
DEBUG:Device 24:7d:4d:74:65:0b:Not subscribing to 00002a23-0000-1000-8000-00805f9b34fb.
DEBUG:Device 24:7d:4d:74:65:0b:Not subscribing to 00002a05-0000-1000-8000-00805f9b34fb.
DEBUG:Device 24:7d:4d:74:65:0b:Received value for 4b616912-40bd-428b-bf06-698e5e422cd9 (18 bytes)
DEBUG:Commands:Selected index: (0, 7).
Received live/measurement:
               battery_voltage_V | 12.48
          solar_charge_current_A | 0.0
               battery_current_A | -9.305

Subsequent connections will work without using hcitool again, this survives a reboot. Looks like that the GATT table needs to be in the cache before this runs successfully, see bluetoothctl.

danielfett commented 1 year ago

I hope that the new version resolves this problem.