thingsboard / thingsboard-gateway

Open-source IoT Gateway - integrates devices connected to legacy and third-party systems with ThingsBoard IoT Platform using Modbus, CAN bus, BACnet, BLE, OPC-UA, MQTT, ODBC and REST protocols
https://thingsboard.io/docs/iot-gateway/what-is-iot-gateway/
Apache License 2.0
1.74k stars 844 forks source link

[HELP] Connection issue with BLE Connector #370

Closed krishna194 closed 2 years ago

krishna194 commented 4 years ago

Describe the issue Create description about your issue, and your actions to solve it. I have to send data to things-board-gateway ble connector I'm using BLE sim android application as ble simulator while starting things-board-gateway,I'm unable to establish connection
suggest a solution for this problem Configuration (Attach your configuration file) Notate: Remove Access token from file if you wanna attach tb_gateway.yaml

Connector name (If you need help with some connector/converter): ble connector

Error traceback (If it was raised):

'deviceName'
Traceback (most recent call last):
  File "<input>", line 2, in <module>
KeyError: 'deviceName'

Ble working with only root user

Versions (please complete the following information):

imbeacon commented 4 years ago

Hi @krishna194

Try to use the parameter with name deviceName instead of name in your BLE connector configuration file.

krishna194 commented 4 years ago

ok I have written my device name as same as in BLE configuration file An error occurred while running gateway BLE work only on root command I have given acess to all devices using the command sudo setcap 'cap_net_raw,cap_net_admin+eip' /usr/local/lib/python3.6/dist-packages/bluepy/bluepy-helper But the same error is repeating while restarting thingsboard-gateway ble.txt connector.txt

imbeacon commented 4 years ago

Hi @krishna194

Try please the following config:


{
    "name": "BLE Connector",
    "rescanIntervalSeconds": 100,
    "checkIntervalSeconds": 100,
    "scanTimeSeconds": 5,
    "passiveScanMode": true,
    "devices": [
        {
            "deviceName": "Temperature sensor",
            "MACAddress": "80:58:F8:35:D4:BC",
            "addrType": "public",
            "telemetry": [
                {
                    "key": "Battery",
                    "method": "notify",
                    "characteristicUUID": "00002A00-0000-1000-8000-00805F9B34FB",
                    "byteFrom": 2,
                    "byteTo": 6
                }
            ],
            "attributes": [
                {
                    "key": "Battery",
                    "characteristicUUID": "00002A00-0000-1000-8000-00805F9B34FB",
                    "method": "read",
                    "byteFrom": 0,
                    "byteTo": -1
                }
            ],
            "attributeUpdates": [
                {
                    "attributeOnThingsBoard": "sharedName",
                    "characteristicUUID": "00002A00-0000-1000-8000-00805F9B34FB"
                }
            ],
            "serverSideRpc": [
                {
                    "methodRPC": "rpcMethod1",
                    "withResponse": true,
                    "characteristicUUID": "00002A00-0000-1000-8000-00805F9B34FB",
                    "methodProcessing": "read"
                }
            ]
        }
    ]
}
krishna194 commented 4 years ago

I tried this configuration I have got the error" BLE work only on root command" I tried this command-"sudo setcap 'cap_net_raw,cap_net_admin+eip' /usr/local/lib/python3.6/dist-packages/bluepy/bluepy-helper" But the same error is repeating while restarting thingsboard-gateway connector.txt ble(1).txt

samson0v commented 2 years ago

Hi @krishna194, we are remaking the BLE connector now. We will let you know when it is done.

Thanks for your interest in ThignsBoard IoT Gateway!

samson0v commented 2 years ago

Hi @krishna194, we did a remake of the BLE Connector yesterday, so you can install the new version of Gateway from the master branch and test the connector. Let us know if the new version of BLE Connector fixes your problem.