Skip to content

Switchbot Bot FW v6.6 not being found #237

Closed as not planned
Closed as not planned
@ErdbeerbaerLP

Description

@ErdbeerbaerLP

Analysis

I have recently ordered an switchbot bot and tired to use it using an IOBroker module, which uses this library.
However, it does not seem to be found at all.

After testing with just the library and some code from the readme, expecting it to be found there.
It seems that the issue comes from this library.

The main difference we have found is a different firmware version of the bot. Maybe it is a new revision as well.
So my guess would be that the new revision and/or firmware version is different enough to not be found by this library.

Code I used for testing:

// Load the node-switchbot and get a `Switchbot` constructor object
import('node-switchbot').then(({ SwitchBot }) => {    //Adjusted, as require() was not applicable for me
// Create a `Switchbot` object
const switchbot = new SwitchBot();

// Load the node-switchbot and get a `Switchbot` constructor object


// Start to monitor advertisement packets
switchbot
  .startScan()
  .then(() => {
    // Set an event handler
    switchbot.onadvertisement = (ad) => {
      console.log(JSON.stringify(ad, null, "  "));
    };
    // Wait 10 seconds
    return switchbot.wait(10000);
  })
  .then(() => {
    // Stop to monitor
    switchbot.stopScan();
    process.exit();
  });

}).catch(err => {
    console.error('Error importing node-switchbot:', err);
});

Expected Behavior

  1. Have a bot with firmware version 6.6
  2. Run some code from the Readme
  3. Get a result like this one from the readme
    (sample)
{
  "id": "c12e453e2008",
  "address": "c1:2e:45:3e:20:08",
  "rssi": -61,
  "serviceData": {
    "model": "H",
    "modelName": "WoHand",
    "mode": true,
    "state": false,
    "battery": 100
  }
}

Steps To Reproduce

  1. Have a bot with firmware version 6.6
  2. Run some code from the Readme
  3. ...
  4. Get absolutely no result

Logs

pi@raspi:/opt/iobroker $ sudo hcitool dev
Devices:
        hci0    E8:48:B8:C8:20:00
pi@raspi:/opt/iobroker $ node test.js 
pi@raspi:/opt/iobroker $ node test.js 
pi@raspi:/opt/iobroker $ node test.js 
pi@raspi:/opt/iobroker $ sudo node test.js 
pi@raspi:/opt/iobroker $ sudo node test.js 
pi@raspi:/opt/iobroker $

Configuration

n/a

Environment

Additional Context

Relevant issue (german): mrbungle64/ioBroker.switchbot-ble#431

Metadata

Metadata

Labels

bugSomething isn't workingstale

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions