Unterschied zwischen scheinbar Gleichem finden

Begonnen von NeuFehm, 22 Dezember 2015, 21:59:48

Vorheriges Thema - Nächstes Thema

NeuFehm

oder ich mach ich halt 4 Parameter?
params M_Adresse M_Relais M_CHARRelais M_Schalttyp
Raspberry Pi B+
RS 485 Schnittstellen: DIGITUS DA-70157, LINKSPTITE RS485/GPIO Shield for Raspberry Pi
RS485 Geräte: Ultraschallsensor für Zisternenfüllstand (Eigenbau), 4x8 Relais-M-Mastermodule (Eigenbau), 6 T-Module (Schalter und 3 analoge Eingänge) (Eigenbau)
sonstige Hardware: 2 Relay Modul

NeuFehm

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
Raspberry Pi B+
RS 485 Schnittstellen: DIGITUS DA-70157, LINKSPTITE RS485/GPIO Shield for Raspberry Pi
RS485 Geräte: Ultraschallsensor für Zisternenfüllstand (Eigenbau), 4x8 Relais-M-Mastermodule (Eigenbau), 6 T-Module (Schalter und 3 analoge Eingänge) (Eigenbau)
sonstige Hardware: 2 Relay Modul

NeuFehm

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"}
Raspberry Pi B+
RS 485 Schnittstellen: DIGITUS DA-70157, LINKSPTITE RS485/GPIO Shield for Raspberry Pi
RS485 Geräte: Ultraschallsensor für Zisternenfüllstand (Eigenbau), 4x8 Relais-M-Mastermodule (Eigenbau), 6 T-Module (Schalter und 3 analoge Eingänge) (Eigenbau)
sonstige Hardware: 2 Relay Modul

NeuFehm

Raspberry Pi B+
RS 485 Schnittstellen: DIGITUS DA-70157, LINKSPTITE RS485/GPIO Shield for Raspberry Pi
RS485 Geräte: Ultraschallsensor für Zisternenfüllstand (Eigenbau), 4x8 Relais-M-Mastermodule (Eigenbau), 6 T-Module (Schalter und 3 analoge Eingänge) (Eigenbau)
sonstige Hardware: 2 Relay Modul

NeuFehm

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
Raspberry Pi B+
RS 485 Schnittstellen: DIGITUS DA-70157, LINKSPTITE RS485/GPIO Shield for Raspberry Pi
RS485 Geräte: Ultraschallsensor für Zisternenfüllstand (Eigenbau), 4x8 Relais-M-Mastermodule (Eigenbau), 6 T-Module (Schalter und 3 analoge Eingänge) (Eigenbau)
sonstige Hardware: 2 Relay Modul

NeuFehm

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.
Raspberry Pi B+
RS 485 Schnittstellen: DIGITUS DA-70157, LINKSPTITE RS485/GPIO Shield for Raspberry Pi
RS485 Geräte: Ultraschallsensor für Zisternenfüllstand (Eigenbau), 4x8 Relais-M-Mastermodule (Eigenbau), 6 T-Module (Schalter und 3 analoge Eingänge) (Eigenbau)
sonstige Hardware: 2 Relay Modul