Hello
Just a topic to work on the Bluetooth recognition of my Xiaomi hardware.
I am available for logs (need to remind me of the commands…)
These are the temperature and humidity monitors with display.
Hello
Just a topic to work on the Bluetooth recognition of my Xiaomi hardware.
I am available for logs (need to remind me of the commands…)
These are the temperature and humidity monitors with display.
@AlexTrovato to integrate Bluetooth devices, how should we organize this in your opinion?
The difficulty with Bluetooth is that often each manufacturer uses its own « APIs », few are standard. It would be possible to test on this device… but I think there should be a Bluetooth submenu in Xiaomi to handle the brand’s specific features.
Hello everyone, I’m taking advantage of this post about Bluetooth to ask who developed the Bluetooth service, I’m in a situation where the Bluetooth of my motherboard of my DIY NAS is not supported by this service (« Address family not supported by protocol »), so I would really like to contact them to debug with them ![]()
Hi, it’s me, the culprit. Today we’re using a Node.js library that doesn’t support all Bluetooth connectors, especially on Windows. We can continue this discussion in private to avoid cluttering this conversation.
There’s no pollution, on the contrary, it’s always better when it’s public! It allows everyone to see where each development stands. I encourage you to keep these discussions public ![]()
Are you busy at the moment?
Do you need anything?
@AlexTrovato he needs a day that lasts 48 hours I think ![]()
lol who are you talking to?!
Sorry, but I was on vacation last week, I started back this morning, so my availability is limited.
Do you need something?
For Xiaomi Bluetooth devices? Do you have any? If so, we can sync so you can give me the necessary information for integration.
Otherwise, I’ll check with competitors to see if they already integrate these devices.
As I mentioned earlier, I have 4 temperature and humidity monitors.
They appear in the Bluetooth devices (with two identifiers each, one without characters and one with just the battery) except 1 which must be out of range.
Oh, sorry, I must have misread. Great, let’s organize that then ![]()
We have a great analysis here.
I can develop blindly now, but it remains to be seen how you can test it?
But we’re not dealing with standard Bluetooth, rather with Xiaomi’s proprietary technology.
As you wish, but I’ll tell you that a small program to run would be simpler for me.
I don’t have anything installed on my Mac for Gladys.
Hey @Hamtaro,
first version of this small tool.
For information, it uses the code base of the Bluetooth service of Gladys (in order to keep maximum compatibility).
https://github.com/atrovato/gladys-bluetooth-analyzer
It is of course to be completed over time.
I await your feedback.
For information, the service recognizes Amazfit connected watches.
What does this program do?
Because I launched it on the pi with the user pi.
I installed all the dependencies and now npm install but with my current connection due to confinement and the saturation of Bouygues 4G antennas, it’s slow as molasses…
It seems to be doing a full install of Gladys… I thought it would be a small js program to retrieve bluetooth info.
PS: I didn’t say anything, the download just finished and it’s extracting what it wants.
> usb@1.6.3 install /home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/usb
> prebuild-install --verbose || node-gyp rebuild
prebuild-install info begin Prebuild-install version 5.3.5
prebuild-install info looking for cached prebuild @ /home/pi/.npm/_prebuilds/e00ec3-usb-v1.6.3-node-v64-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-v64-linux-arm.tar.gz
prebuild-install http 404 https://github.com/tessel/node-usb/releases/download/v1.6.3/usb-v1.6.3-node-v64-linux-arm.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=10.21.0 runtime=node arch=arm libc= platform=linux)
make : on entre dans le répertoire « /home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/usb/build »
CC(target) Release/obj.target/libusb/libusb/libusb/core.o
CC(target) Release/obj.target/libusb/libusb/libusb/descriptor.o
CC(target) Release/obj.target/libusb/libusb/libusb/hotplug.o
CC(target) Release/obj.target/libusb/libusb/libusb/io.o
CC(target) Release/obj.target/libusb/libusb/libusb/strerror.o
CC(target) Release/obj.target/libusb/libusb/libusb/sync.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/poll_posix.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/threads_posix.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_usbfs.o
CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_udev.o
../libusb/libusb/os/linux_udev.c:40:10: fatal error: libudev.h: Aucun fichier ou dossier de ce type
#include <libudev.h>
^~~~~~~~~~~
compilation terminated.
make: *** [libusb.target.mk:140: Release/obj.target/libusb/libusb/libusb/os/linux_udev.o] Error 1
make : on quitte le répertoire « /home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/usb/build »
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 5.4.72-v7+
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/usb
gyp ERR! node -v v10.21.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
> @abandonware/bluetooth-hci-socket@0.5.3-5 install /home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/bluetooth-hci-socket
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/abandonware/node-bluetooth-hci-socket/releases/download/0.5.3-5/binding-0.5.3-5-node-v64-linux-arm.tar.gz
node-pre-gyp WARN Pre-built binaries not found for @abandonware/bluetooth-hci-socket@0.5.3-5 and node@10.21.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
make : on entre dans le répertoire « /home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/bluetooth-hci-socket/build »
CXX(target) Release/obj.target/binding/src/BluetoothHciSocket.o
In file included from ../src/BluetoothHciSocket.cpp:8:
../../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
../../../nan/nan.h:2294:62: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
, reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
^
In file included from /usr/include/nodejs/src/node_buffer.h:25,
from ../src/BluetoothHciSocket.cpp:7:
../src/BluetoothHciSocket.cpp: At global scope:
/usr/include/nodejs/src/node.h:573:43: 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]
(node::addon_register_func) (regfunc), \
^
noble warning: adapter state unauthorized, please run as root or with sudo
or see README for information on running without root/sudo:
https://github.com/sandeepmistry/noble#running-on-linux
/home/pi/gladys-bluetooth-analyzer/index.js:23
quit(colors.bold.red('Something went wrong'));
^
TypeError: quit is not a function
at EventEmitter.gladys.event.once (/home/pi/gladys-bluetooth-analyzer/index.js:23:5)
at Object.onceWrapper (events.js:286:20)
at EventEmitter.emit (events.js:198:13)
at BluetoothManager.broadcastStatus (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/lib/events/bluetooth.broadcastStatus.js:11:21)
at BluetoothManager.stateChange (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/lib/events/bluetooth.stateChange.js:21:8)
at Noble.emit (events.js:198:13)
at Noble.onStateChange (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/noble.js:87:8)
at NobleBindings.emit (events.js:198:13)
at NobleBindings.onStateChange (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:121:8)
at Hci.emit (events.js:203:15)
at Hci.onSocketError (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/hci.js:549:10)
at BluetoothHciSocket.emit (events.js:198:13)
at Hci.setEventMask (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/hci.js:165:16)
at Hci.pollIsDevUp (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/hci.js:119:12)
at Hci.init (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/hci.js:103:10)
at NobleBindings.init (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:78:13)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gladys-bluetooth-analyzer@1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gladys-bluetooth-analyzer@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2020-11-16T11_21_34_668Z-debug.log
pi@gladys:~/gladys-bluetooth-analyzer $
logs :
0 info it worked if it ends with ok
1 warn npm npm does not support Node.js v10.21.0
2 warn npm You should probably upgrade to a newer version of node as we
3 warn npm can't make any promises that npm will work with this version.
4 warn npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
5 warn npm You can find the latest version at https://nodejs.org/
6 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
7 info using npm@5.8.0
8 info using node@v10.21.0
9 verbose run-script [ 'prestart', 'start', 'poststart' ]
10 info lifecycle gladys-bluetooth-analyzer@1.0.0~prestart: gladys-bluetooth-analyzer@1.0.0
11 info lifecycle gladys-bluetooth-analyzer@1.0.0~start: gladys-bluetooth-analyzer@1.0.0
12 verbose lifecycle gladys-bluetooth-analyzer@1.0.0~start: unsafe-perm in lifecycle true
13 verbose lifecycle gladys-bluetooth-analyzer@1.0.0~start: PATH: /usr/share/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pi/gladys-bluetooth-analyzer/node_modules/.bin:/usr/local/sbin:/usr/local/bi$
14 verbose lifecycle gladys-bluetooth-analyzer@1.0.0~start: CWD: /home/pi/gladys-bluetooth-analyzer
15 silly lifecycle gladys-bluetooth-analyzer@1.0.0~start: Args: [ '-c', 'node index.js' ]
16 silly lifecycle gladys-bluetooth-analyzer@1.0.0~start: Returned: code: 1 signal: null
17 info lifecycle gladys-bluetooth-analyzer@1.0.0~start: Failed to exec start script
18 verbose stack Error: gladys-bluetooth-analyzer@1.0.0 start: `node index.js`
18 verbose stack Exit status 1
18 verbose stack at EventEmitter.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/index.js:283:16)
18 verbose stack at EventEmitter.emit (events.js:198:13)
18 verbose stack at ChildProcess.<anonymous> (/usr/share/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
18 verbose stack at ChildProcess.emit (events.js:198:13)
18 verbose stack at maybeClose (internal/child_process.js:982:16)
18 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
19 verbose pkgid gladys-bluetooth-analyzer@1.0.0
20 verbose cwd /home/pi/gladys-bluetooth-analyzer
21 verbose Linux 5.4.72-v7+
22 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
23 verbose node v10.21.0
24 verbose npm v5.8.0
25 error code ELIFECYCLE
26 error errno 1
27 error gladys-bluetooth-analyzer@1.0.0 start: `node index.js`
27 error Exit status 1
28 error Failed at the gladys-bluetooth-analyzer@1.0.0 start script.
28 error This is probably not a problem with npm. There is likely additional logging output above.
29 verbose exit [ 1, true ]
Lol ok bug first line… I’ll try my luck again…
But otherwise, you need to give Bluetooth permissions to NPM, which I will add to the readme.
The program will be used to verify that the proposed code will indeed retrieve the data from your Bluetooth device.
It copies a subset of Gladys because I have done a lot of work on Bluetooth, and now that it’s done, I’m not starting over.
I’ll let you know when it’s up to date.
Super, can you try again please? It happens that Bluetooth « struggles » to connect to the device. And you need to make sure the device is not already connected to another one…
You can see that it has successfully connected if in the device parameters you have the manufacturer (or the model).