thingsboard-gateway: [HELP] Can't read data with new BLE connector
Describe the issue
After update gateway code from master branch, Gateway does not send any data from BLE device to thingsboard but still sending other data like bleconnectorEventsProduced to server and I can’t find any error in log.
connector.log
""2021-12-18 06:38:59" - |ERROR| - [device.py] - device - connect_to_device - 155 - Device with address 24:0A:C4:A5:7F:7E was not found."
""2021-12-18 06:39:09" - |INFO| - [device.py] - device - run_client - 164 - Connected to M5StackUART device"
""2021-12-18 06:43:11" - |INFO| - [device.py] - device - run_client - 164 - Connected to M5StackUART device "
""2021-12-18 07:13:01" - |INFO| - [device.py] - device - run_client - 164 - Connected to M5StackUART device "
service.log
""2021-12-18 07:12:58" - |INFO| - [tb_gateway_service.py] - tb_gateway_service - __init__ - 78 - Gateway starting..."
""2021-12-18 07:12:58" - |INFO| - [tb_gateway_service.py] - tb_gateway_service - __init__ - 83 - ThingsBoard IoT gateway version: 2.9"
""2021-12-18 07:12:58" - |INFO| - [tb_loader.py] - tb_loader - import_module - 66 - Import BLEConnector from /usr/lib/python3/dist-packages/thingsboard_gateway/connectors/ble."
""2021-12-18 07:12:58" - |INFO| - [tb_gateway_service.py] - tb_gateway_service - __init__ - 153 - Gateway started."
BTW I can read data from BLE device with this code on the same gateway and nRF Connect app still get notify data from device.
import asyncio
from bleak import BleakClient
address = "24:0A:C4:A5:7F:7E"
MODEL_NBR_UUID = "6E400003-B5A3-F393-E0A9-E50E24DCCA9E"
async def main(address):
async with BleakClient(address) as client:
model_number = await client.read_gatt_char(MODEL_NBR_UUID)
print("data: {0}".format("".join(map(chr, model_number))))
asyncio.run(main(address))
>>> data: I
From the config below did I miss some parameter or set something invalid?
About how to update code in gateway, Is copy code from master branch and past in /usr/lib/python3/dist-packages/thingsboard_gateway enough or I miss some step?
Configuration ble.json (read every 1 min)
{
"name": "BLE Connector",
"passiveScanMode": true,
"showMap": false,
"scanner": {
"timeout": 10000,
"deviceName": "Device name"
},
"devices": [
{
"name": "M5StackUART",
"MACAddress": "24:0A:C4:A5:7F:7E",
"pollPeriod": 60000,
"showMap": false,
"timeout": 10000,
"telemetry": [
{
"key": "UART_Tx",
"method": "notify",
"characteristicUUID": "6E400003-B5A3-F393-E0A9-E50E24DCCA9E",
"byteFrom": 0,
"byteTo": -1
}
],
"attributes": [
],
"attributeUpdates": [
],
"serverSideRpc": [
{
"methodRPC": "UART_Rx",
"withResponse": false,
"characteristicUUID": "6E400002-B5A3-F393-E0A9-E50E24DCCA9E",
"methodProcessing": "write"
}
]
}
]
}
Versions (please complete the following information):
- OS: Ubuntu 20.04 LTS 4.14.111
- Thingsboard IoT Gateway version current master (forked)
- Python version : 3.8.10
- bleak 0.13.0
- bluetoothctl: 5.53
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20 (8 by maintainers)
ok