[74_XiaomiBTLESens.pm] Xiaomi Bluetooth Sensoren FlowerSens/Thermometer

Begonnen von CoolTux, 11 Januar 2018, 15:42:45

Vorheriges Thema - Nächstes Thema

t1me2die

#795
Moin liebes Forum, moin Leon,

ich habe heute versucht einen Xiaomi Cleargrass Sensor in Betrieb zu nehmen.
Bisher habe ich diverse Sensoren von dem Vorgängermodell im Einsatz, problemlos.

Link zum Gerät:
https://www.aliexpress.com/item/32988756893.html?spm=a2g0s.9042311.0.0.3e434c4dFMB94D

Zuerst einmal die BT Mac rausgesucht:

58:2D:34:10:4C:FA ClearGrass Temp & RH


Eingebunden via:

define wz_Xiaomi_Sensor_unten XiaomiBTLESens 58:2D:34:10:4C:FA

Danach noch als Modell "thermoHygroSens" gesetzt und ein
get wz_Xiaomi_Sensor_unten sensorData

List vom Device:

Internals:
   BTMAC      58:2D:34:10:4C:FA
   CFGFN     
   DEF        58:2D:34:10:4C:FA
   FUUID      5d8cd259-f33f-5bc8-f8d0-febfa4c6b28c768c
   INTERVAL   300
   NAME       wz_Xiaomi_Sensor_unten
   NOTIFYDEV  global,wz_Xiaomi_Sensor_unten
   NR         120801
   NTFY_ORDER 50-wz_Xiaomi_Sensor_unten
   STATE      write sensor data
   TYPE       XiaomiBTLESens
   VERSION    2.4.7
   loglevel   4
   READINGS:
     2019-09-26 17:00:17   batteryPercent  51959038720
     2019-09-26 17:00:17   batteryState    ok
     2019-09-26 16:59:59   firmware        CGG1
     2019-09-26 17:14:23   lastGattError   charWrite faild
     2019-09-26 17:14:23   state           write sensor data
   helper:
     CallBattery 1
     CallSensDataCounter 1
     updateTimeCallBattery 1569510017.9597
     updateTimestampCallBattery 2019-09-26 17:00:17
     RUNNING_PID:
       abortFn    XiaomiBTLESens::ExecGatttool_Aborted
       arg        wz_Xiaomi_Sensor_unten|58:2D:34:10:4C:FA|write|0x10|0100|1
       bc_pid     120758
       finishFn   XiaomiBTLESens::ExecGatttool_Done
       fn         XiaomiBTLESens::ExecGatttool_Run
       pid        5511
       telnet     telnetPort_127.0.0.1_54660
       timeout    90
       abortArg:
Attributes:
   model      thermoHygroSens
   room       XiaomiBTLESens


Hatte das Gerät nun aber erstmal auf disable gesetzt, damit es meine Logs nicht vollspammt.

Bekomme im Log direkt folgenden Fehler:

2019.09.26 16:59:37 3: XiaomiBTLESens (wz_Xiaomi_Sensor_unten) - defined with BTMAC 58:2D:34:10:4C:FA
2019.09.26 17:00:17 1: PERL WARNING: Hexadecimal number > 0xffffffff non-portable at ./FHEM/74_XiaomiBTLESens.pm line 868.
2019.09.26 17:00:17 3: eval: {XiaomiBTLESens::ExecGatttool_Done('wz_Xiaomi_Sensor_unten|58:2D:34:10:4C:FA|ok|read|0x18|{"gtResult":"0c 19 00 03 00 "}')}
2019.09.26 17:00:17 1: PERL WARNING: Hexadecimal number > 0xffffffff non-portable at ./FHEM/74_XiaomiBTLESens.pm line 869.
2019.09.26 17:00:17 3: eval: {XiaomiBTLESens::ExecGatttool_Done('wz_Xiaomi_Sensor_unten|58:2D:34:10:4C:FA|ok|read|0x18|{"gtResult":"0c 19 00 03 00 "}')}
2019.09.26 17:00:38 1: ERROR evaluating {XiaomiBTLESens::ExecGatttool_Done('wz_Xiaomi_Sensor_unten|58:2D:34:10:4C:FA|ok|write|0x10|{"gtResult":"Unexpected error code"}')}: Can't use string ("1") as a HASH ref while "strict refs" in use at ./FHEM/74_XiaomiBTLESens.pm line 941.


Der Sensor wird vermutlich noch nicht unterstützt oder?

Gruß
Mathze

CoolTux

Hallo,

Leider nein. Und ich habe aktuell leider auch keine Zeit es mir genauer an zu schauen. Wenn Du also nicht genau weißt welche Werte was darstellen wird es schwierig.



Grüße
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

t1me2die

Zitat von: CoolTux am 26 September 2019, 21:20:20
Hallo,

Leider nein. Und ich habe aktuell leider auch keine Zeit es mir genauer an zu schauen. Wenn Du also nicht genau weißt welche Werte was darstellen wird es schwierig.

Grüße

Moin, danke für deine Antwort.
Was für Informationen benötigst du denn genau?
Bzw. wie kann ich mir die Hex-Werte anzeigen lassen?
Die Werte auf dem Display sehe ich zum Abrufzeitpunkt ja genau, sodass ich hier eine "Übersetzung" machen könnte.

Gruß
Mathze

CoolTux


gatttool -b BTMAC --characteristics


Das hier in der Konsole eines Linuxsystems eingeben.
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

t1me2die

#799
Zitat von: CoolTux am 27 September 2019, 13:07:39

gatttool -b BTMAC --characteristics


Das hier in der Konsole eines Linuxsystems eingeben.

Angezeigt werden:
20,1 Grad
66,2% Luftfeuchtigkeit

Als Ausgabe bekomme ich:

root@raspberrypi:~# gatttool -b 58:2D:34:10:4C:FA --characteristics
handle = 0x0002, char properties = 0x0a, char value handle = 0x0003, uuid = 00002a00-0000-1000-8000-00805f9b34fb
handle = 0x0004, char properties = 0x02, char value handle = 0x0005, uuid = 00002a01-0000-1000-8000-00805f9b34fb
handle = 0x0006, char properties = 0x02, char value handle = 0x0007, uuid = 00002a04-0000-1000-8000-00805f9b34fb
handle = 0x0008, char properties = 0x02, char value handle = 0x0009, uuid = 00002aa6-0000-1000-8000-00805f9b34fb
handle = 0x000b, char properties = 0x20, char value handle = 0x000c, uuid = 00002a05-0000-1000-8000-00805f9b34fb
handle = 0x000f, char properties = 0x18, char value handle = 0x0010, uuid = 8ec90003-f315-4f60-9fb8-838830daea50
handle = 0x0013, char properties = 0x0c, char value handle = 0x0014, uuid = 00000001-0000-1000-8000-00805f9b34fb
handle = 0x0015, char properties = 0x10, char value handle = 0x0016, uuid = 00000002-0000-1000-8000-00805f9b34fb
handle = 0x0018, char properties = 0x0c, char value handle = 0x0019, uuid = 00000003-0000-1000-8000-00805f9b34fb
handle = 0x001a, char properties = 0x10, char value handle = 0x001b, uuid = 00000004-0000-1000-8000-00805f9b34fb
handle = 0x001d, char properties = 0x10, char value handle = 0x001e, uuid = 00000100-0000-1000-8000-00805f9b34fb
handle = 0x0021, char properties = 0x02, char value handle = 0x0022, uuid = 00002a29-0000-1000-8000-00805f9b34fb
handle = 0x0023, char properties = 0x02, char value handle = 0x0024, uuid = 00002a24-0000-1000-8000-00805f9b34fb
handle = 0x0025, char properties = 0x02, char value handle = 0x0026, uuid = 00002a25-0000-1000-8000-00805f9b34fb
handle = 0x0027, char properties = 0x02, char value handle = 0x0028, uuid = 00002a27-0000-1000-8000-00805f9b34fb
handle = 0x0029, char properties = 0x02, char value handle = 0x002a, uuid = 00002a26-0000-1000-8000-00805f9b34fb
handle = 0x002c, char properties = 0x18, char value handle = 0x002d, uuid = 00000001-0000-1000-8000-00805f9b34fb
handle = 0x002f, char properties = 0x02, char value handle = 0x0030, uuid = 00000002-0000-1000-8000-00805f9b34fb
handle = 0x0031, char properties = 0x02, char value handle = 0x0032, uuid = 00000004-0000-1000-8000-00805f9b34fb
handle = 0x0033, char properties = 0x18, char value handle = 0x0034, uuid = 00000005-0000-1000-8000-00805f9b34fb
handle = 0x0036, char properties = 0x08, char value handle = 0x0037, uuid = 00000010-0000-1000-8000-00805f9b34fb
handle = 0x0038, char properties = 0x0a, char value handle = 0x0039, uuid = 00000013-0000-1000-8000-00805f9b34fb
handle = 0x003a, char properties = 0x02, char value handle = 0x003b, uuid = 00000014-0000-1000-8000-00805f9b34fb


Angezeigt werden:
20,2 Grad
65,9% Luftfeuchtigkeit

Als Ausgabe bekomme ich:

handle = 0x0002, char properties = 0x0a, char value handle = 0x0003, uuid = 00002a00-0000-1000-8000-00805f9b34fb
handle = 0x0004, char properties = 0x02, char value handle = 0x0005, uuid = 00002a01-0000-1000-8000-00805f9b34fb
handle = 0x0006, char properties = 0x02, char value handle = 0x0007, uuid = 00002a04-0000-1000-8000-00805f9b34fb
handle = 0x0008, char properties = 0x02, char value handle = 0x0009, uuid = 00002aa6-0000-1000-8000-00805f9b34fb
handle = 0x000b, char properties = 0x20, char value handle = 0x000c, uuid = 00002a05-0000-1000-8000-00805f9b34fb
handle = 0x000f, char properties = 0x18, char value handle = 0x0010, uuid = 8ec90003-f315-4f60-9fb8-838830daea50
handle = 0x0013, char properties = 0x0c, char value handle = 0x0014, uuid = 00000001-0000-1000-8000-00805f9b34fb
handle = 0x0015, char properties = 0x10, char value handle = 0x0016, uuid = 00000002-0000-1000-8000-00805f9b34fb
handle = 0x0018, char properties = 0x0c, char value handle = 0x0019, uuid = 00000003-0000-1000-8000-00805f9b34fb
handle = 0x001a, char properties = 0x10, char value handle = 0x001b, uuid = 00000004-0000-1000-8000-00805f9b34fb
handle = 0x001d, char properties = 0x10, char value handle = 0x001e, uuid = 00000100-0000-1000-8000-00805f9b34fb
handle = 0x0021, char properties = 0x02, char value handle = 0x0022, uuid = 00002a29-0000-1000-8000-00805f9b34fb
handle = 0x0023, char properties = 0x02, char value handle = 0x0024, uuid = 00002a24-0000-1000-8000-00805f9b34fb
handle = 0x0025, char properties = 0x02, char value handle = 0x0026, uuid = 00002a25-0000-1000-8000-00805f9b34fb
handle = 0x0027, char properties = 0x02, char value handle = 0x0028, uuid = 00002a27-0000-1000-8000-00805f9b34fb
handle = 0x0029, char properties = 0x02, char value handle = 0x002a, uuid = 00002a26-0000-1000-8000-00805f9b34fb
handle = 0x002c, char properties = 0x18, char value handle = 0x002d, uuid = 00000001-0000-1000-8000-00805f9b34fb
handle = 0x002f, char properties = 0x02, char value handle = 0x0030, uuid = 00000002-0000-1000-8000-00805f9b34fb
handle = 0x0031, char properties = 0x02, char value handle = 0x0032, uuid = 00000004-0000-1000-8000-00805f9b34fb
handle = 0x0033, char properties = 0x18, char value handle = 0x0034, uuid = 00000005-0000-1000-8000-00805f9b34fb
handle = 0x0036, char properties = 0x08, char value handle = 0x0037, uuid = 00000010-0000-1000-8000-00805f9b34fb
handle = 0x0038, char properties = 0x0a, char value handle = 0x0039, uuid = 00000013-0000-1000-8000-00805f9b34fb
handle = 0x003a, char properties = 0x02, char value handle = 0x003b, uuid = 00000014-0000-1000-8000-00805f9b34fb


Wenn du mir jetzt noch erklärst, wie ich aus diesen Informationen die angezeigten Werte rausbekomme, kann ich gerne weitere Werte liefern.

Gruß
Mathze

CoolTux

Hieraus noch nicht, das sind erstmal nur die Handles.

Ich muss mir das noch mal in Ruhe anschauen und dann bekommst Hausaufgaben. Dauert aber etwas.
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

t1me2die

Zitat von: CoolTux am 27 September 2019, 19:06:46
Hieraus noch nicht, das sind erstmal nur die Handles.

Ich muss mir das noch mal in Ruhe anschauen und dann bekommst Hausaufgaben. Dauert aber etwas.

Keine Hektik!  :)
Hausaufgaben werden dann erledigt  ;D

Gruß
Mathze

CoolTux

Zitat von: t1me2die am 27 September 2019, 18:58:56
Angezeigt werden:
20,1 Grad
66,2% Luftfeuchtigkeit

Als Ausgabe bekomme ich:

root@raspberrypi:~# gatttool -b 58:2D:34:10:4C:FA --characteristics
handle = 0x0002, char properties = 0x0a, char value handle = 0x0003, uuid = 00002a00-0000-1000-8000-00805f9b34fb
handle = 0x0004, char properties = 0x02, char value handle = 0x0005, uuid = 00002a01-0000-1000-8000-00805f9b34fb
handle = 0x0006, char properties = 0x02, char value handle = 0x0007, uuid = 00002a04-0000-1000-8000-00805f9b34fb
handle = 0x0008, char properties = 0x02, char value handle = 0x0009, uuid = 00002aa6-0000-1000-8000-00805f9b34fb
handle = 0x000b, char properties = 0x20, char value handle = 0x000c, uuid = 00002a05-0000-1000-8000-00805f9b34fb
handle = 0x000f, char properties = 0x18, char value handle = 0x0010, uuid = 8ec90003-f315-4f60-9fb8-838830daea50
handle = 0x0013, char properties = 0x0c, char value handle = 0x0014, uuid = 00000001-0000-1000-8000-00805f9b34fb
handle = 0x0015, char properties = 0x10, char value handle = 0x0016, uuid = 00000002-0000-1000-8000-00805f9b34fb
handle = 0x0018, char properties = 0x0c, char value handle = 0x0019, uuid = 00000003-0000-1000-8000-00805f9b34fb
handle = 0x001a, char properties = 0x10, char value handle = 0x001b, uuid = 00000004-0000-1000-8000-00805f9b34fb
handle = 0x001d, char properties = 0x10, char value handle = 0x001e, uuid = 00000100-0000-1000-8000-00805f9b34fb
handle = 0x0021, char properties = 0x02, char value handle = 0x0022, uuid = 00002a29-0000-1000-8000-00805f9b34fb
handle = 0x0023, char properties = 0x02, char value handle = 0x0024, uuid = 00002a24-0000-1000-8000-00805f9b34fb
handle = 0x0025, char properties = 0x02, char value handle = 0x0026, uuid = 00002a25-0000-1000-8000-00805f9b34fb
handle = 0x0027, char properties = 0x02, char value handle = 0x0028, uuid = 00002a27-0000-1000-8000-00805f9b34fb
handle = 0x0029, char properties = 0x02, char value handle = 0x002a, uuid = 00002a26-0000-1000-8000-00805f9b34fb
handle = 0x002c, char properties = 0x18, char value handle = 0x002d, uuid = 00000001-0000-1000-8000-00805f9b34fb
handle = 0x002f, char properties = 0x02, char value handle = 0x0030, uuid = 00000002-0000-1000-8000-00805f9b34fb
handle = 0x0031, char properties = 0x02, char value handle = 0x0032, uuid = 00000004-0000-1000-8000-00805f9b34fb
handle = 0x0033, char properties = 0x18, char value handle = 0x0034, uuid = 00000005-0000-1000-8000-00805f9b34fb
handle = 0x0036, char properties = 0x08, char value handle = 0x0037, uuid = 00000010-0000-1000-8000-00805f9b34fb
handle = 0x0038, char properties = 0x0a, char value handle = 0x0039, uuid = 00000013-0000-1000-8000-00805f9b34fb
handle = 0x003a, char properties = 0x02, char value handle = 0x003b, uuid = 00000014-0000-1000-8000-00805f9b34fb


Angezeigt werden:
20,2 Grad
65,9% Luftfeuchtigkeit

Als Ausgabe bekomme ich:

handle = 0x0002, char properties = 0x0a, char value handle = 0x0003, uuid = 00002a00-0000-1000-8000-00805f9b34fb
handle = 0x0004, char properties = 0x02, char value handle = 0x0005, uuid = 00002a01-0000-1000-8000-00805f9b34fb
handle = 0x0006, char properties = 0x02, char value handle = 0x0007, uuid = 00002a04-0000-1000-8000-00805f9b34fb
handle = 0x0008, char properties = 0x02, char value handle = 0x0009, uuid = 00002aa6-0000-1000-8000-00805f9b34fb
handle = 0x000b, char properties = 0x20, char value handle = 0x000c, uuid = 00002a05-0000-1000-8000-00805f9b34fb
handle = 0x000f, char properties = 0x18, char value handle = 0x0010, uuid = 8ec90003-f315-4f60-9fb8-838830daea50
handle = 0x0013, char properties = 0x0c, char value handle = 0x0014, uuid = 00000001-0000-1000-8000-00805f9b34fb
handle = 0x0015, char properties = 0x10, char value handle = 0x0016, uuid = 00000002-0000-1000-8000-00805f9b34fb
handle = 0x0018, char properties = 0x0c, char value handle = 0x0019, uuid = 00000003-0000-1000-8000-00805f9b34fb
handle = 0x001a, char properties = 0x10, char value handle = 0x001b, uuid = 00000004-0000-1000-8000-00805f9b34fb
handle = 0x001d, char properties = 0x10, char value handle = 0x001e, uuid = 00000100-0000-1000-8000-00805f9b34fb
handle = 0x0021, char properties = 0x02, char value handle = 0x0022, uuid = 00002a29-0000-1000-8000-00805f9b34fb
handle = 0x0023, char properties = 0x02, char value handle = 0x0024, uuid = 00002a24-0000-1000-8000-00805f9b34fb
handle = 0x0025, char properties = 0x02, char value handle = 0x0026, uuid = 00002a25-0000-1000-8000-00805f9b34fb
handle = 0x0027, char properties = 0x02, char value handle = 0x0028, uuid = 00002a27-0000-1000-8000-00805f9b34fb
handle = 0x0029, char properties = 0x02, char value handle = 0x002a, uuid = 00002a26-0000-1000-8000-00805f9b34fb
handle = 0x002c, char properties = 0x18, char value handle = 0x002d, uuid = 00000001-0000-1000-8000-00805f9b34fb
handle = 0x002f, char properties = 0x02, char value handle = 0x0030, uuid = 00000002-0000-1000-8000-00805f9b34fb
handle = 0x0031, char properties = 0x02, char value handle = 0x0032, uuid = 00000004-0000-1000-8000-00805f9b34fb
handle = 0x0033, char properties = 0x18, char value handle = 0x0034, uuid = 00000005-0000-1000-8000-00805f9b34fb
handle = 0x0036, char properties = 0x08, char value handle = 0x0037, uuid = 00000010-0000-1000-8000-00805f9b34fb
handle = 0x0038, char properties = 0x0a, char value handle = 0x0039, uuid = 00000013-0000-1000-8000-00805f9b34fb
handle = 0x003a, char properties = 0x02, char value handle = 0x003b, uuid = 00000014-0000-1000-8000-00805f9b34fb


Wenn du mir jetzt noch erklärst, wie ich aus diesen Informationen die angezeigten Werte rausbekomme, kann ich gerne weitere Werte liefern.

Gruß
Mathze

Bitte einmal dieses hier aus führen

gatttool -b $MAC --char-read -a 0x16
und
gatttool -b $MAC --char-read -a 0x16 0x19

Ausgabe hier bitte posten.


Grüße
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

t1me2die

Zitat von: CoolTux am 07 Oktober 2019, 11:43:58
Bitte einmal dieses hier aus führen

gatttool -b $MAC --char-read -a 0x16
und
gatttool -b $MAC --char-read -a 0x16 0x19

Ausgabe hier bitte posten.


Grüße

Hier die Ausgabe:

root@raspberrypi:~# gatttool -b 58:2D:34:10:4C:FA --char-read -a 0x16
Characteristic value/descriptor: f2
root@raspberrypi:~# gatttool -b 58:2D:34:10:4C:FA --char-read -a 0x16 0x19
Characteristic value/descriptor: f2


Gruß
Mathze

CoolTux

Sorry mein Fehler.
Das letzte sollte ein
gatttool -b $MAC --char-read -a 0x19
werden
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

t1me2die

Zitat von: CoolTux am 07 Oktober 2019, 16:21:46
Sorry mein Fehler.
Das letzte sollte ein
gatttool -b $MAC --char-read -a 0x19
werden


root@raspberrypi:~# gatttool -b 58:2D:34:10:4C:FA --char-read -a 0x19
Characteristic value/descriptor: fe


Gruß
Mathze

CoolTux

Ok und jetzt das selbe mit 37 und 39 bitte.
also 0x37 und 0x39
Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

t1me2die

Zitat von: CoolTux am 07 Oktober 2019, 16:33:23
Ok und jetzt das selbe mit 37 und 39 bitte.
also 0x37 und 0x39


root@raspberrypi:~# gatttool -b 58:2D:34:10:4C:FA --char-read -a 0x37
Characteristic value/descriptor read failed: Attribute can't be read
root@raspberrypi:~# gatttool -b 58:2D:34:10:4C:FA --char-read -a 0x39
Characteristic value/descriptor: 52 f6 f9 e3 1c c2 3a e0 c0 8d b9 df e6 78 ae 8b 90 ee 0a d4


Gruß
Mathze

CoolTux

Du musst nicht wissen wie es geht! Du musst nur wissen wo es steht, wie es geht.
Support me to buy new test hardware for development: https://www.paypal.com/paypalme/MOldenburg
My FHEM Git: https://git.cooltux.net/FHEM/
Das TuxNet Wiki:
https://www.cooltux.net

t1me2die

Zitat von: CoolTux am 07 Oktober 2019, 16:52:07
Ist Deine Batterie bei 82 Prozent?

Wenn du mir nun noch verraten würdest, wo ich die Information finde, dann teile ich Dir die gerne mit.
Auf dem Gerät selbst habe ich aktuell 3 von 5 Balken.
In der Xiaomi Mi Home App, finde ich keine Batterieinformationen, oder ich bin blind  :o