I'm a little confused on how I would interact with a bluetooth device on my Raspberry Pi 4. I have a four probe cooking thermometer that I'd like to read tempatures from and then make a web interface and save my data points. Before I even begin to read data or choose a language I thought I'd try to pair the device with my pi 4.
I've tried the following
sudo bluetoothctl
discoverable on
pairable on
agent on
default-agent
scan on
pair CD:89:7A:45:32:FB
Attempting to pair with CD:89:7A:45:32:FB
[CHG] Device CD:89:7A:45:32:FB Connected: yes
Failed to pair: org.bluez.Error.AuthenticationFailed
I can pair the device to my Windows laptop and my Android phone without issue. Neither required a pin or any other authentication.
I did try to "connect" to the device from my Pi with the following results
[bluetooth]# connect CD:89:7A:45:32:FB
Attempting to connect to CD:89:7A:45:32:FB
[CHG] Device CD:89:7A:45:32:FB Connected: yes
Connection successful
[bluetooth]# trust CD:89:7A:45:32:FB
Changing CD:89:7A:45:32:FB trust succeeded
[bluetooth]# pair CD:89:7A:45:32:FB
Attempting to pair with CD:89:7A:45:32:FB
[CHG] Device CD:89:7A:45:32:FB Connected: yes
Failed to pair: org.bluez.Error.AuthenticationFailed
[CHG] Device CD:89:7A:45:32:FB Connected: no
After connecting to the device I tried to monitor hci0 with no success
$ sudo rfcomm watch hci0
Can't bind RFCOMM socket: Address already in use
So I guess I have two questions
- How do I successfully pair my pi 4 over bluetooth to this device?
- After I pair it, is there any quick and dirty ways to read values from it at the terminal to verify it's working?
tyia
Updated with the output of list-atributes
nRF Connect shows this device as a BLE device
Primary Service
/org/bluez/hci0/dev_CD_89_7A_45_32_FB/service000a
00001801-0000-1000-8000-00805f9b34fb
Generic Attribute Profile
Primary Service
/org/bluez/hci0/dev_CD_89_7A_45_32_FB/service000b
0000fe59-0000-1000-8000-00805f9b34fb
Nordic Semiconductor ASA
Characteristic
/org/bluez/hci0/dev_CD_89_7A_45_32_FB/service000b/char000c
8ec90003-f315-4f60-9fb8-838830daea50
Vendor specific
Descriptor
/org/bluez/hci0/dev_CD_89_7A_45_32_FB/service000b/char000c/desc000e
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
Primary Service
/org/bluez/hci0/dev_CD_89_7A_45_32_FB/service000f
1086fff0-3343-4817-8bb2-b32206336ce8
Vendor specific
Characteristic
/org/bluez/hci0/dev_CD_89_7A_45_32_FB/service000f/char0010
1086fff1-3343-4817-8bb2-b32206336ce8
Vendor specific
Characteristic
/org/bluez/hci0/dev_CD_89_7A_45_32_FB/service000f/char0012
1086fff2-3343-4817-8bb2-b32206336ce8
Vendor specific
Descriptor
/org/bluez/hci0/dev_CD_89_7A_45_32_FB/service000f/char0012/desc0014
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
Another edit, I think I'm nearly there:
var deviceGUID = 'CD:89:7A:45:32:FB'
var primaryServiceGUID = '1086fff0-3343-4817-8bb2-b32206336ce8'
var characteristicGUID = '1086fff1-3343-4817-8bb2-b32206336ce8'
async function start() {
const {createBluetooth} = require('node-ble')
const {bluetooth, destroy} = createBluetooth()
const adapter = await bluetooth.defaultAdapter()
console.log('Connecting')
const device = await adapter.waitDevice(deviceGUID)
await device.connect()
const gattServer = await device.gatt()
console.log('Services')
console.log(gattServer.services())
const service1 = await gattServer.getPrimaryService(primaryServiceGUID)
console.log(service1)
const characteristic1 = await service1.getCharacteristic(characteristicGUID)
const buffer = await characteristic1.readValue()
console.log('Buffer:')
console.log(buffer)
}
start()