renebohne / nodetriones

control bluetooth LED controllers with node.js
MIT License
9 stars 1 forks source link

how to find out the device id ? #1

Open v0r73x opened 4 years ago

v0r73x commented 4 years ago

Hi Rene,

I like to give your js a try to use it with some garden lights which i gathered very cheap ;) They are discovable by bluetooth Triones-FFFF80XXXXXX. i already get them work by tracking the information from happylight driven device an make a bluetooth sniffing on - I gathered the needed codes for on and off .

i tried it with gattol and can switch them on and off by Rpi CLI command.

But i would like to bind this bluetooth devices on a raspberryPi and use them in homebridge by controlling colors and on/off state. Your *.js might be the solution for my project but I don't be sure how to get such ID you mentioned for config in index.js

Is there a way how to gather this id ? If yes how? (my uuid is in another format and i am not a bluetooth tekki ;)

will be great if you can write how to get this id.

thanks and best regards from Berlin,

Rob3rt

Davey-Dev commented 3 years ago

For me the device id ended up just being the characters that came after "Triones-" in the name of the device. For my device it was called "Triones-A20100011708" and the device id ended up being "a20100011708"

Hope that helps!

renebohne commented 3 years ago

sorry, I totally missed this issue. I hope that the answer from Pizzachamp does help.

v0r73x commented 3 years ago

Hi Both,

thanks for your replys :)

I still countered with errors. Will be creat if you can let me know what is wrong in my doings.

usb@1.6.3 install /home/pi/nodetriones/node_modules/usb prebuild-install --verbose || node-gyp rebuild

prebuild-install info begin Prebuild-install version 5.3.6 prebuild-install info looking for cached prebuild @ /root/.npm/_prebuilds/470134-usb-v1.6.3-node-v72-linux-arm.tar.gz prebuild-install http request GET https://github.com/tessel/node-usb/releases/download/v1.6.3/usb-v1.6.3-node-v72-linux-arm.tar.gz prebuild-install http 404 https://github.com/tessel/node-usb/releases/download/v1.6.3/usb-v1.6.3-node-v72-linux-arm.tar.gz prebuild-install WARN install No prebuilt binaries found (target=12.14.0 runtime=node arch=arm libc= platform=linux)

/root/.cache/node-gyp/12.14.0/include/node/v8.h:10004:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo::Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} to ‘Callback’ {aka ‘void ()(const v8::WeakCallbackInfo&)’} [-Wcast-function-type] make: *** [binding.target.mk:107: Release/obj.target/binding/src/BluetoothHciSocket.o] Fehler 1 make: Verzeichnis „/home/pi/nodetriones/node_modules/bluetooth-hci-socket/build“ wird verlassen gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:210:5) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) gyp ERR! System Linux 5.4.72-v7l+ gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/pi/nodetriones/node_modules/bluetooth-hci-socket gyp ERR! node -v v12.14.0 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok npm WARN nodetriones@1.0.0 No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: xpc-connection@0.1.4 (node_modules/xpc-connection): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for xpc-connection@0.1.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bluetooth-hci-socket@0.5.1 (node_modules/bluetooth-hci-socket): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bluetooth-hci-socket@0.5.1 install: node-gyp rebuild npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

v0r73x commented 3 years ago

ok I am a little bit further now - i used

const noble = require('@abandonware/noble');

in the index.js because of using node v12+

now, I can run the code by:

sudo node index.js

but it brings me nothing. I tried to enter some HEX i found in protocols but i see nothing responds. Can you just put in a short way how to use it ?

many thanks !

gtsatsis commented 3 years ago

First off, sorry for necro-posting, everyone.

Hey @v0r73x,

That means you entered a device id that was not able to be found. Check the app that the vendor you purchased the lights from provided, it should say somewhere Triones#XXXXXXXXXX, where X, should be a device identifier.

Please note that the format can vary from vendor to vendor, and it may be Triones-XXXXXXXXXX instead.

After you've gotten the device id, go ahead and put it in the variable, then make sure the app is not running, and/or your device is no-longer linked to the lights (I had to tap on the chain-link icon inside of the app on my phone, for my laptop to pick up the lights).