Beetle-II / lumi

MQTT агент для шлюза Xiaomi DGNWG05LM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bluetooth_hci_socket.node symbol not found

developer2503 opened this issue · comments

When I run node /opt/lumi/lumi.js process I get the following error
`internal/modules/cjs/loader.js:1131
return process.dlopen(module, path.toNamespacedPath(filename));
^

Error: Error relocating /opt/lumi/node_modules/@abandonware/bluetooth-hci-socket/lib/binding/bluetooth_hci_socket.node: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE: symbol not found
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1131:18)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object. (/opt/lumi/node_modules/@abandonware/bluetooth-hci-socket/lib/native.js:7:17)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
`

I have the same error

I have the same error!

me too. I have some error on new version of openwrt ( 21.02.0, 21.02.0--dgnwg05lm)

Такая же проблема на 21.02.0--dgnwg05lm

same error (openwrt ( 21.02.0, 21.02.0--dgnwg05lm))

same error (openwrt ( 21.02.0, 21.02.0--dgnwg05lm)).
And the end is:
code: 'ERR_DLOPEN_FAILED'

Does somebody have solution already?

I ran into the same problem as well.
It seems that there's a problem with the BLE package binaries for nodejs.

Try this:

  • SSH to your gateway device
  • Backup your config.json file to your home directory
    cp /opt/lumi/config.json ~
  • For safety, rename the lumi folder to lumi.bak
    mv /opt/lumi /opt/lumi.bak
  • Force Reinstall lumi package from the repository
    opkg install --force-reinstall node-lumi
  • Copy your backed up config file to the new installation
    cp ~/config.json /opt/lumi/
  • You should now be able to run the app. Test by issuing the following command:
    node /opt/lumi/lumi.js
  • You can now safely delete the directory lumi.bak to save some space

It worked for me and I hope it works for you all as well :)

**Note: I'm not using BLE and I didn't test if it functions, I only know that no more missing sybol errors appear

It looks like it's working. I got this:

root@OpenWrt:~# node /opt/lumi/lumi.js
 mqtt_client.connect
 0 click detected
 mqtt_client.subscribe

Now i will test BLE, but still don't know what to do :) Thanks

Because my gateway do not have Bluetooth module, I cut (commented) from lumi.js some rows:
const mqtt = require('./mqtt_client');
//const ble = require('./ble');

if (common.config.sound_volume != 0) {
gateway.setVolume(common.config.sound_volume);
}

// .................. ............ 1
setInterval(() => {
gateway.getIlluminance(common.config.sensor_treshhold);
}, 1 * 1000);

// .................. ............ 2 ...... .................... .................. ................
let timer_ID = setTimeout( function tick() {
common.myLog('timer 2', common.colors.cyan);

// .................... .................. ..................
gateway.getState();

// if (common.config.use_ble) {
// ble.getDevices();
// }

timer_ID = setTimeout(tick, common.config.sensor_debounce_period * 1000);

}, common.config.sensor_debounce_period * 1000);
~

And program start without problems:
signal: null,
output: [
null,
Buffer(0) [Uint8Array] [],
Buffer(30) [Uint8Array] [
77, 80, 68, 32, 101, 114, 114,
111, 114, 58, 32, 67, 111, 110,
110, 101, 99, 116, 105, 111, 110,
32, 114, 101, 102, 117, 115, 101,
100, 10
]
],
pid: 6415,
stdout: Buffer(0) [Uint8Array] [],
stderr: Buffer(30) [Uint8Array] [
77, 80, 68, 32, 101, 114, 114,
111, 114, 58, 32, 67, 111, 110,
110, 101, 99, 116, 105, 111, 110,
32, 114, 101, 102, 117, 115, 101,
100, 10
]
}

@Saddamko thanx commenting out the //const ble = require('./ble'); helped