homebridge-switchbot: Bug: wasn't able to establish BLE Connection, node-switchbot: false

Describe The Bug

homebridge-switchbot no longer functions (it used to work!) - shows error “wasn’t able to establish BLE Connection, node-switchbot: false”

To Reproduce

Install

Expected behavior

Switches control bot

Relevant log output

[21/12/2022, 17:27:06] [SwitchBot] [DEBUG] Bot: Gate BLE Address: fb:d6:f8:xx:xx:xx
[21/12/2022, 17:27:06] [SwitchBot] Bot: Gate wasn't able to establish BLE Connection, node-switchbot: false
[21/12/2022, 17:27:06] Homebridge v1.6.0 (HAP v0.11.0) (Adam_Flat) is running on port 51413.
[21/12/2022, 17:29:06] [SwitchBot] [DEBUG] Bot: Gate BLERefreshStatus
[21/12/2022, 17:29:06] [SwitchBot] Was 'node-switchbot' found: false
[21/12/2022, 17:29:06] [SwitchBot] [DEBUG] Bot: Gate BLE Address: fb:d6:f8:xx:xx:xx
[21/12/2022, 17:29:06] [SwitchBot] Bot: Gate wasn't able to establish BLE Connection, node-switchbot: false

I tried removing and re-adding the plugin and have captured some errors visible during the installation:

USER: pi
DIR: /var/lib/homebridge
CMD: npm install --save @switchbot/homebridge-switchbot@2.3.2

(##################) ⠧ reify:googleapis: timing reifyNode:node_modules/@switchbot/home
> @abandonware/bluetooth-hci-socket@0.5.3-9 install
> node-pre-gyp install --fallback-to-build --update-binary

node-pre-gyp ERR! install response status 404 Not Found on https://github.com/abandonware/node-bluetooth-hci-socket/releases/download/0.5.3-9/bluetooth_hci_socket-0.5.3-9-node-v108-linux-arm.tar.gz 
make: Entering directory '/var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/node_modules/@abandonware/bluetooth-hci-socket/build'
  CXX(target) Release/obj.target/bluetooth_hci_socket/src/BluetoothHciSocket.o
In file included from /home/pi/.cache/node-gyp/18.12.1/include/node/node_buffer.h:25,
                 from ../src/BluetoothHciSocket.cpp:7:
/home/pi/.cache/node-gyp/18.12.1/include/node/node.h:976:7: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
  976 |       (node::addon_register_func) (regfunc),                          \
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pi/.cache/node-gyp/18.12.1/include/node/node.h:1010:3: note: in expansion of macro ‘NODE_MODULE_X’
 1010 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
      |   ^~~~~~~~~~~~~
../src/BluetoothHciSocket.cpp:740:1: note: in expansion of macro ‘NODE_MODULE’
  740 | NODE_MODULE(binding, BluetoothHciSocket::Init);
      | ^~~~~~~~~~~
  SOLINK_MODULE(target) Release/obj.target/bluetooth_hci_socket.nodees/@switchbot/home
  COPY Release/bluetooth_hci_socket.node timing reifyNode:node_modules/@switchbot/home
  COPY /var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/node_modules/@abandonware/bluetooth-hci-socket/lib/binding/bluetooth_hci_socket.node
  TOUCH Release/obj.target/action_after_build.stampfyNode:node_modules/@switchbot/home
make: Leaving directory '/var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/node_modules/@abandonware/bluetooth-hci-socket/build'
(##################) ⠋ reify:googleapis: timing reifyNode:node_modules/@switchbot/home
> @abandonware/noble@1.9.2-15 install
> node-gyp rebuild

make: Entering directory '/var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/node_modules/@abandonware/noble/build'
  SOLINK_MODULE(target) Release/obj.target/noble.node
  COPY Release/noble.nodeify:googleapis: timing reifyNode:node_modules/@switchbot/home
make: Leaving directory '/var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/node_modules/@abandonware/noble/build'

> usb@1.9.2 install
> node-gyp-build

make: Entering directory '/var/lib/homebridge/node_modules/@switchbot/homebridge-switchbot/node_modules/usb/build'
  CC(target) Release/obj.target/libusb/libusb/libusb/core.o
(##################) ⠦ reify:googleapis: timing reifyNode:node_modules/@switchbot/home

Config for homebridge-switchbot

{
            "name": "SwitchBot",
            "credentials": {
                "notice": "Keep your Token & Secret a secret!"
            },
            "options": {
                "devices": [
                    {
                        "deviceId": "FBD6F8XXXXXX",
                        "configDeviceName": "Gate",
                        "configDeviceType": "Bot",
                        "connectionType": "BLE",
                        "bot": {
                            "mode": "press",
                            "deviceType": "garagedoor",
                            "doublePress": 1
                        },
                        "logging": "debug"
                    }
                ]
            },
            "platform": "SwitchBot"
        }

Screenshots

No response

Device & Model

SwitchBot bot

Node.js Version

v18.12.1

NPM Version

v8.19.2

Homebridge Version

v1.6.0

Homebridge Switchbot Plugin Version

v2.3.2

Homebridge Config UI X Plugin Version

v4.50.2

Operating System

Raspbian GNU/Linux Bullseye (11)

About this issue

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

Most upvoted comments

Going to close this as my issue is resolved - maybe @alevehemens might want to raise a separate issue if problems continue. Thanks for the resolution!

v2.3.2 has ^1.7.0 of node-switchbot as a dependency, so v1.7.2 gets installed in both cases.