Hey Leute, hab mal ne ganz schwere Aufgabe.
ich versuche mich gerade an Readings.
Der Aufbau
Fhem mit EMCD an einen RS485-BUS, ebenfalls ein RELAIS und ein Schalter
Das Phenomen
Wenn ich mit FHEM direkt das Relais schalte, dann erkennt FHEM die Antwort.
Wenn der Schalter das Relais schaltet, dann erkennt FHEM die Antwort nicht,
obwohl sie lt. Logfile die Gleiche ist.
WOW, wie geht das denn?
Hier das logfile:
# FHEM Schalter schickt per classdef an Relais Schaltbefehl,
# Relais antwortet mit !M(E\005\001\001\r\n
2015.12.22 21:41:11 5: mylampe: Spontaneously received "!M"
2015.12.22 21:41:11 5: mylampe dispatch !M
2015.12.22 21:41:11 5: mylampe: Spontaneously received "(E\005\001\001\r\n"
2015.12.22 21:41:11 5: mylampe dispatch (E
# classdef reading: reading on match "!M\(E\005\001\001\r\n" matched!
2015.12.22 21:41:11 5: mylampe: match regex !M\(E\005\001\001\r\n for reading on of device Testlicht3 with class mylampedevice
# Schalter schickt Schaltbefehl an Relais,
# Relais antwortet mit !M(E\005\001\001\r\n (wie oben)
2015.12.22 21:42:37 5: mylampe: Spontaneously received "!M"
2015.12.22 21:42:37 5: mylampe dispatch !M
2015.12.22 21:42:37 5: mylampe: Spontaneously received "(E\005\001\001\r\n"
2015.12.22 21:42:37 5: mylampe dispatch (E
# classdef reading: reading on match "!M\(E\005\001\001\r\n" matched NICHT!
Gibt es vlt. aus welchem Grund irgendwelche unterschiedlichen Signalwege?
Wird das Signal erst verarbeitet und dann interprediert und bei FHEM
erst interprediert und dann verarbeitet?
Irgendwo müssen unterschiedliche Signal-Verarbeitungen hinterlegt sein.
Seltsam ja auch, dass er im log in der einen Zeile schreibt: \005\001\001 und
schon eine Zeile weiter (am besten diese komplette Zeile hier in einen Editor kopieren, dann sieht man die unsichtbaren Zeichen "00 05" "00 01" "00 01"
habe sie mal am Ende des Textes als * skizziert)
Das brachte mich auf die Idee der unterschiedlichen Signal-/Interpredationswege.
Habe aber keine Ahnung, was hier falsch läuft. Kann jemand helfen?
*
__ __ __
|00| |00| |00|
|05| |01| |01|
.... .... ....
Bitte define nebst aller Attribute aus der Konfiguration und classdef hier posten.
Danke
Boris
die DEFINE:
------------------------------
# Lampe definieren
define mylampe ECMD serial /dev/ttyUSB0@9600
attr mylampe classdefs mylampedevice=/opt/fhem/lampe.classdef
attr mylampe partial 1
attr mylampe verbose 5
deleteattr mylampe requestSeparator
define Testlicht ECMDDevice mylampedevice 40 1 5
attr Testlicht IODev mylampe
attr Testlicht room Test
define Testlicht2 ECMDDevice mylampedevice 40 2 1
attr Testlicht2 IODev mylampe
attr Testlicht2 room Test
define Testlicht3 ECMDDevice mylampedevice 40 3 1
attr Testlicht3 IODev mylampe
attr Testlicht3 room Test
------------------
und die classdef
------------------
params M_Adresse M_Relais M_Schalttyp
set off cmd {chr(35).chr(77).chr(%M_Adresse).chr(69).chr(%M_Schalttyp).chr(%M_Relais).chr(0).chr(13).chr(10)}
set on cmd {chr(35).chr(77).chr(%M_Adresse).chr(69).chr(%M_Schalttyp).chr(%M_Relais).chr(1).chr(13).chr(10)}
reading on match "!M\(E\005\001\001\r\n"
reading off match "!M\(E\005\001\000\r\n"
reading on postproc {fhem "setstate Testlicht3 on"}
reading off postproc {fhem "setstate Testlicht3 off"}
Hallo,
in 67_ECMDDevice ist ab Zeile 317 die Routine ECMDDevice_Parse(). Darin findet Du eine Reihe von Debug-Befehlen, die alle mit # auskommentiert sind. Erstelle eine Sicherungskopie der Datei und entferne dann in dieser Routine die # vor allen Debug-Befehlen. Bitte mit
reload 67_ECMDDevice.pm
neu laden und dann die Situation aus dem Eröffnungspost nachstellen und den relevanten Teil des Logs wieder hier posten. Bitte den Code im Post in code-Tags einbinden (das #-Zeichen über der Editor-Box, in der Du Deine Antwort schreibst).
Grüße
Boris
Hier der Inhalt des Logs wenn ich:
1. Teil den physischen Schalter "on" schalte
und
2. Teil den FHEM-Schalter "on" schalte
# physischer Schalter "on"
(Hier sendet der Schalter ein "#M(E\005\001\001\r\n" an das Relais, welches mit "!M(E\005\001\001\r\n" antwortet)
2016.01.02 12:27:43 5: mylampe: Spontaneously received "#M"
2016.01.02 12:27:43 5: mylampe dispatch #M
2016.01.02 12:27:43 1: DEBUG>mylampe: partial message "#M(E\005\001\001\r\n!M(E\005\001\001\r\n#M(E\005\001\001\r\n!M(E\005\001\000\r\n" recorded at 1451734063.59866
2016.01.02 12:27:43 1: DEBUG>mylampe: partial message expired.
2016.01.02 12:27:43 1: DEBUG>mylampe: analyzing "#M".
2016.01.02 12:27:43 1: DEBUG>mylampe: trying to find a match for "#M"
2016.01.02 12:27:43 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht3, classdef mylampedevice, reading on).
2016.01.02 12:27:43 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht3, classdef mylampedevice, reading off).
2016.01.02 12:27:43 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht2, classdef mylampedevice, reading on).
2016.01.02 12:27:43 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht2, classdef mylampedevice, reading off).
2016.01.02 12:27:43 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht, classdef mylampedevice, reading on).
2016.01.02 12:27:43 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht, classdef mylampedevice, reading off).
2016.01.02 12:27:43 1: DEBUG>mylampe: partial message "#M" kept.
2016.01.02 12:27:43 5: mylampe: Spontaneously received "(E\005\001\001\r\n"
2016.01.02 12:27:43 5: mylampe dispatch (E
2016.01.02 12:27:43 1: DEBUG>mylampe: partial message "#M" recorded at 1451734063.63408
2016.01.02 12:27:43 1: DEBUG>mylampe: analyzing "#M(E\005\001\001\r\n".
2016.01.02 12:27:43 1: DEBUG>mylampe: trying to find a match for "#M(E\005\001\001\r\n"
2016.01.02 12:27:43 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht3, classdef mylampedevice, reading on).
2016.01.02 12:27:43 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht3, classdef mylampedevice, reading off).
2016.01.02 12:27:43 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht2, classdef mylampedevice, reading on).
2016.01.02 12:27:43 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht2, classdef mylampedevice, reading off).
2016.01.02 12:27:43 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht, classdef mylampedevice, reading on).
2016.01.02 12:27:43 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht, classdef mylampedevice, reading off).
2016.01.02 12:27:43 1: DEBUG>mylampe: partial message "#M(E\005\001\001\r\n" kept.
2016.01.02 12:27:43 5: mylampe: Spontaneously received "!M"
2016.01.02 12:27:43 5: mylampe dispatch !M
2016.01.02 12:27:43 1: DEBUG>mylampe: partial message "#M(E\005\001\001\r\n" recorded at 1451734063.67144
2016.01.02 12:27:43 1: DEBUG>mylampe: analyzing "#M(E\005\001\001\r\n!M".
2016.01.02 12:27:43 1: DEBUG>mylampe: trying to find a match for "#M(E\005\001\001\r\n!M"
2016.01.02 12:27:43 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht3, classdef mylampedevice, reading on).
2016.01.02 12:27:43 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht3, classdef mylampedevice, reading off).
2016.01.02 12:27:43 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht2, classdef mylampedevice, reading on).
2016.01.02 12:27:43 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht2, classdef mylampedevice, reading off).
2016.01.02 12:27:43 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht, classdef mylampedevice, reading on).
2016.01.02 12:27:43 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht, classdef mylampedevice, reading off).
2016.01.02 12:27:43 1: DEBUG>mylampe: partial message "#M(E\005\001\001\r\n!M" kept.
2016.01.02 12:27:43 5: mylampe: Spontaneously received "(E\005\001\001\r\n"
2016.01.02 12:27:43 5: mylampe dispatch (E
2016.01.02 12:27:43 1: DEBUG>mylampe: partial message "#M(E\005\001\001\r\n!M" recorded at 1451734063.7069
2016.01.02 12:27:43 1: DEBUG>mylampe: analyzing "#M(E\005\001\001\r\n!M(E\005\001\001\r\n".
2016.01.02 12:27:43 1: DEBUG>mylampe: trying to find a match for "#M(E\005\001\001\r\n!M(E\005\001\001\r\n"
2016.01.02 12:27:43 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht3, classdef mylampedevice, reading on).
2016.01.02 12:27:43 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht3, classdef mylampedevice, reading off).
2016.01.02 12:27:43 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht2, classdef mylampedevice, reading on).
2016.01.02 12:27:43 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht2, classdef mylampedevice, reading off).
2016.01.02 12:27:43 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:27:43 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht, classdef mylampedevice, reading on).
2016.01.02 12:27:43 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht, classdef mylampedevice, reading off).
2016.01.02 12:27:43 1: DEBUG>mylampe: partial message "#M(E\005\001\001\r\n!M(E\005\001\001\r\n" kept.
# FHEM Schalter "Testlicht" an
2016.01.02 12:28:42 5: mylampe: sending command "#M(E\005\001\001\r\n"
2016.01.02 12:28:42 5: SW: 234d28450501010d0a
2016.01.02 12:28:42 5: mylampe: Spontaneously received "!"
2016.01.02 12:28:42 5: mylampe dispatch !
2016.01.02 12:28:42 1: DEBUG>mylampe: partial message "#M(E\005\001\001\r\n!M(E\005\001\000\r\n" recorded at 1451734122.25774
2016.01.02 12:28:42 1: DEBUG>mylampe: partial message expired.
2016.01.02 12:28:42 1: DEBUG>mylampe: analyzing "!".
2016.01.02 12:28:42 1: DEBUG>mylampe: trying to find a match for "!"
2016.01.02 12:28:42 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 12:28:42 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:28:42 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht3, classdef mylampedevice, reading on).
2016.01.02 12:28:42 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht3, classdef mylampedevice, reading off).
2016.01.02 12:28:42 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 12:28:42 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:28:42 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht2, classdef mylampedevice, reading on).
2016.01.02 12:28:42 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht2, classdef mylampedevice, reading off).
2016.01.02 12:28:42 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 12:28:42 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:28:42 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht, classdef mylampedevice, reading on).
2016.01.02 12:28:42 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht, classdef mylampedevice, reading off).
2016.01.02 12:28:42 1: DEBUG>mylampe: partial message "!" kept.
2016.01.02 12:28:42 5: mylampe: Spontaneously received "M(E\005\001\001\r\n"
2016.01.02 12:28:42 5: mylampe dispatch M(E
2016.01.02 12:28:42 1: DEBUG>mylampe: partial message "!" recorded at 1451734122.29402
2016.01.02 12:28:42 1: DEBUG>mylampe: analyzing "!M(E\005\001\001\r\n".
2016.01.02 12:28:42 1: DEBUG>mylampe: trying to find a match for "!M(E\005\001\001\r\n"
2016.01.02 12:28:42 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 12:28:42 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:28:42 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht3, classdef mylampedevice, reading on).
2016.01.02 12:28:42 5: mylampe: match regex !M\(E\005\001\001\r\n for reading on of device Testlicht3 with class mylampedevice
2016.01.02 12:28:42 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht3, classdef mylampedevice, reading off).
2016.01.02 12:28:42 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 12:28:42 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:28:42 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht2, classdef mylampedevice, reading on).
2016.01.02 12:28:42 5: mylampe: match regex !M\(E\005\001\001\r\n for reading on of device Testlicht2 with class mylampedevice
2016.01.02 12:28:42 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht2, classdef mylampedevice, reading off).
2016.01.02 12:28:42 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 12:28:42 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 12:28:42 1: DEBUG> Trying to match reading on with regular expression "!M\(E\005\001\001\r\n" (device Testlicht, classdef mylampedevice, reading on).
2016.01.02 12:28:42 5: mylampe: match regex !M\(E\005\001\001\r\n for reading on of device Testlicht with class mylampedevice
2016.01.02 12:28:42 1: DEBUG> Trying to match reading off with regular expression "M\(E\005\001\000\r\n" (device Testlicht, classdef mylampedevice, reading off).
Übrigens steht im Linux-Log statt beispielsweise
2016.01.02 12:28:42 5: mylampe dispatch M(E
das so:
2016.01.02 12:28:42 5: mylampe dispatch M(E^E^A^A^M
Weiß nicht ob das relvant ist....
Ich habe das Gefühl, das der Schalter "mehr" sendet als Fhem. Werde also in die Richtung nochmal forschen.
Hallo,
Problem erkannt!
FHEM empfängt "#..." vom Schalter. Weil das Datagramm nicht gematcht wird, wird es zwischengespeichert, weil es der erste Teil eines längeren Datagramms sein könnte (partial). Wenn dann die Antwort von der Lampe eintrifft, wird versucht, die Konkatenation der beiden Datagramme zu matchen. Das führt zu nichts.
Bitte erweitere die Classdef so, dass auch die Datagramme vom Schalter gematcht werden. Dadurch gelangen sie nicht in den partial-Puffer.
Damit sollte es klappen.
Viele Grüße
Boris
Okey... Das klingt hoffnungsvoll ;)
Wird "partial" irgendwann verworfen? (ist das die Zeitangabe in der definition: "attr mylampe partial 1" also 1 Sekunde behalten, wenn nicht gematched?)
Ja. Ja.
Ich habe meine classdef gändert:
reading on_go match "\#M\(E\001\001\001\r\n"
reading on_done match "!M\(E\001\001\001\r\n"
reading off_go match "\#M\(E\001\001\000\r\n"
reading off_done match "!M\(E\001\001\000\r\n"
wenn ich dann ein "#M(E\001\001\001\r\n" sende, erhalte ich im log:
2016.01.02 17:11:18 5: mylampe: Spontaneously received "#"
2016.01.02 17:11:18 5: mylampe dispatch #
2016.01.02 17:11:18 1: DEBUG>mylampe: partial message "" recorded at 1451751078.76543
2016.01.02 17:11:18 1: DEBUG>mylampe: analyzing "#".
2016.01.02 17:11:18 1: DEBUG>mylampe: trying to find a match for "#"
2016.01.02 17:11:18 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 17:11:18 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 17:11:18 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht3, classdef mylampedevice, reading on).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht3, classdef mylampedevice, reading off_go).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht3, classdef mylampedevice, reading on_go).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht3, classdef mylampedevice, reading off).
2016.01.02 17:11:18 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 17:11:18 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 17:11:18 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht2, classdef mylampedevice, reading on).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht2, classdef mylampedevice, reading off_go).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht2, classdef mylampedevice, reading on_go).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht2, classdef mylampedevice, reading off).
2016.01.02 17:11:18 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 17:11:18 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 17:11:18 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht, classdef mylampedevice, reading on).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht, classdef mylampedevice, reading off_go).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht, classdef mylampedevice, reading on_go).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht, classdef mylampedevice, reading off).
2016.01.02 17:11:18 1: DEBUG>mylampe: partial message "#" kept.
2016.01.02 17:11:18 5: mylampe: Spontaneously received "M(E\001\001\001\r\n!M(E\001\001\001\r\n"
2016.01.02 17:11:18 5: mylampe dispatch M(E^A^A^A^M
!M(E^A^A^A^M
2016.01.02 17:11:18 1: DEBUG>mylampe: partial message "#" recorded at 1451751078.82344
2016.01.02 17:11:18 1: DEBUG>mylampe: analyzing "#M(E\001\001\001\r\n!M(E\001\001\001\r\n".
2016.01.02 17:11:18 1: DEBUG>mylampe: trying to find a match for "#M(E\001\001\001\r\n!M(E\001\001\001\r\n"
2016.01.02 17:11:18 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 17:11:18 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 17:11:18 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht3, classdef mylampedevice, reading on).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht3, classdef mylampedevice, reading off_go).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht3, classdef mylampedevice, reading on_go).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht3, classdef mylampedevice, reading off).
2016.01.02 17:11:18 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 17:11:18 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 17:11:18 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht2, classdef mylampedevice, reading on).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht2, classdef mylampedevice, reading off_go).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht2, classdef mylampedevice, reading on_go).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht2, classdef mylampedevice, reading off).
2016.01.02 17:11:18 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 17:11:18 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 17:11:18 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht, classdef mylampedevice, reading on).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht, classdef mylampedevice, reading off_go).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht, classdef mylampedevice, reading on_go).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht, classdef mylampedevice, reading off).
2016.01.02 17:11:18 1: DEBUG>mylampe: partial message "#M(E\001\001\001\r\n!M(E\001\001\001\r\n" kept.
Warum sind die Regex-Parts, die mit # beginnen wie "auskommentiert":
2016.01.02 17:11:18 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht, classdef mylampedevice, reading off).
Und nicht wie bei der Antwort:
2016.01.02 17:11:18 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht, classdef mylampedevice, reading on_go).
Vlt. ist das das Problem?
Das nächste Problem ist, dass der Rest vom ersten Datagramm und das zweite Datagramm zusammen geklebt sind.
Daher benutzt Du bitte das Attribut split und berücksichtigst beim Match, dass das Ergebnis den Separator, den Du bei split angegeben hast, nicht mehr enthält.
Du kannst als Separator wohl \r\n benutzen.
Das Protokoll macht das alles gut nachvollziehbar.
Grüße
Boris
ich schau mal nach "split"
Ich sprach vom Attribut namens split.
Relevanter Auszug aus der fhem.cfg:
define mylampe ECMD serial /dev/ttyUSB0@9600
attr mylampe classdefs mylampedevice=/opt/fhem/lampe.classdef
attr mylampe partial 1
attr mylampe verbose 5
deleteattr mylampe requestSeparator
attr mylampe split \r\n
Und hier das logfile.
2016.01.02 19:38:57 5: mylampe: Spontaneously received "#"
2016.01.02 19:38:57 5: mylampe dispatch #
2016.01.02 19:38:57 1: DEBUG>mylampe: partial message "" recorded at 1451759937.42597
2016.01.02 19:38:57 1: DEBUG>mylampe: analyzing "#".
2016.01.02 19:38:57 1: DEBUG>mylampe: trying to find a match for "#"
2016.01.02 19:38:57 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht3, classdef mylampedevice, reading on).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht3, classdef mylampedevice, reading off_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht3, classdef mylampedevice, reading on_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht3, classdef mylampedevice, reading off).
2016.01.02 19:38:57 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht2, classdef mylampedevice, reading on).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht2, classdef mylampedevice, reading off_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht2, classdef mylampedevice, reading on_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht2, classdef mylampedevice, reading off).
2016.01.02 19:38:57 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht, classdef mylampedevice, reading on).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht, classdef mylampedevice, reading off_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht, classdef mylampedevice, reading on_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht, classdef mylampedevice, reading off).
2016.01.02 19:38:57 1: DEBUG>mylampe: partial message "#" kept.
2016.01.02 19:38:57 5: mylampe: Spontaneously received "M(E\001\001\001\r\n!M(E\001\001\001\r\n"
2016.01.02 19:38:57 5: mylampe dispatch M(E
!M(E
2016.01.02 19:38:57 1: DEBUG>mylampe: partial message "#" recorded at 1451759937.48461
2016.01.02 19:38:57 1: DEBUG>mylampe: analyzing "#M(E\001\001\001\r\n!M(E\001\001\001\r\n".
2016.01.02 19:38:57 1: DEBUG>mylampe: trying to find a match for "#M(E\001\001\001"
2016.01.02 19:38:57 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht3, classdef mylampedevice, reading on).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht3, classdef mylampedevice, reading off_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht3, classdef mylampedevice, reading on_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht3, classdef mylampedevice, reading off).
2016.01.02 19:38:57 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht2, classdef mylampedevice, reading on).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht2, classdef mylampedevice, reading off_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht2, classdef mylampedevice, reading on_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht2, classdef mylampedevice, reading off).
2016.01.02 19:38:57 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht, classdef mylampedevice, reading on).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht, classdef mylampedevice, reading off_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht, classdef mylampedevice, reading on_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht, classdef mylampedevice, reading off).
2016.01.02 19:38:57 1: DEBUG>mylampe: trying to find a match for "!M(E\001\001\001"
2016.01.02 19:38:57 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht3, classdef mylampedevice, reading on).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht3, classdef mylampedevice, reading off_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht3, classdef mylampedevice, reading on_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht3, classdef mylampedevice, reading off).
2016.01.02 19:38:57 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht2, classdef mylampedevice, reading on).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht2, classdef mylampedevice, reading off_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht2, classdef mylampedevice, reading on_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht2, classdef mylampedevice, reading off).
2016.01.02 19:38:57 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht, classdef mylampedevice, reading on).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht, classdef mylampedevice, reading off_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht, classdef mylampedevice, reading on_go).
2016.01.02 19:38:57 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht, classdef mylampedevice, reading off).
2016.01.02 19:38:57 1: DEBUG>mylampe: partial message "!M(E\001\001\001" kept.
Habe das Gefühl, dass er wenigstens schon mal trennt und mehr Prüfungen durchführt.
Allerdings ist "with regular expression """ immer noch leer...
Danke für Deine Hilfe!
Ach und dann müsste ich die regex kürzen....!?
Wenn ich "attr mylampe partial 1" auskommentiere, erhalte ich:
2016.01.02 20:09:00 5: mylampe: Spontaneously received "#"
2016.01.02 20:09:00 5: mylampe dispatch #
2016.01.02 20:09:00 1: DEBUG>mylampe: analyzing "#".
2016.01.02 20:09:00 1: DEBUG>mylampe: trying to find a match for "#"
2016.01.02 20:09:00 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht3, classdef mylampedevice, reading on).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000" (device Testlicht3, classdef mylampedevice, reading off_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001" (device Testlicht3, classdef mylampedevice, reading on_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht3, classdef mylampedevice, reading off).
2016.01.02 20:09:00 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht2, classdef mylampedevice, reading on).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000" (device Testlicht2, classdef mylampedevice, reading off_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001" (device Testlicht2, classdef mylampedevice, reading on_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht2, classdef mylampedevice, reading off).
2016.01.02 20:09:00 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht, classdef mylampedevice, reading on).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000" (device Testlicht, classdef mylampedevice, reading off_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001" (device Testlicht, classdef mylampedevice, reading on_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht, classdef mylampedevice, reading off).
2016.01.02 20:09:00 5: mylampe: Spontaneously received "M(E\001\001\001\r\n"
2016.01.02 20:09:00 5: mylampe dispatch M(E
2016.01.02 20:09:00 1: DEBUG>mylampe: analyzing "M(E\001\001\001\r\n".
2016.01.02 20:09:00 1: DEBUG>mylampe: trying to find a match for "M(E\001\001\001"
2016.01.02 20:09:00 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht3, classdef mylampedevice, reading on).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000" (device Testlicht3, classdef mylampedevice, reading off_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001" (device Testlicht3, classdef mylampedevice, reading on_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht3, classdef mylampedevice, reading off).
2016.01.02 20:09:00 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht2, classdef mylampedevice, reading on).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000" (device Testlicht2, classdef mylampedevice, reading off_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001" (device Testlicht2, classdef mylampedevice, reading on_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht2, classdef mylampedevice, reading off).
2016.01.02 20:09:00 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht, classdef mylampedevice, reading on).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000" (device Testlicht, classdef mylampedevice, reading off_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001" (device Testlicht, classdef mylampedevice, reading on_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht, classdef mylampedevice, reading off).
2016.01.02 20:09:00 5: mylampe: Spontaneously received "!M(E\001\001\001\r\n"
2016.01.02 20:09:00 5: mylampe dispatch !M(E
2016.01.02 20:09:00 1: DEBUG>mylampe: analyzing "!M(E\001\001\001\r\n".
2016.01.02 20:09:00 1: DEBUG>mylampe: trying to find a match for "!M(E\001\001\001"
2016.01.02 20:09:00 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht3, classdef mylampedevice, reading on).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000" (device Testlicht3, classdef mylampedevice, reading off_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001" (device Testlicht3, classdef mylampedevice, reading on_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht3, classdef mylampedevice, reading off).
2016.01.02 20:09:00 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht2, classdef mylampedevice, reading on).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000" (device Testlicht2, classdef mylampedevice, reading off_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001" (device Testlicht2, classdef mylampedevice, reading on_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht2, classdef mylampedevice, reading off).
2016.01.02 20:09:00 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht, classdef mylampedevice, reading on).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000" (device Testlicht, classdef mylampedevice, reading off_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001" (device Testlicht, classdef mylampedevice, reading on_go).
2016.01.02 20:09:00 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht, classdef mylampedevice, reading off).
Sieht so aus, als wenn das "#" noch irgend eine "magische" Funktion in FHEM hat.
Das partial muss drin bleiben! Sonst wird das # nicht mit dem Rest zusammengefügt.
Und probier mal bitte
attr split \015\012
Es kann sein, dass \r\n nicht interpretiert wird.
(ich sehe, dass die Verwendung von Escapes in Eingabe und Ausgabe ein Krätz ist, den ich mal untersuchen und dokumentieren sollte)
mit "attr split \013\010"
2016.01.02 20:23:46 1: DEBUG>mylampe: analyzing "#M(E\001\001\001\r\n!M(E\001\001\001\r\n".
2016.01.02 20:23:46 1: DEBUG>mylampe: trying to find a match for "#M(E\001\001\001\r\n!M(E\001\001\001\r\n"
mit "attr split \r\n"
2016.01.02 20:25:26 1: DEBUG>mylampe: analyzing "#M(E\001\001\001\r\n!M(E\001\001\001\r\n".
2016.01.02 20:25:26 1: DEBUG>mylampe: trying to find a match for "#M(E\001\001\001"
Das \r\n hat offensichtlich schon dazu geführt, dass der String richtig getrennt wurde.
Was ich Dir mit dem partial sagen wollte ist, dass überall im log, wo ein # war der komplette regex fehlt.
Das widerum sagt mir, das was mit dem Handling des "#" nicht stimmen könnte, bzw. das dieser eines besonderen Schutzes bedarf,
weil er vlt. auch ein Kommentarelement ist?
Gestüzt wird meine Annahme, das ohne partial, die beiden Strings einwandfrei als 2 Strings empfangen werden,
natürlich mit ABER: lediglich der String mit dem "#" wird zerlegt.
Also vlt. ist die Ursache ja nicht die Trennung der Befehle, sondern das "verflixte" #?
Ich schrieb
attr split \015\012
(das ist Oktal für 13, 10).
An dem # kann es nicht liegen, das hat keine spezielle Bedeutung in diesem Kontext.
ich checke nochmal..., dachte, Du hast Dich verschrieben... sorry ;)
hier das phenomen meinte ich:
Von den vier fast identischen Regexe der classdef:
reading on_go match "\#M\(E\001\001\001"
reading on_done match "!M\(E\001\001\001"
reading off_go match "\#M\(E\001\001\000"
reading off_done match "!M\(E\001\001\000"
werden 2 "ignoriert/gelöscht" und zwar die, mit dem #:
2016.01.02 17:11:18 1: DEBUG> Trying to match reading on with regular expression "" (device Testlicht, classdef mylampedevice, reading on).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading off_go with regular expression "reading off_done match "!M\(E\001\001\000\r\n" (device Testlicht, classdef mylampedevice, reading off_go).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading on_go with regular expression "reading on_done match "!M\(E\001\001\001\r\n" (device Testlicht, classdef mylampedevice, reading on_go).
2016.01.02 17:11:18 1: DEBUG> Trying to match reading off with regular expression "" (device Testlicht, classdef mylampedevice, reading off).
Nochwas fällt mir auf:
"_done" wurde auch gelöscht.
Ist der geschützt?
"reading on" müsste heißen "reading on_done"
Ach so, ja jetzt hab ich's kapiert, Mist, die classdef kennt ja # als Kommentarsymbol.
Bitte als Oktalwert in die classdef nehmen:
reading on_go match "\043M\(E\001\001\001" # \043 oktal für #
usw.
Zitat von: NeuFehm am 02 Januar 2016, 20:42:04
Nochwas fällt mir auf:
"_done" wurde auch gelöscht.
Ist der geschützt?
"reading on" müsste heißen "reading on_done"
Das ist merkwürdig. Du kannst mit
list mylampe
die classdef ansehen, die er verwendet. Am besten FHEM neu starten und weiter probieren.
Das sieht doch schon gut aus, oder?
2016.01.02 20:55:02 5: mylampe: Spontaneously received "#"
2016.01.02 20:55:02 5: mylampe dispatch #
2016.01.02 20:55:02 1: DEBUG>mylampe: partial message "" recorded at 1451764502.89866
2016.01.02 20:55:02 1: DEBUG>mylampe: analyzing "#".
2016.01.02 20:55:02 1: DEBUG>mylampe: trying to find a match for "#"
2016.01.02 20:55:02 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 20:55:02 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:55:02 1: DEBUG> Trying to match reading ondone with regular expression "!M\(E\001\001\001" (device Testlicht3, classdef mylampedevice, reading ondone).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading offgo with regular expression "\043M\(E\001\001\000" (device Testlicht3, classdef mylampedevice, reading offgo).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading offdone with regular expression "!M\(E\001\001\000" (device Testlicht3, classdef mylampedevice, reading offdone).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading ongo with regular expression "\043M\(E\001\001\001" (device Testlicht3, classdef mylampedevice, reading ongo).
2016.01.02 20:55:02 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 20:55:02 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:55:02 1: DEBUG> Trying to match reading ondone with regular expression "!M\(E\001\001\001" (device Testlicht2, classdef mylampedevice, reading ondone).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading offgo with regular expression "\043M\(E\001\001\000" (device Testlicht2, classdef mylampedevice, reading offgo).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading offdone with regular expression "!M\(E\001\001\000" (device Testlicht2, classdef mylampedevice, reading offdone).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading ongo with regular expression "\043M\(E\001\001\001" (device Testlicht2, classdef mylampedevice, reading ongo).
2016.01.02 20:55:02 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 20:55:02 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:55:02 1: DEBUG> Trying to match reading ondone with regular expression "!M\(E\001\001\001" (device Testlicht, classdef mylampedevice, reading ondone).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading offgo with regular expression "\043M\(E\001\001\000" (device Testlicht, classdef mylampedevice, reading offgo).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading offdone with regular expression "!M\(E\001\001\000" (device Testlicht, classdef mylampedevice, reading offdone).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading ongo with regular expression "\043M\(E\001\001\001" (device Testlicht, classdef mylampedevice, reading ongo).
2016.01.02 20:55:02 1: DEBUG>mylampe: partial message "#" kept.
2016.01.02 20:55:02 5: mylampe: Spontaneously received "M(E\001\001\001\r\n!M(E\001\001\001\r\n"
2016.01.02 20:55:02 5: mylampe dispatch M(E
!M(E
2016.01.02 20:55:02 1: DEBUG>mylampe: partial message "#" recorded at 1451764502.95723
2016.01.02 20:55:02 1: DEBUG>mylampe: analyzing "#M(E\001\001\001\r\n!M(E\001\001\001\r\n".
2016.01.02 20:55:02 1: DEBUG>mylampe: trying to find a match for "#M(E\001\001\001"
2016.01.02 20:55:02 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 20:55:02 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:55:02 1: DEBUG> Trying to match reading ondone with regular expression "!M\(E\001\001\001" (device Testlicht3, classdef mylampedevice, reading ondone).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading offgo with regular expression "\043M\(E\001\001\000" (device Testlicht3, classdef mylampedevice, reading offgo).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading offdone with regular expression "!M\(E\001\001\000" (device Testlicht3, classdef mylampedevice, reading offdone).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading ongo with regular expression "\043M\(E\001\001\001" (device Testlicht3, classdef mylampedevice, reading ongo).
2016.01.02 20:55:02 5: mylampe: match regex \043M\(E\001\001\001 for reading ongo of device Testlicht3 with class mylampedevice
2016.01.02 20:55:02 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 20:55:02 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:55:02 1: DEBUG> Trying to match reading ondone with regular expression "!M\(E\001\001\001" (device Testlicht2, classdef mylampedevice, reading ondone).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading offgo with regular expression "\043M\(E\001\001\000" (device Testlicht2, classdef mylampedevice, reading offgo).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading offdone with regular expression "!M\(E\001\001\000" (device Testlicht2, classdef mylampedevice, reading offdone).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading ongo with regular expression "\043M\(E\001\001\001" (device Testlicht2, classdef mylampedevice, reading ongo).
2016.01.02 20:55:02 5: mylampe: match regex \043M\(E\001\001\001 for reading ongo of device Testlicht2 with class mylampedevice
2016.01.02 20:55:02 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 20:55:02 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:55:02 1: DEBUG> Trying to match reading ondone with regular expression "!M\(E\001\001\001" (device Testlicht, classdef mylampedevice, reading ondone).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading offgo with regular expression "\043M\(E\001\001\000" (device Testlicht, classdef mylampedevice, reading offgo).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading offdone with regular expression "!M\(E\001\001\000" (device Testlicht, classdef mylampedevice, reading offdone).
2016.01.02 20:55:02 1: DEBUG> Trying to match reading ongo with regular expression "\043M\(E\001\001\001" (device Testlicht, classdef mylampedevice, reading ongo).
2016.01.02 20:55:02 5: mylampe: match regex \043M\(E\001\001\001 for reading ongo of device Testlicht with class mylampedevice
2016.01.02 20:55:03 1: DEBUG>mylampe: trying to find a match for "!M(E\001\001\001"
2016.01.02 20:55:03 1: DEBUG> Checking device Testlicht3 with class mylampedevice...
2016.01.02 20:55:03 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:55:03 1: DEBUG> Trying to match reading ondone with regular expression "!M\(E\001\001\001" (device Testlicht3, classdef mylampedevice, reading ondone).
2016.01.02 20:55:03 5: mylampe: match regex !M\(E\001\001\001 for reading ondone of device Testlicht3 with class mylampedevice
2016.01.02 20:55:03 1: DEBUG> Trying to match reading offgo with regular expression "\043M\(E\001\001\000" (device Testlicht3, classdef mylampedevice, reading offgo).
2016.01.02 20:55:03 1: DEBUG> Trying to match reading offdone with regular expression "!M\(E\001\001\000" (device Testlicht3, classdef mylampedevice, reading offdone).
2016.01.02 20:55:03 1: DEBUG> Trying to match reading ongo with regular expression "\043M\(E\001\001\001" (device Testlicht3, classdef mylampedevice, reading ongo).
2016.01.02 20:55:03 1: DEBUG> Checking device Testlicht2 with class mylampedevice...
2016.01.02 20:55:03 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:55:03 1: DEBUG> Trying to match reading ondone with regular expression "!M\(E\001\001\001" (device Testlicht2, classdef mylampedevice, reading ondone).
2016.01.02 20:55:03 5: mylampe: match regex !M\(E\001\001\001 for reading ondone of device Testlicht2 with class mylampedevice
2016.01.02 20:55:03 1: DEBUG> Trying to match reading offgo with regular expression "\043M\(E\001\001\000" (device Testlicht2, classdef mylampedevice, reading offgo).
2016.01.02 20:55:03 1: DEBUG> Trying to match reading offdone with regular expression "!M\(E\001\001\000" (device Testlicht2, classdef mylampedevice, reading offdone).
2016.01.02 20:55:03 1: DEBUG> Trying to match reading ongo with regular expression "\043M\(E\001\001\001" (device Testlicht2, classdef mylampedevice, reading ongo).
2016.01.02 20:55:03 1: DEBUG> Checking device Testlicht with class mylampedevice...
2016.01.02 20:55:03 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.02 20:55:03 1: DEBUG> Trying to match reading ondone with regular expression "!M\(E\001\001\001" (device Testlicht, classdef mylampedevice, reading ondone).
2016.01.02 20:55:03 5: mylampe: match regex !M\(E\001\001\001 for reading ondone of device Testlicht with class mylampedevice
2016.01.02 20:55:03 1: DEBUG> Trying to match reading offgo with regular expression "\043M\(E\001\001\000" (device Testlicht, classdef mylampedevice, reading offgo).
2016.01.02 20:55:03 1: DEBUG> Trying to match reading offdone with regular expression "!M\(E\001\001\000" (device Testlicht, classdef mylampedevice, reading offdone).
2016.01.02 20:55:03 1: DEBUG> Trying to match reading ongo with regular expression "\043M\(E\001\001\001" (device Testlicht, classdef mylampedevice, reading ongo).
Oh ja, es wird!
Ich denke ich mach dennoch was mit meiner Konfiguration falsch.
Ich dachte ich habe EIN ECMD-DEVICE in Anführungszeichen, mein RS486-Stick:
define mylampe ECMD serial /dev/ttyUSB0@9600
attr mylampe classdefs mylampedevice=/opt/fhem/lampe.classdef
attr mylampe partial 1
attr mylampe verbose 5
deleteattr mylampe requestSeparator
attr mylampe split \r\n
und ich habe dann 3 Relais an die jeweils eine Lampe angeschlossen ist:
define Testlicht ECMDDevice mylampedevice 40 1 1
attr Testlicht IODev mylampe
attr Testlicht room Test
define Testlicht2 ECMDDevice mylampedevice 40 2 1
attr Testlicht2 IODev mylampe
attr Testlicht2 room Test
define Testlicht3 ECMDDevice mylampedevice 40 3 1
attr Testlicht3 IODev mylampe
attr Testlicht3 room Test
wenn ich nun die erste Lampe schalte, dann stehen ja im log insgesamt 6 Matchings,
also die vom Testlicht, Testlicht2 und Testlicht 3.
Alle fühlen sich "angesprochen". Daher sieht auch das Webfrontent entsprechend aus:
ECMDDevice
Testlicht ondone !M(E on off
Testlicht2 ondone !M(E on off
Testlicht3 ondone !M(E on off
Kannst Du mir ein Licht für den Ausweg aus meinen Irrgarten senden?
Hallo,
Dein Verständnis ist richtig (ECMD: RS486-Stick, 3 ECMDDevices: die Lampen).
Wenn ich das richtig überblicke, sendet der Stick immer dasselbe als Antwort, egal, welche Lampe geschaltet wurde. Damit kannst Du die Rückmeldung nicht benutzen, um zu bestimmen, welche Lampe ein- oder ausgeschaltet wurde.
Die einfachste Variante ist es, wenn Du bereits auf den Schaltbefehl hin die Readings setzt und die Rückmeldung in ein extra reply-Reading steckst. Du kannst dann allerdings nicht feststellen, ob der Schaltbefehl erfolgreich war. Zumindest nicht ohne einiges an Perl-Gymnastik, um die Rückmeldung in Bezug zum Befehl zu bringen.
Viele Grüße
Boris
Die Lampen senden unterschiedlich (ohne \r\n)!
Lampe 1 an/ok//aus/ok: #M(\001\001\001 / !M(\001\001\001 // #M(\001\001\000 / !M(\001\001\000
Lampe 2 an/ok//aus/ok: #M(\001\002\001 / !M(\001\002\001 // #M(\001\002\000 / !M(\001\002\000
Lampe 3 an/ok//aus/ok: #M(\001\003\001 / !M(\001\003\001 // #M(\001\003\000 / !M(\001\003\000
Ich dachte, ich kann dann, die classdef:
reading ongo1 match "\043M\(E\001\001\001"
reading ondone1 match "!M\(E\001\001\001"
reading offgo1 match "\043M\(E\001\001\000"
reading offdone1 match "!M\(E\001\001\000"
erweitern mit
reading ondone1 postproc {fhem "setstate Testlicht on"}
reading offdone1 postproc {fhem "setstate Testlicht off"}
und bei Erfolg dann vorerst "umständlich" durch kopieren für die Lampen 2 und 3
Aber wieso schreibt der jetzt schon (also auch ohne postproc) die Readings in alle Devices?:
Testlicht: state ondone1 !M(E 2016-01-02 20:55:03
Testlicht2: state ondone1 !M(E 2016-01-02 20:55:03
Testlicht3: state ondone1 !M(E 2016-01-02 20:55:03
Kann es sein, dass ich Readings falsch verstehe und es sich nicht um "Variablen" handelt, die man belegt und dann einsetzen kann,
sondern dass es für die drei Lampen heißen müsste:
reading Testlicht on match "!M\(E\001\001\001"
reading Testlicht off match "!M\(E\001\001\000"
reading Testlicht2 on match "!M\(E\001\002\001"
reading Testlicht2 off match "!M\(E\001\002\000"
reading Testlicht3 on match "!M\(E\001\003\001"
reading Testlicht3 off match "!M\(E\001\003\000"
Aber da stimmt doch der Syntax nicht....
Hallo,
es kann sein, dass die Readings von Deinen vorherigen Versuchen übrig sind. Entweder FHEM beenden und fhem.save löschen oder mit deletereading die Readings löschen.
Ansonsten ist Deine Vorgehensweise richtig.
Es wird noch einfacher, wenn Du den Parameter für die Lampe als Character definierst. Dann kannst Du ihn auch im match verwenden und brauchst nur eine classdef. Ungefähr so:
params M_Adresse M_Relais M_Schalttyp
params M_Adresse M_Relais M_Schalttyp
set off cmd {chr(35).chr(77).chr(%M_Adresse).chr(69).chr(%M_Schalttyp)."%M_Relais".chr(0).chr(13).chr(10)}
set on cmd {chr(35).chr(77).chr(%M_Adresse).chr(69).chr(%M_Schalttyp)."%M_Relais".chr(1).chr(13).chr(10)}
reading on match "!M\(E\005%M_Relais\001"
reading off match "!M\(E\005%M_Relais\000"# die postprocs brauchst Du nicht, die Readings on und off werden bereits durch die beiden Zeilen darüber gesetzt.
und
define Testlicht2 ECMDDevice mylampedevice 40 \002 1
Cool!
Tatsächlich wird nur der Status der ersten Lampe geändert :)
Musste allerdings das so machen, damit die # ohne Folgen gematched werden:
params M_Adresse M_Relais M_Schalttyp
set off cmd {chr(35).chr(77).chr(%M_Adresse).chr(69).chr(%M_Schalttyp).%M_Relais.chr(0).chr(13).chr(10)}
set on cmd {chr(35).chr(77).chr(%M_Adresse).chr(69).chr(%M_Schalttyp).%M_Relais.chr(1).chr(13).chr(10)}
reading ongo match "\043M\(E\001%M_Relais\001"
reading on match "!M\(E\001%M_Relais\001"
reading offgo match "\043M\(E\001%M_Relais\000"
reading off match "!M\(E\001%M_Relais\000"
Mh. Allerdings schaltet nun meine Lampe nicht mehr, wenn ich der wie im Log schicke:
2016.01.02 22:17:56 5: mylampe: sending command "#M(E\001SCALAR(0x1a8d868)\001\r\n"
2016.01.02 22:17:56 5: SW: 234d2845015343414c41522830783161386438363829010d0a
Verflixt :)
Hmm, das muss ich mir morgen mal ansehen und bei mir an einem Beispiel durchdebuggen. Die Makrosubstitution geht schief.
Gute Nacht.
Boris
oder ich mach ich halt 4 Parameter?
params M_Adresse M_Relais M_CHARRelais M_Schalttyp
Also das mit dem 4. Parameter funktioniert.
Nur dass sich das Webfrontend nicht wirklich aktualisiert. Muss immer den entsprechenden Raum aufrufen, damits angezeigt wird, ABER:
ich kann vom FHEM schalten und vom physischen Schalter und die Stati werden richtig angezeigt.
Also auch FHEM schaltet an und physisch schaltet ab. Stati stimmen (wenn Raum aufgerufen wird)
Das ist schon mal ein RIESEN Fortschritt! ;)
Danke bis morgen!
Mirko
So, habe nun nochmal meine classdef angepasst, damit der Status ordentlich aktualisiert wird.
Oder ist das nur ein "Umweg"?
Auf jeden Fall funktioniert es, aber ob es auch richtig und elegant ist? ;)
params M_Adresse M_Relais M_CRelais M_Schalttyp
set off cmd {chr(35).chr(77).chr(%M_Adresse).chr(69).chr(%M_Schalttyp).chr(%M_Relais).chr(0).chr(13).chr(10)}
set on cmd {chr(35).chr(77).chr(%M_Adresse).chr(69).chr(%M_Schalttyp).chr(%M_Relais).chr(1).chr(13).chr(10)}
reading ongo match "\043M\(E\001%M_CRelais\001"
reading on match "!M\(E\001%M_CRelais\001"
reading offgo match "\043M\(E\001%M_CRelais\000"
reading off match "!M\(E\001%M_CRelais\000"
reading ongo postproc {fhem "deletereading Testlicht%M_Relais ongo"}
reading on postproc {fhem "setstate Testlicht%M_Relais on;;deletereading Testlicht%M_Relais on"}
reading offgo postproc {fhem "deletereading Testlicht%M_Relais offgo"}
reading off postproc {fhem "setstate Testlicht%M_Relais off;;deletereading Testlicht%M_Relais off"}
Hi Boris,
gibts an Deiner Front was Neues?
Schon wieder ein Rätzel.
Irgendwas kann da nicht richtig sein?
Ich brauche für meine Lampen eine andere classdef wie für meine LEDs.
Aber meine fhem.cfg liest sich seltsam, irgendwie sind bestimmt manche Zeilen überflüssig?
# Lampe definieren
define mylampe ECMD serial /dev/ttyUSB0@9600
attr mylampe classdefs mylampedevice=/opt/fhem/lampe.classdef
attr mylampe partial 2
attr mylampe verbose 5
deleteattr mylampe requestSeparator
attr mylampe split \r\n
define Testlicht1 ECMDDevice mylampedevice 40 1 \001 1
attr Testlicht1 IODev mylampe
attr Testlicht1 room Test
define Testlicht2 ECMDDevice mylampedevice 40 2 \002 1
attr Testlicht2 IODev mylampe
attr Testlicht2 room Test
# LEDs definieren
define myleds ECMD serial /dev/ttyUSB0@9600
attr myleds classdefs myleddevice=/opt/fhem/led.classdef
attr myleds partial 2
attr myleds verbose 5
deleteattr myleds requestSeparator
attr myleds split \r\n
define Led1 ECMDDevice myleddevice 33 Led1
attr Led1 IODev myleds
attr Led1 room Test
define Led2 ECMDDevice myleddevice 33 Led2
attr Led2 IODev myleds
attr Led2 room Test
Denn das Problem weiter eingeschränkt.
Hier funktionier noch das Matching:
Auszug aus fhem.cfg
# Lampe definieren
define mylampe ECMD serial /dev/ttyUSB0@9600
attr mylampe classdefs mylampedevice=/opt/fhem/lampe.classdef
deleteattr mylampe requestSeparator
attr mylampe partial 1
attr mylampe split \r\n
attr mylampe verbose 5
define Testlicht1 ECMDDevice mylampedevice 40 1 \001 1
attr Testlicht1 IODev mylampe
attr Testlicht1 room Test
Auzug aus Log:
2016.01.06 19:53:14 5: mylampe: Spontaneously received "#"
2016.01.06 19:53:14 5: mylampe dispatch #
2016.01.06 19:53:14 1: DEBUG>mylampe: partial message "" recorded at 1452106394.51159
2016.01.06 19:53:14 1: DEBUG>mylampe: analyzing "#".
2016.01.06 19:53:14 1: DEBUG>mylampe: trying to find a match for "#"
2016.01.06 19:53:14 1: DEBUG> Checking device Testlicht1 with class mylampedevice...
2016.01.06 19:53:14 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.06 19:53:14 1: DEBUG> Trying to match reading on with regular expression "!M\(E[\001-\005]\001\001" (device Testlicht1, classdef mylampedevice, reading on).
2016.01.06 19:53:14 1: DEBUG> Trying to match reading offgo with regular expression "\043M\(E[\001-\005]\001\000" (device Testlicht1, classdef mylampedevice, reading offgo).
2016.01.06 19:53:14 1: DEBUG> Trying to match reading Rollo with regular expression "TRollo1;1" (device Testlicht1, classdef mylampedevice, reading Rollo).
2016.01.06 19:53:14 1: DEBUG> Trying to match reading off with regular expression "!M\(E[\001-\005]\001\000" (device Testlicht1, classdef mylampedevice, reading off).
2016.01.06 19:53:14 1: DEBUG> Trying to match reading ongo with regular expression "\043M\(E[\001-\005]\001\001" (device Testlicht1, classdef mylampedevice, reading ongo).
2016.01.06 19:53:14 1: DEBUG>mylampe: partial message "#" kept.
2016.01.06 19:53:14 5: mylampe: Spontaneously received "M(E\001\001\001\r\n!M(E\001\001\001\r\n"
2016.01.06 19:53:14 5: mylampe dispatch M(E
!M(E
2016.01.06 19:53:14 1: DEBUG>mylampe: partial message "#" recorded at 1452106394.54818
2016.01.06 19:53:14 1: DEBUG>mylampe: analyzing "#M(E\001\001\001\r\n!M(E\001\001\001\r\n".
2016.01.06 19:53:14 1: DEBUG>mylampe: trying to find a match for "#M(E\001\001\001"
2016.01.06 19:53:14 1: DEBUG> Checking device Testlicht1 with class mylampedevice...
2016.01.06 19:53:14 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.06 19:53:14 1: DEBUG> Trying to match reading on with regular expression "!M\(E[\001-\005]\001\001" (device Testlicht1, classdef mylampedevice, reading on).
2016.01.06 19:53:14 1: DEBUG> Trying to match reading offgo with regular expression "\043M\(E[\001-\005]\001\000" (device Testlicht1, classdef mylampedevice, reading offgo).
2016.01.06 19:53:14 1: DEBUG> Trying to match reading Rollo with regular expression "TRollo1;1" (device Testlicht1, classdef mylampedevice, reading Rollo).
2016.01.06 19:53:14 1: DEBUG> Trying to match reading off with regular expression "!M\(E[\001-\005]\001\000" (device Testlicht1, classdef mylampedevice, reading off).
2016.01.06 19:53:14 1: DEBUG> Trying to match reading ongo with regular expression "\043M\(E[\001-\005]\001\001" (device Testlicht1, classdef mylampedevice, reading ongo).
2016.01.06 19:53:14 5: mylampe: match regex \043M\(E[\001-\005]\001\001 for reading ongo of device Testlicht1 with class mylampedevice
2016.01.06 19:53:14 1: DEBUG>mylampe: trying to find a match for "!M(E\001\001\001"
2016.01.06 19:53:14 1: DEBUG> Checking device Testlicht1 with class mylampedevice...
2016.01.06 19:53:14 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.06 19:53:14 1: DEBUG> Trying to match reading on with regular expression "!M\(E[\001-\005]\001\001" (device Testlicht1, classdef mylampedevice, reading on).
2016.01.06 19:53:14 5: mylampe: match regex !M\(E[\001-\005]\001\001 for reading on of device Testlicht1 with class mylampedevice
2016.01.06 19:53:14 1: DEBUG> Trying to match reading offgo with regular expression "\043M\(E[\001-\005]\001\000" (device Testlicht1, classdef mylampedevice, reading offgo).
2016.01.06 19:53:14 1: DEBUG> Trying to match reading Rollo with regular expression "TRollo1;1" (device Testlicht1, classdef mylampedevice, reading Rollo).
2016.01.06 19:53:14 1: DEBUG> Trying to match reading off with regular expression "!M\(E[\001-\005]\001\000" (device Testlicht1, classdef mylampedevice, reading off).
2016.01.06 19:53:14 1: DEBUG> Trying to match reading ongo with regular expression "\043M\(E[\001-\005]\001\001" (device Testlicht1, classdef mylampedevice, reading ongo).
Und sobald ich die fhem.cfg erweitere, funktioniert das Matching nicht mehr.
Auszug fhem.cfg erweitert:
# Lampe definieren
define mylampe ECMD serial /dev/ttyUSB0@9600
attr mylampe classdefs mylampedevice=/opt/fhem/lampe.classdef
deleteattr mylampe requestSeparator
attr mylampe partial 1
attr mylampe split \r\n
attr mylampe verbose 5
define Testlicht1 ECMDDevice mylampedevice 40 1 \001 1
attr Testlicht1 IODev mylampe
attr Testlicht1 room Test
# LEDs definieren
define myleds ECMD serial /dev/ttyUSB0@9600
attr myleds classdefs myleddevice=/opt/fhem/led.classdef
attr myleds partial 2
attr myleds verbose 5
deleteattr myleds requestSeparator
attr myleds split \r\n
define Led1 ECMDDevice myleddevice 33 Led1
attr Led1 IODev myleds
attr Led1 room Test
Auszug aus Logfile:
2016.01.06 20:02:24 5: mylampe: Spontaneously received "#"
2016.01.06 20:02:24 5: mylampe dispatch #
2016.01.06 20:02:24 1: DEBUG>mylampe: partial message "#!#!" recorded at 1452106944.00691
2016.01.06 20:02:24 1: DEBUG>mylampe: partial message expired.
2016.01.06 20:02:24 1: DEBUG>mylampe: analyzing "#".
2016.01.06 20:02:24 1: DEBUG>mylampe: trying to find a match for "#"
2016.01.06 20:02:24 1: DEBUG> Checking device Testlicht1 with class mylampedevice...
2016.01.06 20:02:24 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.06 20:02:24 1: DEBUG> Trying to match reading on with regular expression "!M\(E[\001-\005]\001\001" (device Testlicht1, classdef mylampedevice, reading on).
2016.01.06 20:02:24 1: DEBUG> Trying to match reading offgo with regular expression "\043M\(E[\001-\005]\001\000" (device Testlicht1, classdef mylampedevice, reading offgo).
2016.01.06 20:02:24 1: DEBUG> Trying to match reading Rollo with regular expression "TRollo1;1" (device Testlicht1, classdef mylampedevice, reading Rollo).
2016.01.06 20:02:24 1: DEBUG> Trying to match reading off with regular expression "!M\(E[\001-\005]\001\000" (device Testlicht1, classdef mylampedevice, reading off).
2016.01.06 20:02:24 1: DEBUG> Trying to match reading ongo with regular expression "\043M\(E[\001-\005]\001\001" (device Testlicht1, classdef mylampedevice, reading ongo).
2016.01.06 20:02:24 1: DEBUG>mylampe: partial message "#" kept.
2016.01.06 20:02:24 5: myleds: Spontaneously received "M(E\001\001\001\r\n"
2016.01.06 20:02:24 5: myleds dispatch M(E
2016.01.06 20:02:24 1: DEBUG>myleds: partial message "M(E\001\001\001M(E\001\001\001M(E\001\001\000M(E\001\001\000" recorded at 1452106944.03449
2016.01.06 20:02:24 1: DEBUG>myleds: partial message expired.
2016.01.06 20:02:24 1: DEBUG>myleds: analyzing "M(E\001\001\001\r\n".
2016.01.06 20:02:24 1: DEBUG>myleds: trying to find a match for "M(E\001\001\001"
2016.01.06 20:02:24 1: DEBUG> Checking device Led1 with class myleddevice...
2016.01.06 20:02:24 1: DEBUG>myleds: partial message "M(E\001\001\001" kept.
2016.01.06 20:02:24 5: mylampe: Spontaneously received "!"
2016.01.06 20:02:24 5: mylampe dispatch !
2016.01.06 20:02:24 1: DEBUG>mylampe: partial message "#" recorded at 1452106944.0798
2016.01.06 20:02:24 1: DEBUG>mylampe: analyzing "#!".
2016.01.06 20:02:24 1: DEBUG>mylampe: trying to find a match for "#!"
2016.01.06 20:02:24 1: DEBUG> Checking device Testlicht1 with class mylampedevice...
2016.01.06 20:02:24 1: DEBUG> Trying to find a match in class mylampedevice...
2016.01.06 20:02:24 1: DEBUG> Trying to match reading on with regular expression "!M\(E[\001-\005]\001\001" (device Testlicht1, classdef mylampedevice, reading on).
2016.01.06 20:02:24 1: DEBUG> Trying to match reading offgo with regular expression "\043M\(E[\001-\005]\001\000" (device Testlicht1, classdef mylampedevice, reading offgo).
2016.01.06 20:02:24 1: DEBUG> Trying to match reading Rollo with regular expression "TRollo1;1" (device Testlicht1, classdef mylampedevice, reading Rollo).
2016.01.06 20:02:24 1: DEBUG> Trying to match reading off with regular expression "!M\(E[\001-\005]\001\000" (device Testlicht1, classdef mylampedevice, reading off).
2016.01.06 20:02:24 1: DEBUG> Trying to match reading ongo with regular expression "\043M\(E[\001-\005]\001\001" (device Testlicht1, classdef mylampedevice, reading ongo).
2016.01.06 20:02:24 1: DEBUG>mylampe: partial message "#!" kept.
2016.01.06 20:02:24 5: myleds: Spontaneously received "M(E\001\001\001\r\n"
2016.01.06 20:02:24 5: myleds dispatch M(E
2016.01.06 20:02:24 1: DEBUG>myleds: partial message "M(E\001\001\001" recorded at 1452106944.10602
2016.01.06 20:02:24 1: DEBUG>myleds: analyzing "M(E\001\001\001M(E\001\001\001\r\n".
2016.01.06 20:02:24 1: DEBUG>myleds: trying to find a match for "M(E\001\001\001M(E\001\001\001"
2016.01.06 20:02:24 1: DEBUG> Checking device Led1 with class myleddevice...
2016.01.06 20:02:24 1: DEBUG>myleds: partial message "M(E\001\001\001M(E\001\001\001" kept.