keyble icon indicating copy to clipboard operation
keyble copied to clipboard

Update 0.1.4 to 0.2.3 or 0.3.2 need help with nodeJS14

Open Diginix opened this issue 2 years ago • 10 comments

Hi Joachim,

seit Jahren nutze ich keyble erfolgreich mit iobroker, aber ohne Adapter, nur per EXEC in Skripten. Vielen Dank schon mal für deine geniale Arbeit!

Nun habe ich mein System von nodeJS 12 auf 14 aktualisiert und seit dem bekam ich bei 9 von 10 keyble Aufrufen folgenden Fehler:

Error: TypeError: Cannot read property 'get_discovered_characteristic' of undefined

Bisher war keyble 0.1.4 installiert. Nun sah ich, dass du bereits bei 0.3.2 bist und habe dies mittels sudo npm install --update --global --unsafe-perm [email protected] installiert. Liegt weiterhin unter /usr/lib/node_modules/keyble/ Anders wollte er die 0.1.4 nicht aktualisieren.

Aber nun funktioniert der Aufruf gar nicht mehr: keyble-sendcommand: command not found bzw. bash: /usr/bin/keyble-sendcommand: No such file or directory

keyble-cli scheint es noch nicht zu geben? Not Found - GET https://registry.npmjs.org/keyble-cli - Not found

Hab nun mal 0.2.3 installiert. Diese wirft aber auch recht oft Fehler:

$ keyble-sendcommand --status_update_time 0 --timeout 40 --address 00:11:22:33:44:55 --user_id 2 --user_key 0815 --command status [ 'Error: ', '' ] TypeError: Cannot read property 'get_discovered_characteristic' of undefined at Key_Ble.ensure_peripheral (/usr/lib/node_modules/keyble/keyble.js:455:52) at async Key_Ble.ensure_connected (/usr/lib/node_modules/keyble/keyble.js:466:3) at async Key_Ble.send_message (/usr/lib/node_modules/keyble/keyble.js:427:4) at async Key_Ble.ensure_nonces_exchanged (/usr/lib/node_modules/keyble/keyble.js:475:3) at async Key_Ble.send_message (/usr/lib/node_modules/keyble/keyble.js:417:4) at async Key_Ble.request_status (/usr/lib/node_modules/keyble/keyble.js:485:3)

oder:

$ keyble-sendcommand --status_update_time 0 --timeout 40 --address 00:11:22:33:44:55 --user_id 2 --user_key 0815 --command status noble warning: unknown handle 256 disconnected! [ 'Error: ', '' ] Error: Unknown Connection Identifier (0x2) at NobleBindings.onLeConnComplete (/usr/lib/node_modules/keyble/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:240:13) at Hci.emit (events.js:400:28) at Hci.processLeConnComplete (/usr/lib/node_modules/keyble/node_modules/@abandonware/noble/lib/hci-socket/hci.js:795:8) at Hci.processLeMetaEvent (/usr/lib/node_modules/keyble/node_modules/@abandonware/noble/lib/hci-socket/hci.js:766:10) at Hci.onSocketData (/usr/lib/node_modules/keyble/node_modules/@abandonware/noble/lib/hci-socket/hci.js:596:12) at BluetoothHciSocket.emit (events.js:400:28)

Alle 7-8 Versuche bekomme ich dann den Status. Prinzipiell funktioniert keyble 0.1.4 oder 0.2.3 weiterhin. Aber unter nodeJS 12 lief 1/10 der Kommandos schief (timeout oder auch noble warning), aber nun sind es eher 9/10.

Was kann ich machen damit es stabiler wird? Und wie kann man die 0.3.2 z.B. mit iobroker javascript exec nutzen?

Proxmox VM mit Ubuntu 20.04.3 LTS nodeJS 14.18.1 (/usr/bin/nodejs) npm 6.14.15 (/usr/bin/npm)

Diginix avatar Nov 23 '21 11:11 Diginix

Same here

TypeError: Cannot read properties of undefined (reading 'get_discovered_characteristic') at Key_Ble.ensure_peripheral (/usr/lib/node_modules/keyble/keyble.js:455:52) at async Key_Ble.ensure_connected (/usr/lib/node_modules/keyble/keyble.js:466:3) at async Key_Ble.send_message (/usr/lib/node_modules/keyble/keyble.js:427:4) at async Key_Ble.ensure_nonces_exchanged (/usr/lib/node_modules/keyble/keyble.js:475:3) at async Key_Ble.pairing_request (/usr/lib/node_modules/keyble/keyble.js:245:3) at async register_user (/usr/lib/node_modules/keyble/register_user.js:43:20) at async register_users_then_exit (/usr/lib/node_modules/keyble/register_user.js:62:4)

JayP666 avatar Dec 03 '21 14:12 JayP666

Good to see that I'm not alone. But sad as well. We can only hope that @oyooyo take notice and can help.

Diginix avatar Dec 03 '21 14:12 Diginix

Sorry, I've recently been quite busy with other things. As I currently do not personally use keyble anyway, I wasn't really motivated to invest time into keyble. But since v14 is the current LTS version and the version that I'm currently using as well, I will try to look into this issue in the near future and release a new version that hopefully works fine with v14.

oyooyo avatar Dec 09 '21 14:12 oyooyo

Thanks for the reply. Hopefully you'll find time and a solution. ;-) Otherwise I will try the esp32 solution which should work for all time independent from my server OS..

Diginix avatar Dec 09 '21 19:12 Diginix

@oyooyo I'm afraid you haven't found the time yet, but would appreciated. Since v14 sometimes it takes over 10 minutes und up to 15 tries to get an answer. I will try a separate Proxmox VM with older nodeJS to see if this helps to become that stable as in the past. If not, maybe I should give the ESP32 fork a chance.

Diginix avatar Mar 26 '22 21:03 Diginix

Would also like to see an update

Trimilur avatar Jul 26 '22 00:07 Trimilur

@Diginix Any progress with your implementation? Have you successfully tested the esp32 fork?

schlagmichdoch avatar Dec 02 '22 15:12 schlagmichdoch

Unfortunately no. I don't have an ESP32 atm and never found out how to flash the fork on it. I have asked in the mikrocontroller forum but never got an answer.

If I had a clear plan what software is necessary for flashing the ESP32 with the keyble fork, I would buy an ESP and try it. Until that I'm continue using keyble with nodejs 16.

Diginix avatar Dec 02 '22 20:12 Diginix

Thanks for the quick answer!

Maybe I'll try the esp32 version next month. As the Raspberry Pi will still be the central control unit receiving the commands my plan is to connect the esp32 wired to the Raspberry Pi. So I'll probably break down the esp32 fork, remove the mqtt stuff and implement some logic to send commands directly to the esp32 via spi or sth similar. Should I keep you updated?

schlagmichdoch avatar Dec 09 '22 12:12 schlagmichdoch

Sure! Ich would also prefer a direct connection of the ESP on my Intel NUC USB Ports. Then the whole logic for disconnecting wifi to be able to connect BT would become obsolete.

Diginix avatar Dec 09 '22 12:12 Diginix