homebridge-switchbot: Support Request: Bot: wasn't able to establish BLE Connection, ending in endless loop

Describe Your Problem

Bot: wasn’t able to establish BLE Connection, ending in endless loop

Hi,

Please support me to get my configuration running. I am trying to connect a “Bot” via BLE but it seems the connection cannot be established. See the attached logs for the resulting error. The homebridge keeps on restarting until I e.g. change the “ble” to false. Though I don’t have a HUB present, hence I planned to use the BLE connection.

Relevant log output

[24.1.2022, 19:23:05] [Config] Initializing config platform...
[24.1.2022, 19:23:05] [Config] Running in Service Mode
[24.1.2022, 19:23:09] [SwitchBot] Initializing SwitchBot platform...
[24.1.2022, 19:23:09] [SwitchBot] Using Config Logging: debug
[24.1.2022, 19:23:09] [SwitchBot] [DEBUG] Finished initializing platform:
[24.1.2022, 19:23:09] [SwitchBot] Platform Config: {"logging":"debug"}
[24.1.2022, 19:23:09] [SwitchBot] Using Default Push Rate.
[24.1.2022, 19:23:09] [SwitchBot] [DEBUG] Using Default Refresh Rate (2 minutes).
[24.1.2022, 19:23:09] [SwitchBot] [DEBUG] Config OK
[24.1.2022, 19:23:09] [SwitchBot] Loading accessory from cache: Bot88
[24.1.2022, 19:23:09] [SwitchBot] [DEBUG] Executed didFinishLaunching callback
[24.1.2022, 19:23:10] [SwitchBot] deviceListInfoStatus: {"statusCode":100,"body":{"deviceList":[{"deviceId":"<myDeviceID>","deviceName":"Bot88","deviceType":"Bot","enableCloudService":false,"hubDeviceId":"000000000000"}],"infraredRemoteList":[]},"message":"success"}
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] {"statusCode":100,"body":{"deviceList":[{"deviceId":"<myDeviceID>","deviceName":"Bot88","deviceType":"Bot","enableCloudService":false,"hubDeviceId":"000000000000"}],"infraredRemoteList":[]},"message":"success"}
[24.1.2022, 19:23:10] [SwitchBot] Total SwitchBot Devices Found: 1
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] SwitchBot Device Config Set: [{"deviceId":"<myDeviceID>","configDeviceName":"Bot88","configDeviceType":"Bot","ble":true,"bot":{"mode":"press","deviceType":"switch"}}]
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] SwitchBot Devices: [{"deviceId":"<myDeviceID>","configDeviceName":"Bot88","configDeviceType":"Bot","ble":true,"bot":{"mode":"press","deviceType":"switch"},"deviceName":"Bot88","deviceType":"Bot","enableCloudService":false,"hubDeviceId":"000000000000"}]
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] Discovered Bot: <myDeviceID>
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] Device: Bot88 BLE Connection Enabled
[24.1.2022, 19:23:10] [SwitchBot] Restoring existing accessory from cache: Bot88 DeviceID: <myDeviceID>
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] "press"
[24.1.2022, 19:23:10] [SwitchBot] Total IR Devices Found: 0
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] IR Device Config Not Set: undefined
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] Bot: Bot88 Using Platform Config Logging: debug
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] Bot: Bot88 Using Default scanDuration: 1
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] Bot: Bot88 Using Platform Config refreshRate: 120
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] Bot: Bot88 Using Bot Mode: press
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] Bot: Bot88 Allowing Push Changes: false
[24.1.2022, 19:23:10] [SwitchBot] Bot: Bot88 Config: {"mode":"press","deviceType":"switch","ble":true}
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] Bot: Bot88 BLE refreshStatus
[24.1.2022, 19:23:10] [SwitchBot] Was 'node-switchbot' found: false
[24.1.2022, 19:23:10] [SwitchBot] Bot: Bot88 Displaying as Switch
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] Bot: Bot88 Add Battery Service
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] Bot: Bot88 updateCharacteristic On: false
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] Bot: Bot88 updateCharacteristic BatteryLevel: 100
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] Bot: Bot88 updateCharacteristic StatusLowBattery: 0
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] Bot uuid: <myDeviceID>-Bot, (<myUUID>)
[24.1.2022, 19:23:10] [SwitchBot] [DEBUG] Curtain: Bot88 BLE Address: <myDeviceID>
[24.1.2022, 19:23:10] [SwitchBot] Bot: Bot88 wasn't able to establish BLE Connection: false
[24.1.2022, 19:23:10] TypeError: switchbot.startScan is not a function
    at Bot.BLERefreshStatus (/usr/lib/node_modules/@switchbot/homebridge-switchbot/src/devices/bots.ts:464:8)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Bot.refreshStatus (/usr/lib/node_modules/@switchbot/homebridge-switchbot/src/devices/bots.ts:444:7)
[24.1.2022, 19:23:10] Got SIGTERM, shutting down Homebridge...

Config for homebridge-switchbot

{
            "name": "SwitchBot",
            "credentials": {
                "openToken": "<mytoken>",
                "notice": "Keep your token a secret!"
            },
            "options": {
                "devices": [
                    {
                        "deviceId": "<myDeviceID>",
                        "configDeviceName": "Bot88",
                        "configDeviceType": "Bot",
                        "ble": true,
                        "bot": {
                            "mode": "press",
                            "deviceType": "switch"
                        }
                    }
                ],
                "logging": "debug"
            },
            "platform": "SwitchBot"
}

Screenshots

No response

Device & Model

SwitchBot Bot - firmware v4.9

Node.js Version

v16.13.2

NPM Version

v8.1.2

Homebridge Version

v1.4.0

Homebridge SwitchBot Plugin Version

v1.10.0

Homebridge Config UI X Plugin Version

v4.42.0

Operating System

Raspian

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15

Most upvoted comments

@donavanbecker thank for your ideas here, but also increasing the scanDuration was not successful on my setup. However, I am now thinking to rather put a Switchbot hub in between in order to get a reliable installation and also to expose the bot to Alexa. So I from my perspective this ticket can be closed as being an unresolved mysterious configuration issue…

Thanks!