Bluetooth : Xiaomi température/humidité

Salut,

Je viens de tester le module dans Gladys, et mes capteurs d’humidité et température sont pas reconnus.
Une idée de comment je peux avoir plus d’info sur les logs ?

Gladys tourne en version officielle docker pour le moment.

Oui en effet, c’est la tout le sujet de la discussion, n’ayant pas moi meme ce périphérique, je demande de l’aide à ceux qui l’ont et qui sont un peu technique.

J’ai lancé le conteneur avec la variable d’environnement NODE_ENV=dev mais je ne vois pas plus de logs.
C’est normal ?

Autant pour moi, je viens de relire tous les messages et je comprends mieux l’ampleur du problème.
Enfin, plutôt qu’il y a pleins de problèmes.

En soit, j’ai 6 capteurs (un par pièce), je peux t’en envoyer un aider à dev dans de meilleures conditions !
Ça serait un prêt moyenne durée disons :sweat_smile:

Envoies moi ton adresse postale en message et on s’organise ça si ça t’intéresse.

Salut @AlexTrovato,

je voulais aussi debug un peu avec ton logiciel pour inclure mes capteur de temperature aqara bluetooth.
j’ai suivit à la lettre le mode d’installation que tu d’écrits sur github mais quand je lance npm start j’obtiens cette erreur:

 pi@gladys:~/gladys-bluetooth-analyzer $ npm start

> gladys-bluetooth-analyzer@1.0.0 start
> node index.js

node:internal/modules/cjs/loader:928
  throw err;
  ^

Error: Cannot find module '../../gladys/server/services/bluetooth/lib/utils/bluetooth.getCharacteristic'
Require stack:
- /home/pi/gladys-bluetooth-analyzer/services/xiaomi/LYWSD03MMC.js
- /home/pi/gladys-bluetooth-analyzer/services/xiaomi/run.js
- /home/pi/gladys-bluetooth-analyzer/services/xiaomi/index.js
- /home/pi/gladys-bluetooth-analyzer/services/index.js
- /home/pi/gladys-bluetooth-analyzer/steps/serviceSelection.js
- /home/pi/gladys-bluetooth-analyzer/steps/index.js
- /home/pi/gladys-bluetooth-analyzer/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/home/pi/gladys-bluetooth-analyzer/services/xiaomi/LYWSD03MMC.js:1:31)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/home/pi/gladys-bluetooth-analyzer/services/xiaomi/run.js:3:20)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/home/pi/gladys-bluetooth-analyzer/services/xiaomi/index.js:1:17)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/pi/gladys-bluetooth-analyzer/services/xiaomi/LYWSD03MMC.js',
    '/home/pi/gladys-bluetooth-analyzer/services/xiaomi/run.js',
    '/home/pi/gladys-bluetooth-analyzer/services/xiaomi/index.js',
    '/home/pi/gladys-bluetooth-analyzer/services/index.js',
    '/home/pi/gladys-bluetooth-analyzer/steps/serviceSelection.js',
    '/home/pi/gladys-bluetooth-analyzer/steps/index.js',
    '/home/pi/gladys-bluetooth-analyzer/index.js'
  ]
}
npm ERR! code 1
npm ERR! path /home/pi/gladys-bluetooth-analyzer
npm ERR! command failed
npm ERR! command sh -c node index.js

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2020-12-14T21_11_46_098Z-debug.log

les logs du fichier debug :

pi@gladys:~ $ cat /home/pi/.npm/_logs/2020-12-14T21_11_46_098Z-debug.log
0 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
1 info using npm@7.0.15
2 info using node@v15.4.0
3 timing config:load:defaults Completed in 7ms
4 timing config:load:file:/usr/lib/node_modules/npm/npmrc Completed in 8ms
5 timing config:load:builtin Completed in 9ms
6 timing config:load:cli Completed in 7ms
7 timing config:load:env Completed in 1ms
8 timing config:load:file:/home/pi/gladys-bluetooth-analyzer/.npmrc Completed in 0ms
9 timing config:load:project Completed in 3ms
10 timing config:load:file:/home/pi/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/usr/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 1ms
14 timing config:load:cafile Completed in 1ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:setUserAgent Completed in 2ms
17 timing config:load:setEnvs Completed in 4ms
18 timing config:load Completed in 37ms
19 verbose npm-session fadeba8c89d8068d
20 timing npm:load Completed in 73ms
21 timing command:run-script Completed in 848ms
22 timing command:start Completed in 859ms
23 verbose stack Error: command failed
23 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
23 verbose stack     at ChildProcess.emit (node:events:376:20)
23 verbose stack     at maybeClose (node:internal/child_process:1063:16)
23 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:295:5)
24 verbose pkgid gladys-bluetooth-analyzer@1.0.0
25 verbose cwd /home/pi/gladys-bluetooth-analyzer
26 verbose Linux 5.4.51-v7+
27 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
28 verbose node v15.4.0
29 verbose npm  v7.0.15
30 error code 1
31 error path /home/pi/gladys-bluetooth-analyzer
32 error command failed
33 error command sh -c node index.js
34 verbose exit 1

Merci

En effet, il y a eu un petit refacto sur le service Bluetooth, je viens de mettre à jour le code de l’utilitaire, il démarre désormais.

1 « J'aime »

On dirait que tout a fonctionné non ? J’ai
laissé les valeurs de choix par défaut

✔ This tools is used to test your Bluetooth device with Gladys, do you want to continue? … yes
✔ Select the service you want to test › Generic
✔ Next step is scanning for Bluetooth devices, continue? … yes
✔ Select device you want to analyse: › 58:2d:34:36:30:69
 -> Device:
    - Name: 58:2d:34:36:30:69
    - Model: Duck_Release
    - 1 features
      - battery / integer
    - 2 params
      - loaded: true
      - manufacturer: Cleargrass Inc
✔ Continue with Generic service on this device? … yes
Now executing Generic steps...
✔ This mode will try to scan your peripheral to get maximum information, continue? … yes
No services found.
 -> Peripheral:
   -> Address type: public
   -> Connectable: true
   -> Advertisement:
     -> Local name: undefined
     -> Services:
   -> Services (0):
✔ Did your analyse ends with success? … yes
HURRAY!!!
Please give back following data on https://github.com/atrovato/gladys-bluetooth-analyzer/issues GitHub issues
Bye!
pi@gladys:~/gladys-bluetooth-analyzer $

Avec ces informations, je peux seulement dire que ton appareil à une batterie :confused:
En revanche, la 2nde partie devrait lister au moins un service, celui de la batterie, mais il dit 0. Peux tu ressayen laissant 1 minute entre les 2 étapes ?

1 « J'aime »
✔ This tools is used to test your Bluetooth device with Gladys, do you want to continue? … yes
✔ Select the service you want to test › Generic
✔ Next step is scanning for Bluetooth devices, continue? … yes
✔ Select device you want to analyse: › 58:2d:34:36:30:69
 -> Device:
    - Name: 58:2d:34:36:30:69
    - Model: Duck_Release
    - 1 features
      - battery / integer
    - 2 params
      - loaded: true
      - manufacturer: Cleargrass Inc
✔ Continue with Generic service on this device? … yes
Now executing Generic steps...
✔ This mode will try to scan your peripheral to get maximum information, continue? … yes
No services found.
 -> Peripheral:
   -> Address type: public
   -> Connectable: true
   -> Advertisement:
     -> Local name: MJ_HT_V1
     -> Services: 180f,180a
   -> Services (0):
✔ Did your analyse ends with success? … yes
HURRAY!!!
Please give back following data on https://github.com/atrovato/gladys-bluetooth-analyzer/issues GitHub issues
Bye!

c’est un capteur d’humidité et température,donc il devrait donner 3 services c,'est bien ça ?

D’après ce que j’ai vu sur d’autre applications, pour récupérer les valeurs, il faut s’inscrire sur un des services de l’appareil, et l’appareil envoie ses informations à ses inscrits.

Hors, depuis cette partie :

il n’y a pas de services disponibles (Services 0).

Il est possible que mon utilitaire ne soit pas complet.

As-tu essayé l’autre mode ?

Je viens d’ajouter plus de logs sur le mode Generic. Mais je ne suis pas sûr de mon coup (toujours en développement à l’aveugle).

@lmilcent désolé j’ai oublié de te réponde, merci pour ta proposition, mais je vais refuser, car je ne suis pas sûr d’avoir assez de disponibilité pour pouvoir travailler sur le sujet rapidement, ça risque de se transformer en longue durée. Et au final, ça reviendrait moins cher en frais de port que j’en achète un.

En revanche, ça m’étonne qu’aucun dev n’ait ce capteur…

ça marche, pas de soucis :slight_smile:
Je suis d’accord avec toi, vu le prix et l’utilité du capteur je suis étonné que peu de dev le possèdent.

Salut, c’est des capteurs qui viennent d’ali express où bangood je sais plus, je regarde ça d’ici peu mais là je ne vois pas trop où je dois m’inscrire, enfin je regarde ça, merci pour tes réponses en tout cas. Et j’essaie aussi l’autre mode et je te renvoi les retours.

C’est du langage dev je pense…
Ce n’est pas à toi de le faire, c’est l’outil de @AlexTrovato qui doit le faire mais avant il doit trouver la liste des services.

1 « J'aime »

re, premier essais en generic

✔ This tools is used to test your Bluetooth device with Gladys, do you want to continue? … yes
✔ Next step is scanning for Bluetooth devices, continue? … yes
✔ Select device you want to analyse: › 58:2d:34:36:30:69 - MJ_HT_V1
◓ Exploring 58:2d:34:36:30:69 device information...noble warning: unknown peripheral 582d34363069
◑ Exploring 58:2d:34:36:30:69 device information...noble warning: unknown peripheral 582d34363069
◒ Exploring 58:2d:34:36:30:69 device information...noble warning: unknown peripheral 582d34363069
◐ Exploring 58:2d:34:36:30:69 device information...noble warning: unknown peripheral 582d34363069
◓ Exploring 58:2d:34:36:30:69 device information...noble warning: unknown peripheral 582d34363069
◑ Exploring 58:2d:34:36:30:69 device information...noble warning: unknown peripheral 582d34363069
 -> Device:
    - Name: MJ_HT_V1
    - Model: undefined
    - 0 features
    - 1 params
      - loaded: true
✔ Select the service you want to test › Generic
Now executing Generic steps...
✔ This mode will try to scan your peripheral to get maximum information, continue? … yes
◓ Connecting to device...SubError [TimeoutError]: operation timed out
    at afterTimeout (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/bluebird/js/release/timers.js:46:19)
    at Timeout.timeoutTimeout [as _onTimeout] (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/bluebird/js/release/timers.js:76:13)
    at listOnTimeout (node:internal/timers:556:17)
    at processTimers (node:internal/timers:499:7)
pi@gladys:~/gladys-bluetooth-analyzer $

deuxième essais, après 1mn d’attente entre les 2 scan

✔ This tools is used to test your Bluetooth device with Gladys, do you want to continue? … yes
✔ Next step is scanning for Bluetooth devices, continue? … yes
✔ Select device you want to analyse: › 58:2d:34:36:30:69 - MJ_HT_V1
◒ Exploring 58:2d:34:36:30:69 device information...noble warning: unknown peripheral 582d34363069
◐ Exploring 58:2d:34:36:30:69 device information...noble warning: unknown peripheral 582d34363069
◓ Exploring 58:2d:34:36:30:69 device information...noble warning: unknown peripheral 582d34363069
◑ Exploring 58:2d:34:36:30:69 device information...noble warning: unknown peripheral 582d34363069
◒ Exploring 58:2d:34:36:30:69 device information...noble warning: unknown peripheral 582d34363069
◐ Exploring 58:2d:34:36:30:69 device information...noble warning: unknown peripheral 582d34363069
 -> Device:
    - Name: MJ_HT_V1
    - Model: undefined
    - 0 features
    - 1 params
      - loaded: true
✔ Select the service you want to test › Generic
Now executing Generic steps...
✔ This mode will try to scan your peripheral to get maximum information, continue? … yes
No services found.
 -> Peripheral:
   -> Address type: public
   -> Connectable: true
   -> Advertisement:
     -> Local name: MJ_HT_V1
     -> Services: 180f,180a
     -> Service data: [object Object],[object Object]
   -> Services (0):
✔ Did your analyse ends with success? … yes
HURRAY!!!
Please give back following data on https://github.com/atrovato/gladys-bluetooth-analyzer/issues GitHub issues
Bye!
pi@gladys:~/gladys-bluetooth-analyzer $

3 eme en mode xiaomi

✔ This tools is used to test your Bluetooth device with Gladys, do you want to continue? … yes
✔ Next step is scanning for Bluetooth devices, continue? … yes
✔ Select device you want to analyse: › 58:2d:34:36:30:69 - MJ_HT_V1
 -> Device:
    - Name: MJ_HT_V1
    - Model: Duck_Release
    - 1 features
      - battery / integer
    - 2 params
      - loaded: true
      - manufacturer: Cleargrass Inc
✔ Select the service you want to test › Xiaomi
Now executing Xiaomi steps...
✔ Select model you want to check: › LYWSD03MMC
NotFoundError: Bluetooth: no services found for 582d34363069
    at /home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/lib/utils/peripheral/bluetooth.discoverServices.js:27:23
    at Peripheral.<anonymous> (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/peripheral.js:81:7)
    at Object.onceWrapper (node:events:483:26)
    at Peripheral.emit (node:events:376:20)
    at Noble.onServicesDiscover (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/noble.js:309:16)
    at NobleBindings.emit (node:events:376:20)
    at NobleBindings.onServicesDiscovered (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:317:8)
    at Gatt.emit (node:events:376:20)
    at Object.callback (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:369:12)
    at Gatt.onAclStreamData (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:133:26)
    at AclStream.emit (node:events:388:22)
    at AclStream.push (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/acl-stream.js:33:10)
    at NobleBindings.onAclDataPkt (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:288:15)
    at Hci.emit (node:events:376:20)
    at Hci.onSocketData (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/hci.js:501:14)
    at BluetoothHciSocket.emit (node:events:376:20)
pi@gladys:~/gladys-bluetooth-analyzer $

le flower care en generic

✔ This tools is used to test your Bluetooth device with Gladys, do you want to continue? … yes
✔ Next step is scanning for Bluetooth devices, continue? … yes
✔ Select device you want to analyse: › c4:7c:8d:6a:45:7d - Flower care
◐ Exploring c4:7c:8d:6a:45:7d device information...noble warning: unknown peripheral c47c8d6a457d
◓ Exploring c4:7c:8d:6a:45:7d device information...noble warning: unknown peripheral c47c8d6a457d
◑ Exploring c4:7c:8d:6a:45:7d device information...noble warning: unknown peripheral c47c8d6a457d
◒ Exploring c4:7c:8d:6a:45:7d device information...noble warning: unknown peripheral c47c8d6a457d
◐ Exploring c4:7c:8d:6a:45:7d device information...noble warning: unknown peripheral c47c8d6a457d
◓ Exploring c4:7c:8d:6a:45:7d device information...noble warning: unknown peripheral c47c8d6a457d
 -> Device:
    - Name: Flower care
    - Model: undefined
    - 0 features
    - 1 params
      - loaded: true
✔ Select the service you want to test › Generic
Now executing Generic steps...
✔ This mode will try to scan your peripheral to get maximum information, continue? … yes
No services found.
 -> Peripheral:
   -> Address type: public
   -> Connectable: true
   -> Advertisement:
     -> Local name: Flower care
     -> Services: fe95
     -> Service data: [object Object]
✔ Did your analyse ends with success? … yes
HURRAY!!!
Please give back following data on https://github.com/atrovato/gladys-bluetooth-analyzer/issues GitHub issues
Bye!
pi@gladys:~/gladys-bluetooth-analyzer $

en xiaomi

✔ This tools is used to test your Bluetooth device with Gladys, do you want to continue? … yes
✔ Next step is scanning for Bluetooth devices, continue? … yes
✔ Select device you want to analyse: › c4:7c:8d:6a:45:7d
 -> Device:
    - Name: c4:7c:8d:6a:45:7d
    - Model: undefined
    - 0 features
    - 1 params
      - loaded: true
✔ Select the service you want to test › Xiaomi
Now executing Xiaomi steps...
✔ Select model you want to check: › LYWSD03MMC
NotFoundError: Bluetooth: no services found for c47c8d6a457d
    at /home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/lib/utils/peripheral/bluetooth.discoverServices.js:27:23
    at Peripheral.<anonymous> (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/peripheral.js:81:7)
    at Object.onceWrapper (node:events:483:26)
    at Peripheral.emit (node:events:376:20)
    at Noble.onServicesDiscover (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/noble.js:309:16)
    at NobleBindings.emit (node:events:376:20)
    at NobleBindings.onServicesDiscovered (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:317:8)
    at Gatt.emit (node:events:376:20)
    at Object.callback (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:369:12)
    at Gatt.onAclStreamData (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:133:26)
    at AclStream.emit (node:events:388:22)
    at AclStream.push (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/acl-stream.js:33:10)
    at NobleBindings.onAclDataPkt (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:288:15)
    at Hci.emit (node:events:376:20)
    at Hci.onSocketData (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/hci.js:501:14)
    at BluetoothHciSocket.emit (node:events:376:20)
pi@gladys:~/gladys-bluetooth-analyzer $

un autre capteur bluetooth de la meme marque que le premier

✔ This tools is used to test your Bluetooth device with Gladys, do you want to continue? … yes
✔ Next step is scanning for Bluetooth devices, continue? … yes
✔ Select device you want to analyse: › 58:2d:34:35:e1:6b - MJ_HT_V1
 -> Device:
- Name: MJ_HT_V1
- Model: Duck_Release
- 1 features
  - battery / integer
- 2 params
  - loaded: true
  - manufacturer: Cleargrass Inc
✔ Select the service you want to test › Generic
Now executing Generic steps...
✔ This mode will try to scan your peripheral to get maximum information, continue? … yes
No services found.
 -> Peripheral:
   -> Address type: public
   -> Connectable: true
   -> Advertisement:
 -> Local name: MJ_HT_V1
 -> Services: 180f,180a
 -> Service data: [object Object],[object Object]
   -> Services (0):
✔ Did your analyse ends with success? … yes
HURRAY!!!
Please give back following data on https://github.com/atrovato/gladys-bluetooth-analyzer/issues GitHub issues
Bye!
pi@gladys:~/gladys-bluetooth-analyzer $

Oui désolé, quand je dis “inscrire” je parle de l’utilitaire sur le périphérique.
Pour le Xiaomi LYWSD03MMC, il n’est pas possible de lire les données, le seul moyen est que le périphérique les envoie, et donc pour cela, il faut s’inscrire pour qu’il sache à qui les envoyer.

Du coup je crois comprendre que le Cleargrass n’est pas exactement le même modèle que le LYWSD03MMC, donc pas dit que ça fonctionne avec cette version, je dois faire des recherches pour voir s’il s’intègre.

De plus, je vois que tu as mis à jour l’outil, mais il faudrait que tu refasse un npm install car je vois qu’il manque une info.

Pour le Flower care, super pour les infos, je vais les prendre en compte ASAP (et je crois qu’il était géré par le module Bluetooth de la V3, je vais voir ce qui était développé).

Merci pour tout ça, j’ai plus qu’à mis mettre.

(on va peut-être créer un topic spécial sur le forum pour alléger celui-ci et découper par device ?)

1 « J'aime »

Oui j’ai bien fait gît pull et ensuite npm install avant de start, et je n’ai pas eu d’erreur à part la première fois où il parle de duplicate sur le fi hier qui sert à l’installe, me rappel plus le nom et je suis sur le tel là… Je l’ai renommé en old et relancé la commande sans erreur

Sinon oui pourquoi pas différencier les périphériques par topic, pas de soucis pour moi

Merci pour l’information, je vais chercher :slight_smile:

1 « J'aime »

Pour ceux qui seraient intéressés, les sources de l’addon Mozilla WebThings Xiaomi sont ici :

Mode hors sujet

Un peu obscur ce projet, je voulais essayer pour tester sous Docker et en fait, le projet est maintenant sous le nom WebThings et en dehors de Mozilla.