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

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

Vorheriges Thema - Nächstes Thema

trinitywhm

Ja es hat schonmal funktioniert. Der Fehler ist mir erst heute aufgefallen (schließe aber nicht aus, dass er schon früher aufgetreten ist).Kurioserweise scheint es zwischendurch immer mal wieder zu funktionieren.
Hier ein List des Devices:


Internals:
   BTMAC      C4:7C:8D:65:BD:DA
   DEF        C4:7C:8D:65:BD:DA
   INTERVAL   300
   NAME       WZ_Pflanze2
   NOTIFYDEV  global,WZ_Pflanze2
   NR         28
   NTFY_ORDER 50-WZ_Pflanze2
   STATE      Feuchte: 15 / 19 / 65</br>Dünger: 350 / 302 / 2000</br>Temperatur: 15 / 19.2 / 32</br>
   TYPE       XiaomiBTLESens
   VERSION    2.0.9
   loglevel   4
   Helper:
     DBLOG:
       battery:
         DBLogging:
           TIME       1519468697.33605
           VALUE      ok
       batteryLevel:
         DBLogging:
           TIME       1519468697.33605
           VALUE      99
       fertility:
         DBLogging:
           TIME       1519476386.42621
           VALUE      302
       lux:
         DBLogging:
           TIME       1519476386.42621
           VALUE      90
       moisture:
         DBLogging:
           TIME       1519476386.42621
           VALUE      19
       state:
         DBLogging:
           TIME       1519476746.95788
           VALUE      error
       temperature:
         DBLogging:
           TIME       1519476386.42621
           VALUE      19.2
   READINGS:
     2018-02-24 11:38:17   battery         ok
     2018-02-24 11:38:17   batteryLevel    99
     2018-02-24 13:46:26   fertility       302
     2018-02-24 11:38:17   firmware        3.1.8
     2018-02-24 14:32:21   lastGattError   Invalid argument (22)
     2018-02-24 13:46:26   lux             90
     2018-02-24 13:46:26   moisture        19
     2018-02-24 14:32:21   state           error
     2018-02-24 13:46:26   temperature     19.2
     2018-02-24 14:32:21   uistate         hungrig
   helper:
     CallBattery 0
     CallSensDataCounter 0
     updateTimeCallBattery 1519468697.33218
     updateTimestampCallBattery 2018-02-24 11:38:17
Attributes:
   DbLogExclude .*
   DbLogInclude battery,batteryLevel,temperature,moisture,fertility,lux
   alias      Friedenslilie
   event-min-interval battery:21600,batteryLevel:21600,temperature:600,moisture:600,fertility:600,lux:300
   event-on-change-reading state
   event-on-update-reading .*
   icon       hue_room_garden
   maxFertility 2000
   maxLux     3200
   maxMoisture 65
   maxTemp    32
   minFertility 350
   minLux     1600
   minMoisture 15
   minTemp    15
   model      flowerSens
   room       20_Wohnzimmer
   stateFormat {"Feuchte: ".AttrVal($name,"minMoisture","")." / ".ReadingsVal($name,"moisture","")." / ".AttrVal($name,"maxMoisture","")."</br>".
"Dünger: ".AttrVal($name,"minFertility","")." / ".ReadingsVal($name,"fertility","")." / ".AttrVal($name,"maxFertility","")."</br>".
"Temperatur: ".AttrVal($name,"minTemp","")." / ".ReadingsVal($name,"temperature","")." / ".AttrVal($name,"maxTemp","")."</br>"}
   userReadings uistate {my $moist = ReadingsVal($name, "moisture",0);; my $minmoist = AttrVal($name,"minMoisture",10);; my $fert = ReadingsVal($name, "fertility",0);; my $minfert = AttrVal($name,"minFertility",50);; if ($moist < $minmoist && $fert < $minfert) {return "durstig+hungrig"} elsif ($moist < $minmoist) {return "durstig"} elsif ($fert < $minfert) {return "hungrig"} else {return "ok"}}
   verbose    3

Das fiel mir zunächst auf weil es keinen Plotabriss gab. Und auch in der DB stehen aktuelle Werte über den Tag verteilt. Dazwischen dann immer mal wieder ein Error.

Aber die Timeout-Meldungen im Log häufen sich heute auch wieder mehr als an anderen Tagen. Vielleicht hängt es ja auch damit zusammen:
2018.02.24 14:30:14 1: Timeout for XiaomiBTLESens_ExecGatttool_Run reached, terminated process 6124

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

gent

Hallo,

kann ich irgendwie das XiaomiFlowerSens Modul durch das XiaomiBTLESens Modul austauschen, ohne alles neu konfigurieren zu müssen und auch meine logs zu verlieren?

Viele Grüße, Holger
fhem auf rPi3 mit USB boot und M2, cul866 (hm), homebridge, FlowerSens, Shelly, Harmony, WemosD1, Sonoff/Tasmota, grafana, mqtt/mosquitto

CoolTux

Ohne Dir jetzt zu Nahe zu treten und bitte nicht sauer sein, aber wenn Du fragst dann muss ich mit Nein antworten. Die Definition und alles ist ja so geblieben es hat sich nur der Type geändert. Das define wäre also an zu passen. Wenn du nicht weißt wie dann mach es bitte einfach neu. Ist besser als wenn irgendwas kaputt geht.
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: gent am 02 März 2018, 19:40:28
auch meine logs zu verlieren?
Ohne genaue Kenntnis deiner Config ist das natürlich schwer zu sagen. Wie loggst du? Wie ist das/sind die Log Device(s) konfiguriert? Wie willst du migrieren? ...einen Automatismus gibt  es nicht. Backup vorher wäre wohl angeraten!
NUC-I37100
Docker: eBus, fhem, ha-bridge, unifi
Hardware: Homematic, FS20, Somfy RTS, 1wire, FBAHA, enOcean

gent

Zitat von: CoolTux am 02 März 2018, 19:59:24
Ohne Dir jetzt zu Nahe zu treten und bitte nicht sauer sein, aber wenn Du fragst dann muss ich mit Nein antworten. Die Definition und alles ist ja so geblieben es hat sich nur der Type geändert. Das define wäre also an zu passen. Wenn du nicht weißt wie dann mach es bitte einfach neu. Ist besser als wenn irgendwas kaputt geht.

Hi, also wenn das alles ist, dann kriege ich das natürlich hin. Dann erübrigt sich natürlich die Frage nach den log-Devices und so. Und ich bin natürlich nicht sauer. Der Schubser in die richtige Richtung hat ja gereicht. Ich war mir halt nicht sicher, ob das alles ist.


Gesendet von iPad mit Tapatalk Pro
fhem auf rPi3 mit USB boot und M2, cul866 (hm), homebridge, FlowerSens, Shelly, Harmony, WemosD1, Sonoff/Tasmota, grafana, mqtt/mosquitto

CoolTux

Heute stand bei mir nach langer Zeit ein Batteriewechsel an. Leider habe ich nicht sofort den neuen Batteriestatus gesehen da der Timestamp für den Batteriewechsel noch nicht alt genug war.
Daher gibt es nun ein
set resetBatteryTimestamp

Damit wird automatisch ein neu einlesen des Batteriestatus erzwungen.
Update kommt die Tage


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

HeikoS

Ich habe heute Mittag ein FHEM-Update und damit auch ein Update des Moduls auf 2.0.10 gemacht.
Genau ab dem Zeitpunkt bekomme ich keine Werte mehr von meinem FlowerSensor. Mit der Mi Flower Care App lässt er sich ganz normal auslesen. Hardware-Firmware ist laut App 3.1.8 (aktuell).

Log mit Verbose 5
2018.03.18 22:18:53 4: XiaomiBTLESens (Wz_Palme) - Run CreateParamGatttool with mod: write
2018.03.18 22:18:53 5: XiaomiBTLESens (Wz_Palme) - Write XiaomiBTLESens_ExecGatttool_Run Wz_Palme|C4:7C:8D:65:C4:46|write|0x33|A01F
2018.03.18 22:18:53 5: XiaomiBTLESens (Wz_Palme) - ExecGatttool_Run: call gatttool with command: gatttool -i hci0 -b C4:7C:8D:65:C4:46 --char-write-req -a 0x33 -n A01F 2>&1 /dev/null and loop 0
2018.03.18 22:18:56 5: XiaomiBTLESens (Wz_Palme) - ExecGatttool_Run: gatttool loop result Characteristic value was written successfully

2018.03.18 22:18:56 4: XiaomiBTLESens (Wz_Palme) - ExecGatttool_Run: gatttool result Characteristic value was written successfully

2018.03.18 22:18:56 5: XiaomiBTLESens (Wz_Palme) - ExecGatttool_Done: gatttool return string: Wz_Palme|C4:7C:8D:65:C4:46|ok|write|0x33|HASH(0x15c7040)
2018.03.18 22:18:56 4: XiaomiBTLESens (Wz_Palme) - ExecGatttool_Done: JSON error while request: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "HASH(0x15c7040)") at ./FHEM/74_XiaomiBTLESens.pm line 554.

2018.03.18 22:18:56 4: XiaomiBTLESens (Wz_Palme) - Run CreateParamGatttool with mod: read
2018.03.18 22:18:56 5: XiaomiBTLESens (Wz_Palme) - Read XiaomiBTLESens_ExecGatttool_Run Wz_Palme|C4:7C:8D:65:C4:46|read|0x35
2018.03.18 22:18:57 5: XiaomiBTLESens (Wz_Palme) - ExecGatttool_Run: call gatttool with command: gatttool -i hci0 -b C4:7C:8D:65:C4:46 --char-read -a 0x35 2>&1 /dev/null and loop 0
2018.03.18 22:18:57 5: XiaomiBTLESens (Wz_Palme) - ExecGatttool_Run: gatttool loop result Characteristic value/descriptor,ae 00 00 34 00 00 00 10 94 00 02 3c 00 fb 34 9b

2018.03.18 22:18:57 4: XiaomiBTLESens (Wz_Palme) - ExecGatttool_Run: gatttool result Characteristic value/descriptor,ae 00 00 34 00 00 00 10 94 00 02 3c 00 fb 34 9b

2018.03.18 22:18:57 5: XiaomiBTLESens (Wz_Palme) - ExecGatttool_Done: gatttool return string: Wz_Palme|C4:7C:8D:65:C4:46|ok|read|0x35|HASH(0x15c7040)
2018.03.18 22:18:57 4: XiaomiBTLESens (Wz_Palme) - ExecGatttool_Done: JSON error while request: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "HASH(0x15c7040)") at ./FHEM/74_XiaomiBTLESens.pm line 554.

List des Devices
Internals:
   BTMAC      C4:7C:8D:65:C4:46
   DEF        C4:7C:8D:65:C4:46
   INTERVAL   7200
   NAME       Wz_Palme
   NOTIFYDEV  global,Wz_Palme
   NR         22
   NTFY_ORDER 50-Wz_Palme
   STATE      active
   TYPE       XiaomiBTLESens
   VERSION    2.0.10
   loglevel   4
   READINGS:
     2018-03-18 20:21:03   battery         low
     2018-03-18 20:21:03   batteryLevel    0
     2018-03-18 22:20:46   fertility       0
     2018-03-18 20:21:03   firmware        -30.-30.-30
     2018-03-04 03:52:09   lastGattError   charWrite faild
     2018-03-18 22:20:46   lux             0
     2018-03-18 22:20:46   moisture        0
     2018-03-18 22:20:46   state           active
     2018-03-18 22:20:46   temperature     0
   helper:
     CallBattery 0
     CallSensDataCounter 0
     updateTimeCallBattery 1521400863.01321
     updateTimestampCallBattery 2018-03-18 20:21:03
Attributes:
   event-on-change-reading state
   event-on-update-reading .*
   fp_Grundriss 352,922,3,moisture,Palme
   interval   7200
   minMoisture 10
   model      flowerSens
   room       Wohnen
   verbose    0

CoolTux

Guten morgen Heiko,

Und wenn Du wieder die Vorversion installierst geht es wieder?
Haben die anderen auch ein problem mit der neuen Version?


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

hga

Moin,

Habe auch Probleme mit der neuen Version, bin deswegen auf die ältere Version zurückgegangen ...

CoolTux

Zitat von: hga am 19 März 2018, 06:21:29
Moin,

Habe auch Probleme mit der neuen Version, bin deswegen auf die ältere Version zurückgegangen ...

Könntest Du mir ein log 5 mit der neuen version geben?
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

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

hga

Moin!

Hier ein Log-Auszug für einen Sensor:


2018.03.19 11:59:12 5: Cmd: >get FlowerSens_A4 sensorData<
2018.03.19 11:59:12 4: XiaomiBTLESens (FlowerSens_A4) - Run CreateParamGatttool with mod: write
2018.03.19 11:59:12 4: BlockingCall (XiaomiBTLESens_ExecGatttool_Run): created child (15290), uses telnetPort to connect back
2018.03.19 11:59:12 5: Starting notify loop for FlowerSens_A4, 1 event(s), first is write sensor data
2018.03.19 11:59:12 5: createNotifyHash
2018.03.19 11:59:12 5: rg_flower: no longer visible, ignoring notify
2018.03.19 11:59:12 5: End notify loop for FlowerSens_A4
2018.03.19 11:59:12 5: XiaomiBTLESens (FlowerSens_A4) - Write XiaomiBTLESens_ExecGatttool_Run FlowerSens_A4|C4:7C:8D:64:47:A4|write|0x33|A01F
2018.03.19 11:59:12 4: Connection accepted from telnetPort_127.0.0.1_39620
2018.03.19 11:59:12 5: Cmd: >{BlockingRegisterTelnet($cl,43)}<
2018.03.19 11:59:13 5: XiaomiBTLESens (FlowerSens_A4) - ExecGatttool_Run: call gatttool with command: gatttool -i hci0 -b C4:7C:8D:64:47:A4 --char-write-req -a 0x33 -n A01F 2>&1 /dev/null and loop 0
2018.03.19 11:59:15 5: Cmd: >get FlowerSens_A4 sensorData<
2018.03.19 11:59:15 5: Starting notify loop for FlowerSens_A4, 2 event(s), first is lastGattError: charWrite faild
2018.03.19 11:59:15 5: rg_flower: not on any display, ignoring notify
2018.03.19 11:59:15 5: End notify loop for FlowerSens_A4
2018.03.19 11:59:15 4: XiaomiBTLESens (FlowerSens_A4) - WriteReadings: Readings were written
2018.03.19 11:59:15 5: XiaomiBTLESens (FlowerSens_A4) - ExecGatttool_Run: gatttool loop result Characteristic value was written successfully
2018.03.19 11:59:15 4: XiaomiBTLESens (FlowerSens_A4) - ExecGatttool_Run: gatttool result Characteristic value was written successfully
2018.03.19 11:59:15 5: Cmd: >{BlockingStart('43')}<
2018.03.19 11:59:15 5: Cmd: >{XiaomiBTLESens_ExecGatttool_Done('FlowerSens_A4|C4:7C:8D:64:47:A4|ok|write|0x33|HASH(0x28806b0)')}<
2018.03.19 11:59:15 5: XiaomiBTLESens (FlowerSens_A4) - ExecGatttool_Done: gatttool return string: FlowerSens_A4|C4:7C:8D:64:47:A4|ok|write|0x33|HASH(0x28806b0)
2018.03.19 11:59:15 4: XiaomiBTLESens (FlowerSens_A4) - ExecGatttool_Done: JSON error while request: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "HASH(0x28806b0)") at ./FHEM/74_XiaomiBTLESens.pm line 554.

2018.03.19 11:59:15 4: XiaomiBTLESens (FlowerSens_A4) - Run CreateParamGatttool with mod: read
2018.03.19 11:59:15 4: BlockingCall (XiaomiBTLESens_ExecGatttool_Run): created child (15299), uses telnetPort to connect back
2018.03.19 11:59:15 5: Starting notify loop for FlowerSens_A4, 1 event(s), first is read sensor data
2018.03.19 11:59:15 5: rg_flower: not on any display, ignoring notify
2018.03.19 11:59:15 5: End notify loop for FlowerSens_A4
2018.03.19 11:59:15 5: XiaomiBTLESens (FlowerSens_A4) - Read XiaomiBTLESens_ExecGatttool_Run FlowerSens_A4|C4:7C:8D:64:47:A4|read|0x35
2018.03.19 11:59:15 4: Connection accepted from telnetPort_127.0.0.1_39622
2018.03.19 11:59:15 5: Cmd: >{BlockingRegisterTelnet($cl,44)}<
2018.03.19 11:59:16 5: XiaomiBTLESens (FlowerSens_A4) - ExecGatttool_Run: call gatttool with command: gatttool -i hci0 -b C4:7C:8D:64:47:A4 --char-read -a 0x35 2>&1 /dev/null and loop 0
2018.03.19 11:59:16 5: XiaomiBTLESens (FlowerSens_A4) - ExecGatttool_Run: gatttool loop result Characteristic value/descriptor,c3 00 00 f6 06 00 00 11 66 00 02 3c 00 fb 34 9b

2018.03.19 11:59:16 4: XiaomiBTLESens (FlowerSens_A4) - ExecGatttool_Run: gatttool result Characteristic value/descriptor,c3 00 00 f6 06 00 00 11 66 00 02 3c 00 fb 34 9b

2018.03.19 11:59:16 5: Cmd: >{BlockingStart('44')}<
2018.03.19 11:59:16 5: Cmd: >{XiaomiBTLESens_ExecGatttool_Done('FlowerSens_A4|C4:7C:8D:64:47:A4|ok|read|0x35|HASH(0x28806b0)')}<
2018.03.19 11:59:16 5: XiaomiBTLESens (FlowerSens_A4) - ExecGatttool_Done: gatttool return string: FlowerSens_A4|C4:7C:8D:64:47:A4|ok|read|0x35|HASH(0x28806b0)
2018.03.19 11:59:16 4: XiaomiBTLESens (FlowerSens_A4) - ExecGatttool_Done: JSON error while request: malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "HASH(0x28806b0)") at ./FHEM/74_XiaomiBTLESens.pm line 554.

2018.03.19 11:59:16 4: XiaomiBTLESens (FlowerSens_A4) - ProcessingNotification
2018.03.19 11:59:16 4: XiaomiBTLESens (FlowerSens_A4) - ProcessingNotification: handle 0x35
2018.03.19 11:59:16 4: XiaomiBTLESens (FlowerSens_A4) - FlowerSens Handle0x35
2018.03.19 11:59:16 5: Starting notify loop for FlowerSens_A4, 5 event(s), first is moisture: 0
2018.03.19 11:59:16 5: rg_flower: not on any display, ignoring notify
2018.03.19 11:59:16 5: End notify loop for FlowerSens_A4
2018.03.19 11:59:16 5: Starting notify loop for FlowerSens_A4, 1 event(s), first is minMoisture low
2018.03.19 11:59:16 5: rg_flower: not on any display, ignoring notify
2018.03.19 11:59:16 5: End notify loop for FlowerSens_A4
2018.03.19 11:59:16 4: XiaomiBTLESens (FlowerSens_A4) - WriteReadings: Readings were written

HeikoS

Ich denke das hier ist der gemeinsame Fehler: "JSON error while request: malformed JSON string"

Peinliche Frage: wie bekomme ich eine ältere Version des Moduls? ^^

CoolTux

Im restorDir sollte die ältere Version sein.

Das ist die Gemeinsamkeit das stimmt, aber das liegt daran weil etwas davor nicht geklappt hat.
Frage, habt Ihr beide komplett neu gestartet? Irgendwas scheint mit dem laden des JSON Modules im eval Aufruf nicht geklappt zu haben. Ich brauche daher also bitte den Logauszug des FHEM Startvorganges ab dem Punkt wo ein Sensor definiert wird.
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