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

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

Vorheriges Thema - Nächstes Thema

distel

Zitat von: CoolTux am 26 Januar 2018, 20:09:32
Also hier sieht alles super aus. Bei allen drei Beispielen.
Jein. Bei 1 und 2 ists ok. Bei 3 siehts gut aus, aber da fehlt noch was: Die Verarbeitung und das setzen der Readings. Sprich es erfolgt keine Aktualisierung :-/
NUC-I37100
Docker: eBus, fhem, ha-bridge, unifi
Hardware: Homematic, FS20, Somfy RTS, 1wire, FBAHA, enOcean

CoolTux

Zitat von: distel am 26 Januar 2018, 20:04:58

2018.01.26 19:55:30 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: call gatttool with command ssh fhem@radiohub-1.home 'gatttool -i hci0 -b <MAC> --char-read -a 0x35 2>&1 /dev/null' and loop 0
2018.01.26 19:55:31 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: gatttool loop result Characteristic value/descriptor,08 36 00 10 00

2018.01.26 19:55:31 4: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: gatttool result Characteristic value/descriptor,08 36 00 10 00

2018.01.26 19:55:31 4: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Done: gatttool return string: xbtle.temp.eg.flur|<MAC>|ok|read|0x35|{"gtResult":"08 36 00 10 00 "}
2018.01.26 19:55:31 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ProcessingNotification
2018.01.26 19:55:31 4: XiaomiBTLESens (xbtle.temp.eg.flur) - WriteReadings: Readings were written


Also zu mindest steht WriteReadings: Readings da.
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

distel

Zitat von: CoolTux am 26 Januar 2018, 22:33:22
Also zu mindest steht WriteReadings: Readings da.
Stimmt, aber das einzige Reading, das aktualisiert wird ist state. Daher hatte ich das "nur" mit dem Lesen von 0x35 in Verbindung gebracht. Hier der Stand grad nach dem get sensordata:

Internals:
   BTMAC      <MAC>
   DEF        <MAC>
   INTERVAL   300
   NAME       xbtle.temp.eg.flur
   NOTIFYDEV  global,xbtle.temp.eg.flur
   NR         314
   NTFY_ORDER 50-xbtle.temp.eg.flur
   STATE      T: 21.5 °C / H: 48.5 %
   TYPE       XiaomiBTLESens
   VERSION    2.0.6debug
   loglevel   4
   READINGS:
     2018-01-26 15:37:33   battery         ok
     2018-01-26 15:37:33   batteryLevel    96
     2018-01-26 19:54:24   devicename      EG.Test
     2018-01-26 19:55:03   firmware        00.00.66
     2018-01-26 19:44:44   humidity        48.5
     2018-01-26 22:36:48   lastGattError   The BlockingCall Process terminated unexpectedly. Timedout
     2018-01-26 22:40:03   state           active
     2018-01-26 19:44:44   temperature     21.5
   helper:
     CallBattery 0
     CallSensDataCounter 0
     updateTimeCallBattery 1516977453.14894
     updateTimestampCallBattery 2018-01-26 15:37:33
Attributes:
   alias      Temperatur EG.Flur
   comment    fhem@radiohub-1.home
   group      Temperatur
   icon       temp_temperature
   interval   300
   model      thermoHygroSens
   room       Sensoren
   sshHost    fhem@radiohub-1.home
   stateFormat {"T: " . ReadingsVal($name,"temperature",0) . " °C / H: " . ReadingsVal($name,"humidity",0) . " %"}
   verbose    5


PS: Ja, da wo es jetzt liegt ist's wärmer ;)
NUC-I37100
Docker: eBus, fhem, ha-bridge, unifi
Hardware: Homematic, FS20, Somfy RTS, 1wire, FBAHA, enOcean

CoolTux

Das Problem ist leider das gatttool anscheinend auch mal locker 30s wartet bis es abbricht. BlockingCall aber nur 60s läuft und dann abbricht. Wenn es dann schon der 4. Versuch ist geht es ins Timeout. Ich weiß nicht wie es ist wenn man BlockingCall mehr Zeit gibt. Müsste man aus testen.
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

frank_41

Hm, ich bin's noch mal.
Also inzwischen hat fhem zu den meisten Flowersense Sensoren mal Kontakt gekriegt.
Der Abstand zum Raspi ist wohl an der Kante des Empfangs.
Das würde mich nicht stören.
Allerdings wird das logfile mit den timeout Meldungen vollgemüllt :

Timeout for XiaomiBTLESens_ExecGatttool_Run reached, terminated process xxxxx

Kann man diese Meldungen abstellen ??
Vielen Dank schonmal
Gruß
Frank


Raspberry Pi 3
RFXCOM_RFXtrx433
V 1.62 nanoCUL433
Jeelink LaCrosse
Jeelink PCA301.CUL_HM,Conbee, deCONZ

CoolTux

Zitat von: frank_41 am 27 Januar 2018, 00:47:52
Hm, ich bin's noch mal.
Also inzwischen hat fhem zu den meisten Flowersense Sensoren mal Kontakt gekriegt.
Der Abstand zum Raspi ist wohl an der Kante des Empfangs.
Das würde mich nicht stören.
Allerdings wird das logfile mit den timeout Meldungen vollgemüllt :

Timeout for XiaomiBTLESens_ExecGatttool_Run reached, terminated process xxxxx

Kann man diese Meldungen abstellen ??
Vielen Dank schonmal
Gruß
Frank

Verbose auf 2 setzen. Ich werde mir das ganze die Tage noch mal anschauen.
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

distel

Ich werde irgendwie das Gefühl nicht los, dass es sonniger wäre, eine kleine Software zu nutzen, die auf nem Pi (o.ä.) autonom die Sensoren abfragt und in fhem 'nur' die Werte aus solch einem 'Cache' abzufragen/einzubinden. Bei einem Thermometer ist ja noch alles okay, wenn es aber mehr werden... Gut, fhem2fhem wäre ja auch immer noch eine Lösung.
NUC-I37100
Docker: eBus, fhem, ha-bridge, unifi
Hardware: Homematic, FS20, Somfy RTS, 1wire, FBAHA, enOcean

MadMax-FHEM

Einbindung per ssh ist doch genau das!?

Die kleine SW heißt gattool... ;)

Hab meine alle per ssh eingebunden über einen PI Zero W der den Sensoren nahe ist...

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

distel

Zitat von: MadMax-FHEM am 27 Januar 2018, 07:59:23
Einbindung per ssh ist doch genau das!?

Jein. Aktuell erscheint mir die Kommunikation mit dem Thermometer etwas fragil, zeitlich lang und blockieren für fhem. Daher meine ich eine echte Entkopplung. Wie gesagt: fhem2fhem wäre eine Option.
NUC-I37100
Docker: eBus, fhem, ha-bridge, unifi
Hardware: Homematic, FS20, Somfy RTS, 1wire, FBAHA, enOcean

MadMax-FHEM

Warum blockierend?

Soweit ich die Implementierung kenne ist es non-blocking...

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

CoolTux

Es ist auch non-blocking

ich werde noch etwas mit den Werten spielen und schauen.
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

distel

NUC-I37100
Docker: eBus, fhem, ha-bridge, unifi
Hardware: Homematic, FS20, Somfy RTS, 1wire, FBAHA, enOcean

CoolTux

neue Version im Develzweig zum testen.
Distel bitte teste die einmal.

Kleine Info am Rande. Bei BTLE kann es mitunter um cm gehen in Abhängigkeit der Umwelt. Ich merke das ganz doll bei einem meiner Pflanzensensoren. Wenn ich den Topf mit dem es hin und wieder hackt um 50 cm zum Empfänger rücke geht es wieder. Es gibt Tage da geht es ohne Probleme und andere wo das Wetter augenscheinlich feuchter ist hängt er oft.



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

distel

Zitat von: CoolTux am 27 Januar 2018, 11:57:31
neue Version im Develzweig zum testen.
Distel bitte teste die einmal.

Also im Ergebnis: Sensorwerte werden ein, zwei Mal ausgelesen und in die readings geschrieben, aber dann bleibt gatttool als Zombie auf dem remote-system stehen. Allerdings scheint es (bei der Häufigkeit) auch irgendwie konkurrierende Zugriffe zu geben.

2018.01.27 12:25:12 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: call gatttool with command timeout 10 ssh fhem@radiohub-1.home 'gatttool -i hci0 -b 4C:65:A8:D0:42:63 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null' and loop 0
2018.01.27 12:25:21 1: NOTE: WEB is probed by a search engine
2018.01.27 12:25:22 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: gatttool loop result Characteristic value was written successfully
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 38 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00

2018.01.27 12:25:22 4: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: gatttool result Characteristic value was written successfully
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 38 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00

2018.01.27 12:25:23 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: call gatttool with command ssh fhem@radiohub-1.home 'gatttool -i hci0 -b 4C:65:A8:D0:42:63 --char-read -a 0x35 2>&1 /dev/null' and loop 0
2018.01.27 12:25:24 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: gatttool loop result Characteristic value/descriptor,08 36 00 10 00

2018.01.27 12:25:24 4: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: gatttool result Characteristic value/descriptor,08 36 00 10 00

2018.01.27 12:25:24 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Done: gatttool return string: xbtle.temp.eg.flur|4C:65:A8:D0:42:63|ok|read|0x35|{"gtResult":"08 36 00 10 00 "}
2018.01.27 12:25:24 4: XiaomiBTLESens (xbtle.temp.eg.flur) - ProcessingNotification
2018.01.27 12:25:24 4: XiaomiBTLESens (xbtle.temp.eg.flur) - WriteReadings: Readings were written
2018.01.27 12:25:24 4: XiaomiBTLESens (xbtle.temp.eg.flur) - Run CreateParamGatttool with mod: write
2018.01.27 12:25:24 5: XiaomiBTLESens (xbtle.temp.eg.flur) - Write XiaomiBTLESens_ExecGatttool_Run xbtle.temp.eg.flur|4C:65:A8:D0:42:63|write|0x10|0100
2018.01.27 12:25:25 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: call gatttool with command timeout 10 ssh fhem@radiohub-1.home 'gatttool -i hci0 -b 4C:65:A8:D0:42:63 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null' and loop 0
2018.01.27 12:25:26 4: XiaomiBTLESens (xbtle.temp.eg.flur) - WriteReadings: Readings were written
2018.01.27 12:25:26 4: XiaomiBTLESens (xbtle.temp.eg.flur) - Run CreateParamGatttool with mod: write
2018.01.27 12:25:26 5: XiaomiBTLESens (xbtle.temp.eg.flur) - Write XiaomiBTLESens_ExecGatttool_Run xbtle.temp.eg.flur|4C:65:A8:D0:42:63|write|0x10|0100
2018.01.27 12:25:26 4: XiaomiBTLESens (xbtle.temp.eg.flur) - stateRequestTimer: Call Request Timer
2018.01.27 12:25:35 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: gatttool loop result Characteristic value was written successfully
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 38 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 36 00

2018.01.27 12:25:35 4: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: gatttool result Characteristic value was written successfully
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 38 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 36 00

2018.01.27 12:25:36 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: call gatttool with command ssh fhem@radiohub-1.home 'gatttool -i hci0 -b 4C:65:A8:D0:42:63 --char-read -a 0x35 2>&1 /dev/null' and loop 0
2018.01.27 12:25:42 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: gatttool loop result Characteristic value/descriptor,08 36 00 10 00

2018.01.27 12:25:42 4: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: gatttool result Characteristic value/descriptor,08 36 00 10 00

2018.01.27 12:25:42 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Done: gatttool return string: xbtle.temp.eg.flur|4C:65:A8:D0:42:63|ok|read|0x35|{"gtResult":"08 36 00 10 00 "}
2018.01.27 12:25:42 4: XiaomiBTLESens (xbtle.temp.eg.flur) - ProcessingNotification
2018.01.27 12:25:42 4: XiaomiBTLESens (xbtle.temp.eg.flur) - WriteReadings: Readings were written
2018.01.27 12:25:42 4: XiaomiBTLESens (xbtle.temp.eg.flur) - Run CreateParamGatttool with mod: write
2018.01.27 12:25:42 5: XiaomiBTLESens (xbtle.temp.eg.flur) - Write XiaomiBTLESens_ExecGatttool_Run xbtle.temp.eg.flur|4C:65:A8:D0:42:63|write|0x10|0100
2018.01.27 12:25:44 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: call gatttool with command timeout 10 ssh fhem@radiohub-1.home 'gatttool -i hci0 -b 4C:65:A8:D0:42:63 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null' and loop 0
2018.01.27 12:25:54 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: gatttool loop result Characteristic value was written successfully
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 38 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 39 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00
Notification handle = 0x000e value,54 3d 32 31 2e 37 20 48 3d 34 36 2e 37 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 39 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 38 00

2018.01.27 12:25:54 4: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: gatttool result Characteristic value was written successfully
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 38 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 39 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00
Notification handle = 0x000e value,54 3d 32 31 2e 37 20 48 3d 34 36 2e 37 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 39 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 38 00

2018.01.27 12:25:54 3: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: another gatttool process is running. waiting...
2018.01.27 12:25:56 3: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: another gatttool process is running. waiting...
2018.01.27 12:25:57 3: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: another gatttool process is running. waiting...


PS: Ich geb das MAC-ausstreichen auf. Bei der Reichweite ists eh egal und die Dinger geben sich ja auch ohne Pairing nicht grad zugeknöpft ;)
NUC-I37100
Docker: eBus, fhem, ha-bridge, unifi
Hardware: Homematic, FS20, Somfy RTS, 1wire, FBAHA, enOcean

distel

Ich hab grad mal das Log leergemacht und das device vorher disabled. Dann schaut es beim enablen leider auch nicht besser aus: Zombi bleibt und stört den Fortgang:

2018.01.27 12:32:36 3: XiaomiBTLESens (xbtle.temp.eg.flur) - enabled
2018.01.27 12:32:36 4: XiaomiBTLESens (xbtle.temp.eg.flur) - Run CreateParamGatttool with mod: write
2018.01.27 12:32:36 5: XiaomiBTLESens (xbtle.temp.eg.flur) - Write XiaomiBTLESens_ExecGatttool_Run xbtle.temp.eg.flur|4C:65:A8:D0:42:63|write|0x10|0100
2018.01.27 12:32:36 4: XiaomiBTLESens (xbtle.temp.eg.flur) - stateRequestTimer: Call Request Timer
2018.01.27 12:32:37 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: call gatttool with command timeout 10 ssh fhem@radiohub-1.home 'gatttool -i hci0 -b 4C:65:A8:D0:42:63 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null' and loop 0
2018.01.27 12:32:47 5: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: gatttool loop result Characteristic value was written successfully
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 38 00
Notification handle = 0x000e value,54 3d 32 31 2e 39 20 48 3d 34 36 2e 38 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 36 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00

2018.01.27 12:32:47 4: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: gatttool result Characteristic value was written successfully
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 38 00
Notification handle = 0x000e value,54 3d 32 31 2e 39 20 48 3d 34 36 2e 38 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 36 00
Notification handle = 0x000e value,54 3d 32 31 2e 38 20 48 3d 34 36 2e 37 00

2018.01.27 12:32:47 3: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: another gatttool process is running. waiting...
2018.01.27 12:32:49 3: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: another gatttool process is running. waiting...
2018.01.27 12:32:50 3: XiaomiBTLESens (xbtle.temp.eg.flur) - ExecGatttool_Run: another gatttool process is running. waiting...
NUC-I37100
Docker: eBus, fhem, ha-bridge, unifi
Hardware: Homematic, FS20, Somfy RTS, 1wire, FBAHA, enOcean