Bluetooth : Xiaomi température/humidité

Super, tu peux retenter stp ? Il arrive que le Bluetooth “galère” a se connecter à l’appareil. Et il faut s’assurer que l’appareil ne soit pas déjà connecté à un autre…
Tu peux voir qu’il a réussi à se connecter si dans les params du device tu as le manufacturer (ou le modèle).

J’ai essayé pas mal de fois. Le résultat varie entre ce que je t’ai envoyé avant et :

:heavy_check_mark: This tools is used to test your Bluetooth device with Gladys, do you want to continue? … yes
:heavy_check_mark: Select the service you want to test › Xiaomi
:heavy_check_mark: Next step is scanning for Bluetooth devices, continue? … yes
:heavy_check_mark: Select device you want to analyse: › 75:7f:ee:8d:95:6c:40:12:ab:57:96:5c:79:fa:49:08 - LYWSD03MMC
-> Device:
- Name: LYWSD03MMC
- Model: undefined
- 0 features
- 1 params
- loaded: true
:heavy_check_mark: Continue with Xiaomi service on this device? … yes
Now executing Xiaomi steps…
:heavy_check_mark: Select model you want to check: › LYWSD03MMC
◒ Connecting to device…NotFoundError: Bluetooth: peripheral 757fee8d956c4012ab57965c79fa4908 not found

Pour info, j’en ai flashé un avec un autre firmware si jamais (https://github.com/atc1441/ATC_MiThermometer)

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.

Oui, ça publie les informations “décryptés”. Tu n’as pas besoin de te connecter dessus, tu peux juste écouter les packets publiés. Il consommera un peu moins de batterie du coup.
Après le firmware est opensource donc tu peux le modifier comme tu veux. C’est codé en c.

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 Like

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 Like

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 Like
✔ 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: