Xiaomi Thermo- Hygrometer Sensor mit XiaomiBTLESens anbinden

Begonnen von iceman, 19 Oktober 2018, 17:15:48

Vorheriges Thema - Nächstes Thema

iceman

Hallo zusammen,

ich versuche gerade einen Xiaomi Thermo- Hygrometer Sensor einzubinden. Habe mittels  hcitool lescan die BT-MAC Adresse rausbekommen alles schön in fhem eingerichtet:


define MI_Sensor_1 XiaomiBTLESens 4C:65:A8:D8:E6:73
attr MI_Sensor_1 model thermoHygroSens
attr MI_Sensor_1 verbose 5


leider bekomme ich beim auslesen immer nur error als State:


Internals
BTMAC 4C:65:A8:D8:E6:73
DEF 4C:65:A8:D8:E6:73
INTERVAL 300
NAME MI_Sensor_1
NOTIFYDEV global,MI_Sensor_1
NR 589
NTFY_ORDER 50-MI_Sensor_1
STATE error
TYPE XiaomiBTLESens
VERSION 2.2.2
loglevel 4

Readings
lastGattError The BlockingCall Process terminated unexpectedly. Timedout 2018-10-19 17:08:52
state error 2018-10-19 17:08:52

Attributes
model thermoHygroSens deleteattr
verbose 5 deleteattr


Im Log steht folgendes:


2018.10.19 16:49:32 4: XiaomiBTLESens (MI_Sensor_1) - Run CreateParamGatttool with mod: read
2018.10.19 16:49:33 5: XiaomiBTLESens (MI_Sensor_1) - Read XiaomiBTLESens_ExecGatttool_Run MI_Sensor_1|4C:65:A8:D8:E6:73|read|0x24
2018.10.19 16:49:33 4: XiaomiBTLESens (MI_Sensor_1) - stateRequestTimer: Call Request Timer
2018.10.19 16:49:33 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-read -a 0x24 2>&1 /dev/null and loop 0
2018.10.19 16:50:13 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool loop result connect error,Connection refused (111)

2018.10.19 16:50:13 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-read -a 0x24 2>&1 /dev/null and loop 1
2018.10.19 16:50:53 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool loop result connect error,Connection refused (111)

2018.10.19 16:50:53 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-read -a 0x24 2>&1 /dev/null and loop 2
2018.10.19 16:51:02 1: Timeout for XiaomiBTLESens_ExecGatttool_Run reached, terminated process 19077
2018.10.19 16:51:03 4: XiaomiBTLESens (MI_Sensor_1) - WriteReadings: Readings were written
2018.10.19 16:51:03 4: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Aborted: The BlockingCall Process terminated unexpectedly. Timedout


Kann mir hier jemand weiterhelfen? Was mach ich falsch bzw. hab ich was vergessen?

Danke schon mal.

CoolTux

Die Verbindung wird abgewiesen. Ist der Sensor noch gepaired mit dem Handy oder läuft hcitool noch?
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

iceman

Kann beides verneinen. hcitool läuft nicht und gepaired hab ich das Teil noch nie.

iceman

Ach ja, ich benutze Ubuntu 16.04 mit gattool Version 5.37. Ist das ein Problem?

CoolTux

Kann ich nicht sagen. Aber da Du das aktuelle Problem hast wäre es durchaus möglich. Meine Empfehlung bevor jetzt irgendwas mache/rate und meine Zeit investiere ist ein Update zu machen.
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

iceman

Danke, tatsächlich gab es eine neue Version. Jetzt hab ich einmal Daten bekommen aber danach wieder error:


lastGattError no data response 2018-10-19 19:46:02
state error 2018-10-19 19:46:02

CoolTux

Zitat von: iceman am 19 Oktober 2018, 19:49:54
Danke, tatsächlich gab es eine neue Version. Jetzt hab ich einmal Daten bekommen aber danach wieder error:


lastGattError no data response 2018-10-19 19:46:02
state error 2018-10-19 19:46:02


Das hilft mir leider nicht.  ;)
In Deinem ersten Post hast Du es genau richtig gemacht. Genau diese Angaben brauche ich.
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

iceman

Okay,


Internals
BTMAC 4C:65:A8:D8:E6:73
DEF 4C:65:A8:D8:E6:73
INTERVAL 300
NAME MI_Sensor_1
NOTIFYDEV global,MI_Sensor_1
NR 588
NTFY_ORDER 50-MI_Sensor_1
STATE error
TYPE XiaomiBTLESens
VERSION 2.4.0
loglevel 4

Readings
batteryPercent 82 2018-10-19 19:21:29
batteryState ok 2018-10-19 19:21:29
firmware 00.00.66 2018-10-19 17:20:33
humidity 57.0 2018-10-19 21:10:17
lastGattError no data response 2018-10-19 21:26:55
state error 2018-10-19 21:26:55
temperature 21.5 2018-10-19 21:10:17
temperature_avg_day 23.3 2018-10-19 21:10:17
temperature_avg_month 23.6 2018-10-19 21:10:17
temperature_cum_day 1778935.3 2018-10-19 21:10:17
temperature_cum_month 40520695.3 2018-10-19 21:10:17
temperature_max_day 23.9 2018-10-19 17:59:15
temperature_max_month 23.9 2018-10-19 17:59:15
temperature_min_day 21.5 2018-10-19 21:10:17
temperature_min_month 21.5 2018-10-19 21:10:17

Attributes
model thermoHygroSens deleteattr
room 1.0_Temperaturen deleteattr
verbose 5 deleteattr


Im Logfile kommen jetzt ordentlich Infos an...


2018.10.19 20:49:11 4: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool result Characteristic value was written successfully
Notification handle = 0x000e value,54 3d 32 31 2e 36 20 48 3d 35 37 2e 30 00
Notification handle = 0x000e value,54 3d 32 31 2e 36 20 48 3d 35 37 2e 31 00
Notification handle = 0x000e value,54 3d 32 31 2e 36 20 48 3d 35 37 2e 33 00
Notification handle = 0x000e value,54 3d 32 31 2e 37 20 48 3d 35 37 2e 31 00
Notification handle = 0x000e value,54 3d 32 31 2e 36 20 48 3d 35 37 2e 31 00
Notification handle = 0x000e value,54 3d 32 31 2e 36 20 48 3d 35 37 2e 30 00
Notification handle = 0x000e value,54 3d 32 31 2e 36 20 48 3d 35 37 2e 32 00
Notification handle = 0x000e value,54 3d 32 31 2e 36 20 48 3d 35 37 2e 31 00

2018.10.19 20:49:11 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Done: gatttool return string: MI_Sensor_1|4C:65:A8:D8:E6:73|ok|write|0x10|{"gtResult":"54 3d 32 31 2e 36 20 48 3d 35 37 2e 30 00 "}
2018.10.19 20:49:11 4: XiaomiBTLESens (MI_Sensor_1) - ProcessingNotification
2018.10.19 20:49:11 4: XiaomiBTLESens (MI_Sensor_1) - ProcessingNotification: handle 0x10
2018.10.19 20:49:11 4: XiaomiBTLESens (MI_Sensor_1) - Thermo/Hygro Sens Handle0x10
2018.10.19 20:49:11 4: XiaomiBTLESens (MI_Sensor_1) - WriteReadings: Readings were written
2018.10.19 20:54:27 4: XiaomiBTLESens (MI_Sensor_1) - Run CreateParamGatttool with mod: write
2018.10.19 20:54:27 5: XiaomiBTLESens (MI_Sensor_1) - Write XiaomiBTLESens_ExecGatttool_Run MI_Sensor_1|4C:65:A8:D8:E6:73|write|0x10|0100
2018.10.19 20:54:27 4: XiaomiBTLESens (MI_Sensor_1) - stateRequestTimer: Call Request Timer
2018.10.19 20:54:28 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: timeout 10 gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null and loop 0
2018.10.19 20:54:38 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool loop result
2018.10.19 20:54:38 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: timeout 10 gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null and loop 1
2018.10.19 20:54:48 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool loop result
2018.10.19 20:54:48 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: timeout 10 gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null and loop 2
2018.10.19 20:54:58 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool loop result
2018.10.19 20:54:58 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: timeout 10 gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null and loop 3
2018.10.19 20:55:08 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool loop result
2018.10.19 20:55:08 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: timeout 10 gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null and loop 4
2018.10.19 20:55:18 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool loop result
2018.10.19 20:55:18 4: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool result connect error
2018.10.19 20:55:18 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Done: gatttool return string: MI_Sensor_1|4C:65:A8:D8:E6:73|error|write|0x10|{"gtResult":"no data response"}
2018.10.19 20:55:18 4: XiaomiBTLESens (MI_Sensor_1) - ProcessingErrors
2018.10.19 20:55:18 4: XiaomiBTLESens (MI_Sensor_1) - WriteReadings: Readings were written
2018.10.19 21:03:05 4: XiaomiBTLESens (MI_Sensor_1) - Run CreateParamGatttool with mod: write
2018.10.19 21:03:05 5: XiaomiBTLESens (MI_Sensor_1) - Write XiaomiBTLESens_ExecGatttool_Run MI_Sensor_1|4C:65:A8:D8:E6:73|write|0x10|0100
2018.10.19 21:03:05 4: XiaomiBTLESens (MI_Sensor_1) - stateRequestTimer: Call Request Timer
2018.10.19 21:03:06 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: timeout 10 gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null and loop 0
2018.10.19 21:03:16 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool loop result
2018.10.19 21:03:16 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: timeout 10 gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null and loop 1
2018.10.19 21:03:26 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool loop result
2018.10.19 21:03:26 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: timeout 10 gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null and loop 2
2018.10.19 21:03:36 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool loop result Characteristic value was written successfully

2018.10.19 21:03:36 4: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool result Characteristic value was written successfully

2018.10.19 21:03:36 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Done: gatttool return string: MI_Sensor_1|4C:65:A8:D8:E6:73|ok|write|0x10|{"gtResult":"no data response"}
2018.10.19 21:03:36 4: XiaomiBTLESens (MI_Sensor_1) - ProcessingNotification
2018.10.19 21:03:36 4: XiaomiBTLESens (MI_Sensor_1) - ProcessingNotification: handle 0x10
2018.10.19 21:03:36 4: XiaomiBTLESens (MI_Sensor_1) - Thermo/Hygro Sens Handle0x10
2018.10.19 21:03:36 4: XiaomiBTLESens (MI_Sensor_1) - WriteReadings: Readings were written
2018.10.19 21:03:36 4: XiaomiBTLESens (MI_Sensor_1) - WriteReadings: Readings were written
2018.10.19 21:09:28 4: XiaomiBTLESens (MI_Sensor_1) - Run CreateParamGatttool with mod: write
2018.10.19 21:09:29 5: XiaomiBTLESens (MI_Sensor_1) - Write XiaomiBTLESens_ExecGatttool_Run MI_Sensor_1|4C:65:A8:D8:E6:73|write|0x10|0100
2018.10.19 21:09:29 4: XiaomiBTLESens (MI_Sensor_1) - stateRequestTimer: Call Request Timer
2018.10.19 21:09:29 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: timeout 10 gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null and loop 0
2018.10.19 21:09:39 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool loop result
2018.10.19 21:09:39 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: timeout 10 gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null and loop 1
2018.10.19 21:09:49 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool loop result
2018.10.19 21:09:49 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: timeout 10 gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null and loop 2
2018.10.19 21:09:59 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool loop result connect error,Transport endpoint is not connected (107)

2018.10.19 21:09:59 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: timeout 10 gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null and loop 3
2018.10.19 21:10:07 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool loop result connect error,Transport endpoint is not connected (107)

2018.10.19 21:10:07 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: call gatttool with command: timeout 10 gatttool -i hci0 -b 4C:65:A8:D8:E6:73 --char-write-req -a 0x10 -n 0100 --listen 2>&1 /dev/null and loop 4
2018.10.19 21:10:17 5: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool loop result Characteristic value was written successfully
Notification handle = 0x000e value,54 3d 32 31 2e 35 20 48 3d 35 37 2e 30 00
Notification handle = 0x000e value,54 3d 32 31 2e 35 20 48 3d 35 37 2e 31 00
Notification handle = 0x000e value,54 3d 32 31 2e 36 20 48 3d 35 37 2e 32 00
Notification handle = 0x000e value,54 3d 32 31 2e 36 20 48 3d 35 37 2e 31 00

2018.10.19 21:10:17 4: XiaomiBTLESens (MI_Sensor_1) - ExecGatttool_Run: gatttool result Characteristic value was written successfully
Notification handle = 0x000e value,54 3d 32 31 2e 35 20 48 3d 35 37 2e 30 00
Notification handle = 0x000e value,54 3d 32 31 2e 35 20 48 3d 35 37 2e 31 00
Notification handle = 0x000e value,54 3d 32 31 2e 36 20 48 3d 35 37 2e 32 00
Notification handle = 0x000e value,54 3d 32 31 2e 36 20 48 3d 35 37 2e 31 00


Die Error States wechseln unter anderem hatte ich auch schon charWrite faild

CoolTux

Es scheint aber zu gehen. Nur nicht jeder Durchlauf. Liegt der Sensor weit weg vom Bluetooth Stick und FHEM Server?
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

iceman


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

iceman


CoolTux

Zitat von: iceman am 19 Oktober 2018, 19:49:54
Danke, tatsächlich gab es eine neue Version. Jetzt hab ich einmal Daten bekommen aber danach wieder error:


lastGattError no data response 2018-10-19 19:46:02
state error 2018-10-19 19:46:02

Das war vor Deinem Update, was hat Dein gatttool nach dem Update für eine Version?
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

iceman

Ein Update gab es nur bei fhem, also vom XiaomiBTLESens Modul.

Ubuntu zeigt mir immer noch die Version 5.37 und da gibt es auch kein update.

CoolTux

Wir reden über die gatttool Version und Du schreibst es gab ein Update und hälst es nicht für nötig zu erwähnen das es ein FHEM Update war.
Das Problem kann eine veraltete gatttool Version sein, Infos findet man dazu im Internet sehr viele.

Mach bitte ein Distributionsupdate und wenn Du dann noch Probleme hast höre ich sie mir sehr gerne an. Bis dahin.



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

iceman

So nun bin ich auf Ubuntu 18.04 LTS und hcitool 5.48.

Es scheint nun stabiler zu laufen. Allerdings scheint die Reichweite etwas zu wünschen übrig zu lassen. Eine Zimmerdecke und eine Zimmerwand und es gibt keine Verbindung. Da muss ich wohl noch optimieren.

CoolTux

Zitat von: iceman am 20 Oktober 2018, 22:28:33
So nun bin ich auf Ubuntu 18.04 LTS und hcitool 5.48.

Es scheint nun stabiler zu laufen. Allerdings scheint die Reichweite etwas zu wünschen übrig zu lassen. Eine Zimmerdecke und eine Zimmerwand und es gibt keine Verbindung. Da muss ich wohl noch optimieren.

Das ist normal. Du kannst Satelliten bauen und dann mittels dem sshHost Attribut die Sensoren abfragen. Aber bitte lese dazu die Commandref wegen Passwort losen ssh.
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

iceman

Zitat von: CoolTux am 20 Oktober 2018, 22:31:06
Du kannst Satelliten bauen und dann mittels dem sshHost Attribut die Sensoren abfragen. Aber bitte lese dazu die Commandref wegen Passwort losen ssh.

Ja das ist wohl das nächste um dass ich mich kümmern muss.

Hab mir gerade ein Raspberry PI Zero W bestellt. Eventuell brauch ich dafür noch deine Hilfe CoolTUX.

CoolTux

Ich denke das bekommen wir hin.
Zum passwortlosen ssh kannst Du ja bisschen vorlesen, Ottos Blog ist da Hilfreich. Und wenn noch Fragen sind meldest Dich einfach.
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