Bluetooth : Xiaomi température/humidité

oh ! Et ça fait quoi de beau ?
J’ai vu que ça déchiffrait les données envoyées en bluetooth mais apparemment, tu peux exécuter tes propres prog dessus ?

Du coup, ça devrait simplifier la récupération des données en bluetooth.

Par curiosité est-ce que ce service peut permettre de récup les infos de ce capteur Xiaomi ?

Je ne peux pas te le confirmer, je n’ai pas étudié la question, mais pour ne pas oublier, tu peux toujours creer une issue sur le github du petit programme.
Je te dirais bien d’essayer mais il a quelques manip pour activer le Bluetooth sous npm, je dois donc compléter la doc et fixer un premier bug.

En gros ce outils (me) servira a tester et valider qu’un périphérique Bluetooth rentre bien dans Gladys.

Ce n’est pas un super outils Bluetooth générique qui fait tout, on est vraiment au cas par cas.

1 « J'aime »

Ok ça marche, merci pour ces détails !

Ok j’ai mis à jour la libraire en rapport aux logs d’erreur.
Il faudra suivre les instructions selon l’OS du PC.
Une fois les instructions à jour, il faudra mettre à jour l’outils en local avec git pull (pour ceux qui ont déjà cloner l’outils).

Je vais tenter de l’améliorer au fur et à mesure.

✔ This tools is used to test your Bluetooth device with Gladys, do you want to continue? … yes
✔ Select the service you want to test › Xiaomi
✔ Next step is scanning for Bluetooth devices, continue? … yes
✔ Select device you want to analyse: › a4:c1:38:0c:c2:f9 - LYWSD03MMC
 -> Device:
    - Name: LYWSD03MMC
    - Model: LYWSD03MMC
    - 1 features
      - battery / integer
    - 2 params
      - loaded: true
      - manufacturer: miaomiaoce.com
✔ Continue with Xiaomi service on this device? … yes
Now executing Xiaomi steps...
✔ Select model you want to check: › LYWSD03MMC
{ Error: Bluetooth: no services found for a4c1380cc2f9
    at peripheral.discoverServices (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/lib/utils/peripheral/bluetooth.discoverServices.js:27:16)
    at Peripheral.once.services (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/peripheral.js:81:7)
    at Object.onceWrapper (events.js:286:20)
    at Peripheral.emit (events.js:198:13)
    at Noble.onServicesDiscover (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/noble.js:309:16)
    at NobleBindings.emit (events.js:198:13)
    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 (events.js:198:13)
    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 (events.js:203:15)
    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 (events.js:198:13)
    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 (events.js:198:13) message: 'Bluetooth: no services found for a4c1380cc2f9' }

Je réessaie avec d’autres.
Il m’en a détecté 3 au premier essai, puis 2 au second, sur 4 (1 est hors de portée je pense et 1 à la limite)

✔ This tools is used to test your Bluetooth device with Gladys, do you want to continue? … yes
✔ Select the service you want to test › Xiaomi
✔ Next step is scanning for Bluetooth devices, continue? … yes
✔ Select device you want to analyse: › a4:c1:38:6f:99:ab - LYWSD03MMC
 -> Device:
    - Name: LYWSD03MMC
    - Model: LYWSD03MMC
    - 1 features
      - battery / integer
    - 2 params
      - loaded: true
      - manufacturer: miaomiaoce.com
✔ Continue with Xiaomi service on this device? … yes
Now executing Xiaomi steps...
✔ Select model you want to check: › LYWSD03MMC
{ Error: Bluetooth: no services found for a4c1386f99ab
    at peripheral.discoverServices (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/lib/utils/peripheral/bluetooth.discoverServices.js:27:16)
    at Peripheral.once.services (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/peripheral.js:81:7)
    at Object.onceWrapper (events.js:286:20)
    at Peripheral.emit (events.js:198:13)
    at Noble.onServicesDiscover (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/noble.js:309:16)
    at NobleBindings.emit (events.js:198:13)
    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 (events.js:198:13)
    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 (events.js:203:15)
    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 (events.js:198:13)
    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 (events.js:198:13) message: 'Bluetooth: no services found for a4c1386f99ab' }

Même réponse sur un autre.
Le 3ème est aléatoire au niveau de sa présence…
Ca existe du répéteur bluetooth ? :stuck_out_tongue:

Et avec celui la LYWSD03MMC tu as essayé plusieurs fois ?
Il faut savoir que le Bluetooth n’est pas une science sûre :stuck_out_tongue:
En revanche, si au bout de 3 / 4 fois (ce que tu as fait si je comprends bien) tu n’as toujours rien, c’est que je n’ai pas la bonne technique pour ce device, je vais donc voir d’autres sites pour trouver la bonne manière de se connecter au LYWSD03MMC.

✔ This tools is used to test your Bluetooth device with Gladys, do you want to continue? … yes
✔ Select the service you want to test › Xiaomi
✔ Next step is scanning for Bluetooth devices, continue? … yes
? Select device you want to analyse: › - Use arrow-keys. Return to submit.
❯   57:e6:74:6e:f4:5e
    6a:1b:c2:5f:3d:e5
    a4:c1:38:6f:99:ab - LYWSD03MMC
    60:4c:7e:5b:25:e6
    a4:c1:38:c2:1a:8f - LYWSD03MMC

J’ai l’impression que c’est pas super stable comme protocole.
J’ai beaucoup de variations dans les scans. Tu crois qu’en les flashant ça peut apporter du mieux ?

Non ne flashes rien.
Il arrive que les périphériques ne soit pas visibles, car le scan se fait sur 5 secondes, qui est peut-etre un peu court si on scan en boucle.

C’est surtout la librairie NPM qui n’est pas ultra stable.
C’est bien pour ça que j’insiste pour que cet outil utilise la même que Gladys, afin de ne pas avoir de surprise.

Mais on va y arriver, courage :wink:

@Hamtaro je viens de livrer une version pour scanner le périphérique de manière plus générique.
Il va scanner toutes les portes visibles du device :wink:

En revanche, il faudra en plus de git pull re-faire un npm install :slight_smile:

Il y a maintenant un service generic, tu veux que je passe par quoi ?
J’ai réessayé de manière “classique” :

✔ Select device you want to analyse: › a4:c1:38:c2:1a:8f - LYWSD03MMC
 -> Device:
    - Name: LYWSD03MMC
    - Model: undefined
    - 0 features
    - 1 params
      - loaded: true
✔ 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
{ Error: Bluetooth: no characteristics found for service 1800
    at service.discoverCharacteristics (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/lib/utils/service/bluetooth.discoverCharacteristics.js:27:16)
    at Service.once.characteristics (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/service.js:56:7)
    at Object.onceWrapper (events.js:286:20)
    at Service.emit (events.js:198:13)
    at Noble.onCharacteristicsDiscover (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/noble.js:398:13)
    at NobleBindings.emit (events.js:198:13)
    at NobleBindings.onCharacteristicsDiscovered (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:368:8)
    at Gatt.emit (events.js:198:13)
    at Object.callback (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:515: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 (events.js:203:15)
    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 (events.js:198:13)
    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 (events.js:198:13)
  message: 'Bluetooth: no characteristics found for service 1800' }
pi@gladys:~/gladys-bluetooth-analyzer $ 

Essaie avec le mode générique afin de lister les services disponibles, a partir de la je pourrais tenter de corriger le mode Xiaomi.

Boom ! :wink:

✔ Select device you want to analyse: › a4:c1:38:6f:99:ab - LYWSD03MMC
 -> Device:
    - Name: LYWSD03MMC
    - Model: undefined
    - 0 features
    - 1 params
      - loaded: true
✔ 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
 -> Peripheral:
   -> Address type: public
   -> Connectable: true
   -> Advertisement:
     -> Local name: LYWSD03MMC
     -> Services: 
   -> Services (3):
     -> 1800 (Generic Access)
       -> Characteristics (3):
         -> 2a00 (Device Name): read,notify
         -> 2a01 (Appearance): read
         -> 2a04 (Peripheral Preferred Connection Parameters): read
     -> 1801 (Generic Attribute)
       -> Characteristics (1):
         -> 2a05 (Service Changed): indicate
     -> 180a (Device Information)
       -> Characteristics (6):
         -> 2a24 (Model Number String): read
         -> 2a25 (Serial Number String): read
         -> 2a26 (Firmware Revision String): read
         -> 2a27 (Hardware Revision String): read
         -> 2a28 (Software Revision String): read
         -> 2a29 (Manufacturer Name String): read
✔ 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!
1 « J'aime »

Ok super, je viens de (re) mettre à jour le projet en prenant en compte ces données.
Un petit git pull et tu peux retester avec Xiaomi ?

1 « J'aime »
✔ Select device you want to analyse: › a4:c1:38:6f:99:ab - LYWSD03MMC
 -> Device:
    - Name: LYWSD03MMC
    - Model: undefined
    - 0 features
    - 1 params
      - loaded: true
✔ Continue with Xiaomi service on this device? … yes
Now executing Xiaomi steps...
✔ Select model you want to check: › LYWSD03MMC
{ Error: Bluetooth: no characteristics found for service 1801
    at service.discoverCharacteristics (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/lib/utils/service/bluetooth.discoverCharacteristics.js:27:16)
    at Service.once.characteristics (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/service.js:56:7)
    at Object.onceWrapper (events.js:286:20)
    at Service.emit (events.js:198:13)
    at Noble.onCharacteristicsDiscover (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/noble.js:398:13)
    at NobleBindings.emit (events.js:198:13)
    at NobleBindings.onCharacteristicsDiscovered (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:368:8)
    at Gatt.emit (events.js:198:13)
    at Object.callback (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:515: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 (events.js:203:15)
    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 (events.js:198:13)
    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 (events.js:198:13)
  message: 'Bluetooth: no characteristics found for service 1801' }

Je suis chiant mais tu as essayé plusieurs fois ?
Car la c’est pas bon signe :confused:

✔ Select device you want to analyse: › a4:c1:38:6f:99:ab - LYWSD03MMC
 -> Device:
    - Name: LYWSD03MMC
    - Model: undefined
    - 0 features
    - 1 params
      - loaded: true
✔ 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: LYWSD03MMC
     -> 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!

Je continue

✔ Select device you want to analyse: › a4:c1:38:c2:1a:8f - LYWSD03MMC
 -> Device:
    - Name: LYWSD03MMC
    - Model: LYWSD03MMC
    - 1 features
      - battery / integer
    - 2 params
      - loaded: true
      - manufacturer: miaomiaoce.com
✔ 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
{ Error: Bluetooth: no characteristics found for service 1800
    at service.discoverCharacteristics (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/lib/utils/service/bluetooth.discoverCharacteristics.js:27:16)
    at Service.once.characteristics (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/service.js:56:7)
    at Object.onceWrapper (events.js:286:20)
    at Service.emit (events.js:198:13)
    at Noble.onCharacteristicsDiscover (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/noble.js:398:13)
    at NobleBindings.emit (events.js:198:13)
    at NobleBindings.onCharacteristicsDiscovered (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:368:8)
    at Gatt.emit (events.js:198:13)
    at Object.callback (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:515: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 (events.js:203:15)
    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 (events.js:198:13)
    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 (events.js:198:13)
  message: 'Bluetooth: no characteristics found for service 1800' }

Un autre

✔ Select device you want to analyse: › a4:c1:38:b8:ba:2a - LYWSD03MMC
 -> Device:
    - Name: LYWSD03MMC
    - Model: undefined
    - 0 features
    - 1 params
      - loaded: true
✔ 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
◑ Connecting to device...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 ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)

Again

✔ Select device you want to analyse: › a4:c1:38:b8:ba:2a - LYWSD03MMC
 -> Device:
    - Name: LYWSD03MMC
    - Model: undefined
    - 0 features
    - 1 params
      - loaded: true
✔ 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: LYWSD03MMC
     -> 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!

J’ai l’impression de jouer à la roulette russe… :stuck_out_tongue:

1 « J'aime »

lol on va finir par tomber sur la balle !! :stuck_out_tongue:
Je viens de faire un tour sur d’autres projets qui disent intégrer le capteur, et j’ai mis notre projet aléatoire à jour.
Un git pull et beaucoup de croisage de doigts :crossed_fingers:

J’attends tes nouveaux résultats (essaie 2/3 fois en prenant ton temps) :slight_smile:

1 « J'aime »
✔ Select device you want to analyse: › a4:c1:38:0c:c2:f9 - LYWSD03MMC
 -> Device:
    - Name: LYWSD03MMC
    - Model: undefined
    - 0 features
    - 1 params
      - loaded: true
✔ Continue with Xiaomi service on this device? … yes
Now executing Xiaomi steps...
✔ Select model you want to check: › LYWSD03MMC
◒ Connecting to device...{ Error: Bluetooth: peripheral a4c1380cc2f9 not found
    at Noble.scanStop (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/lib/commands/bluetooth.scan.js:46:20)
    at Object.onceWrapper (events.js:286:20)
    at Noble.emit (events.js:203:15)
    at Noble.onScanStop (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/noble.js:164:8)
    at NobleBindings.emit (events.js:198:13)
    at NobleBindings.onScanStop (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:133:8)
    at Gap.emit (events.js:198:13)
    at Gap.onHciLeScanEnableSet (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/gap.js:74:10)
    at Hci.emit (events.js:198:13)
    at Hci.processCmdCompleteEvent (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/hci.js:596:10)
    at Hci.onSocketData (/home/pi/gladys-bluetooth-analyzer/gladys/server/services/bluetooth/node_modules/@abandonware/noble/lib/hci-socket/hci.js:465:12)
    at BluetoothHciSocket.emit (events.js:198:13) message: 'Bluetooth: peripheral a4c1380cc2f9 not found' }

Et ça revient pour tous les autres détectés dans la liste.
Je referai un essai dans la journée.