FHEM Forum

FHEM - Hausautomations-Systeme => Sonstige Systeme => Thema gestartet von: Tom_S am 19 September 2014, 19:22:02

Titel: neue ECMD Version - reading Match Problem
Beitrag von: Tom_S am 19 September 2014, 19:22:02
hallo,

ich habe heute mal die neue Version getestet. Soweit funktioniert auch alles. Wenn aber mehrere Matchs in einem String übertragen werden, funktioniert es bei mir noch nicht. Habe wohl einen Fehler in der classdef.



params pin

set on cmd {"setportc %pin 1\r\n"}
set on expect ".*"
set on postproc {substr($_, 0, 2) eq "OK" ? "" : "$_";}

set off cmd {"setportc %pin 0\r\n"}
set off expect ".*"
set off postproc {substr($_, 0, 2) eq "OK" ? "" : "$_";}

# Controller sendet die Portzustände bei Änderung. Diese werden über reading verarbeitet
reading on match "PC %pin 1\n"
reading on expect "PC (\d) 1\n"
reading on postproc { s/.*PC %pin 1\n.*//s; "$_" eq "" ? "" : "Fehler" }
reading off match "PC %pin 0\n"
reading off expect "PC (\d) 0\n"
reading off postproc { s/.*PC %pin 0\n.*//s; "$_" eq "" ? "" : "Fehler" }


Logtraffic sagt:

2014.09.19 18:49:11 3: NETIO91: read "PC 0 0\nPC 1 0\nPC 2 1\nPC 3 0\n"
2014.09.19 18:49:13 3: NETIO91: read "PC 4 0\nPC 5 0\nPC 6 0\nPC 7 0\n"
2014.09.19 18:50:11 3: NETIO91: read "PC 0 0\nPC 1 0\nPC 2 1\nPC 3 0\n"
2014.09.19 18:50:13 3: NETIO91: read "PC 4 0\nPC 5 0\nPC 6 0\nPC 7 0\n"
2014.09.19 18:51:11 3: NETIO91: read "PC 0 0\nPC 1 0\nPC 2 1\nPC 3 0\n"
2014.09.19 18:51:13 3: NETIO91: read "PC 4 0\nPC 5 0\nPC 6 0\nPC 7 0\n"



wie gesagt, wenn nur ein Match kommt funktioniert es


2014.09.19 18:50:13 3: NETIO91: read "PC 4 0\n"
2014.09.19 18:50:19 3: NETIO91: read "PC 4 1\n"


LG Tom_S
Titel: Antw:neue ECMD Version - reading Match Problem
Beitrag von: Tom_S am 19 September 2014, 20:02:23
man soll halt erst mal lesen und denken.
reading on expect
ist Unsinn

attr NETIO91 split \n

und in der classdef das "\n" hinter dem Match weg lassen und alles ist gut.

danke und LG
Tom_S