ECMD postproc Frage [gelöst]

Begonnen von TiPpFeHlEr, 10 November 2019, 18:01:01

Vorheriges Thema - Nächstes Thema

TiPpFeHlEr

Hi,

ich möchte ein Datagramm das über eine serielle Schnittstelle kommt in ein ECMDDevice bringen.

was wird gesendet (Arduino->fhem)
Phase_2 : 21.12 W : 0.11 A : 188.44 V \r\n

das kommt in fhem an
Strom: Phase_2 : 21.19 W : 0.11 A : 187.62 V \r\n (\120\150\141\163\145\137\062\040\072\040\062\061\056\061\071\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061\070\067\056\066\062\040\126\040\015\012)

match in classdef
reading Phase2 match "\120\150\141\163\145\137\062\040\072\040.*\040\127\040\040\072\040.*\040\101\040\040\072\040.*\040\126\040\015\012"

match funktioniert
matches regex \120\150\141\163\145\137\062\040\072\040.*\040\127\040\040\072\040.*\040\101\040\040\072\040.*\040\126\040\015\012 for reading Phase2 of device Strom.KG with class Stromauslesung

jetzt wirds kompliziert.
wie muss das postproc aussehen um 3 Werte aus diesem datagramm zu extrahieren?
1. Volt
2. Ampere
3. Leistung

wichtig ist noch das die länge der Werte variert im datagramm also zB. 20.00 W oder 2000.00 W
Ich wäre sehr Dankbar für eure Hilfe.


MfG Maik

Dr. Boris Neubert

Hi,

^Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n$

In $1, $2 und $3 stehen danach die gematchten Zahlen.

Grüße
Boris
Globaler Moderator, Developer, aktives Mitglied des FHEM e.V. (Marketing, Verwaltung)
Bitte keine unaufgeforderten privaten Nachrichten!

TiPpFeHlEr

Hi Boris,

ich habs  nicht 100% verstanden.  :-\

wo kommt die Zeile
^Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n$
hin?

ins match?
reading Phase3 match "^Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n$"
?

kannst du bitte etwas präziser sein.

meine momentane classdef sieht einfach aus
reading Phase1 match "\120\150\141\163\145\137\061\040\072\040.*\040\127\040\040\072\040.*\040\101\040\040\072\040.*\040\126\040\015\012"
reading Phase2 match "\120\150\141\163\145\137\062\040\072\040.*\040\127\040\040\072\040.*\040\101\040\040\072\040.*\040\126\040\015\012"
reading Phase3 match "\120\150\141\163\145\137\063\040\072\040.*\040\127\040\040\072\040.*\040\101\040\040\072\040.*\040\126\040\015\012"


damit bekomme ich folgende readings
Strom.png

MfG Maik

Dr. Boris Neubert

Hallo Maik,

würde es nach nochmaligem Nachdenken so machen (für Phase 1):


reading W1 match "Phase_1 : .\r\n"
reading W1 postproc { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$/;; $_; }
reading A1 match "Phase_1 : .\r\n"
reading A1 postproc { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$2/;; $_; }
reading V1 match "Phase_1 : .\r\n"
reading V1 postproc { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$3/;; $_; }



Wenn ein Datagramm empfangen wird, das mit "Phase_1 : " beginnt und auf "\r\n" endet, werden die Readings W1, A1, V1 aktualisiert. Dazu wird der Postprozessor angeworfen, der die empfangene Zeile durch das erste bzw. zweite bzw. dritte Pattern ersetzt, das in Klammern angegeben wird.

Wenn das nicht klappt, bitte entsprechenden Auszug aus dem Log mit Verbosity 5 zeigen.

Viele Grüße
Boris
Globaler Moderator, Developer, aktives Mitglied des FHEM e.V. (Marketing, Verwaltung)
Bitte keine unaufgeforderten privaten Nachrichten!

TiPpFeHlEr

klappt nicht ganz.

log:
2019.11.16 10:08:02 3 : Strom: read P (\120)
2019.11.16 10:08:02 5 : Strom: Spontaneously received P (\120)
2019.11.16 10:08:02 5 : Strom: dispatch P
2019.11.16 10:08:02 5 : Strom: partial message Phase_3 : 41.28 W : 0.22 A : 189.11 V \r\n (\120\150\141\163\145\137\063\040\072\040\064\061\056\062\070\040\127\040\040\072\040\060\056\062\062\040\101\040\040\072\040\061\070\071\056\061\061\040\126\040\015\012) expired.
2019.11.16 10:08:02 5 : Strom: trying to match message P (\120)
2019.11.16 10:08:02 5 : Strom: partial message P (\120) kept
2019.11.16 10:08:02 3 : Strom: read hase_1 (\150\141\163\145\137\061)
2019.11.16 10:08:02 5 : Strom: Spontaneously received hase_1 (\150\141\163\145\137\061)
2019.11.16 10:08:02 5 : Strom: dispatch hase_1
2019.11.16 10:08:02 5 : Strom: merging partial message P (\120) and hase_1 (\150\141\163\145\137\061)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_1 (\120\150\141\163\145\137\061)
2019.11.16 10:08:02 5 : Strom: partial message Phase_1 (\120\150\141\163\145\137\061) kept
2019.11.16 10:08:02 3 : Strom: read : 20. (\040\072\040\062\060\056)
2019.11.16 10:08:02 5 : Strom: Spontaneously received : 20. (\040\072\040\062\060\056)
2019.11.16 10:08:02 5 : Strom: dispatch : 20.
2019.11.16 10:08:02 5 : Strom: merging partial message Phase_1 (\120\150\141\163\145\137\061) and : 20. (\040\072\040\062\060\056)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_1 : 20. (\120\150\141\163\145\137\061\040\072\040\062\060\056)
2019.11.16 10:08:02 5 : Strom: partial message Phase_1 : 20. (\120\150\141\163\145\137\061\040\072\040\062\060\056) kept
2019.11.16 10:08:02 3 : Strom: read 91 W (\071\061\040\127\040\040)
2019.11.16 10:08:02 5 : Strom: Spontaneously received 91 W (\071\061\040\127\040\040)
2019.11.16 10:08:02 5 : Strom: dispatch 91 W
2019.11.16 10:08:02 5 : Strom: merging partial message Phase_1 : 20. (\120\150\141\163\145\137\061\040\072\040\062\060\056) and 91 W (\071\061\040\127\040\040)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_1 : 20.91 W (\120\150\141\163\145\137\061\040\072\040\062\060\056\071\061\040\127\040\040)
2019.11.16 10:08:02 5 : Strom: partial message Phase_1 : 20.91 W (\120\150\141\163\145\137\061\040\072\040\062\060\056\071\061\040\127\040\040) kept
2019.11.16 10:08:02 3 : Strom: read : 0.11 (\072\040\060\056\061\061\040)
2019.11.16 10:08:02 5 : Strom: Spontaneously received : 0.11 (\072\040\060\056\061\061\040)
2019.11.16 10:08:02 5 : Strom: dispatch : 0.11
2019.11.16 10:08:02 5 : Strom: merging partial message Phase_1 : 20.91 W (\120\150\141\163\145\137\061\040\072\040\062\060\056\071\061\040\127\040\040) and : 0.11 (\072\040\060\056\061\061\040)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_1 : 20.91 W : 0.11 (\120\150\141\163\145\137\061\040\072\040\062\060\056\071\061\040\127\040\040\072\040\060\056\061\061\040)
2019.11.16 10:08:02 5 : Strom: partial message Phase_1 : 20.91 W : 0.11 (\120\150\141\163\145\137\061\040\072\040\062\060\056\071\061\040\127\040\040\072\040\060\056\061\061\040) kept
2019.11.16 10:08:02 3 : Strom: read A : 1 (\101\040\040\072\040\061)
2019.11.16 10:08:02 5 : Strom: Spontaneously received A : 1 (\101\040\040\072\040\061)
2019.11.16 10:08:02 5 : Strom: dispatch A : 1
2019.11.16 10:08:02 5 : Strom: merging partial message Phase_1 : 20.91 W : 0.11 (\120\150\141\163\145\137\061\040\072\040\062\060\056\071\061\040\127\040\040\072\040\060\056\061\061\040) and A : 1 (\101\040\040\072\040\061)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_1 : 20.91 W : 0.11 A : 1 (\120\150\141\163\145\137\061\040\072\040\062\060\056\071\061\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061)
2019.11.16 10:08:02 5 : Strom: partial message Phase_1 : 20.91 W : 0.11 A : 1 (\120\150\141\163\145\137\061\040\072\040\062\060\056\071\061\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061) kept
2019.11.16 10:08:02 3 : Strom: read 88.73 (\070\070\056\067\063\040)
2019.11.16 10:08:02 5 : Strom: Spontaneously received 88.73 (\070\070\056\067\063\040)
2019.11.16 10:08:02 5 : Strom: dispatch 88.73
2019.11.16 10:08:02 5 : Strom: merging partial message Phase_1 : 20.91 W : 0.11 A : 1 (\120\150\141\163\145\137\061\040\072\040\062\060\056\071\061\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061) and 88.73 (\070\070\056\067\063\040)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_1 : 20.91 W : 0.11 A : 188.73 (\120\150\141\163\145\137\061\040\072\040\062\060\056\071\061\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061\070\070\056\067\063\040)
2019.11.16 10:08:02 5 : Strom: partial message Phase_1 : 20.91 W : 0.11 A : 188.73 (\120\150\141\163\145\137\061\040\072\040\062\060\056\071\061\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061\070\070\056\067\063\040) kept
2019.11.16 10:08:02 3 : Strom: read V \r\nPha (\126\040\015\012\120\150\141)
2019.11.16 10:08:02 5 : Strom: Spontaneously received V \r\nPha (\126\040\015\012\120\150\141)
2019.11.16 10:08:02 5 : Strom: dispatch V \r\nPha
2019.11.16 10:08:02 5 : Strom: merging partial message Phase_1 : 20.91 W : 0.11 A : 188.73 (\120\150\141\163\145\137\061\040\072\040\062\060\056\071\061\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061\070\070\056\067\063\040) and V \r\nPha (\126\040\015\012\120\150\141)
2019.11.16 10:08:02 5 : Strom: Phase_1 : 20.91 W : 0.11 A : 188.73 V \r\nPha (\120\150\141\163\145\137\061\040\072\040\062\060\056\071\061\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061\070\070\056\067\063\040\126\040\015\012\120\150\141) split into 2 parts
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_1 : 20.91 W : 0.11 A : 188.73 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\060\056\071\061\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061\070\070\056\067\063\040\126\040\015\012)
2019.11.16 10:08:02 5 : Strom: trying to match message Pha (\120\150\141)
2019.11.16 10:08:02 5 : Strom: partial message Pha (\120\150\141) kept
2019.11.16 10:08:02 3 : Strom: read se_2 : 23.5 (\163\145\137\062\040\072\040\062\063\056\065)
2019.11.16 10:08:02 5 : Strom: Spontaneously received se_2 : 23.5 (\163\145\137\062\040\072\040\062\063\056\065)
2019.11.16 10:08:02 5 : Strom: dispatch se_2 : 23.5
2019.11.16 10:08:02 5 : Strom: merging partial message Pha (\120\150\141) and se_2 : 23.5 (\163\145\137\062\040\072\040\062\063\056\065)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_2 : 23.5 (\120\150\141\163\145\137\062\040\072\040\062\063\056\065)
2019.11.16 10:08:02 5 : Strom: partial message Phase_2 : 23.5 (\120\150\141\163\145\137\062\040\072\040\062\063\056\065) kept
2019.11.16 10:08:02 3 : Strom: read 0 W : (\060\040\127\040\040\072)
2019.11.16 10:08:02 5 : Strom: Spontaneously received 0 W : (\060\040\127\040\040\072)
2019.11.16 10:08:02 5 : Strom: dispatch 0 W :
2019.11.16 10:08:02 5 : Strom: merging partial message Phase_2 : 23.5 (\120\150\141\163\145\137\062\040\072\040\062\063\056\065) and 0 W : (\060\040\127\040\040\072)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_2 : 23.50 W : (\120\150\141\163\145\137\062\040\072\040\062\063\056\065\060\040\127\040\040\072)
2019.11.16 10:08:02 5 : Strom: partial message Phase_2 : 23.50 W : (\120\150\141\163\145\137\062\040\072\040\062\063\056\065\060\040\127\040\040\072) kept
2019.11.16 10:08:02 3 : Strom: read 0.12 (\040\060\056\061\062\040)
2019.11.16 10:08:02 5 : Strom: Spontaneously received 0.12 (\040\060\056\061\062\040)
2019.11.16 10:08:02 5 : Strom: dispatch 0.12
2019.11.16 10:08:02 5 : Strom: merging partial message Phase_2 : 23.50 W : (\120\150\141\163\145\137\062\040\072\040\062\063\056\065\060\040\127\040\040\072) and 0.12 (\040\060\056\061\062\040)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_2 : 23.50 W : 0.12 (\120\150\141\163\145\137\062\040\072\040\062\063\056\065\060\040\127\040\040\072\040\060\056\061\062\040)
2019.11.16 10:08:02 5 : Strom: partial message Phase_2 : 23.50 W : 0.12 (\120\150\141\163\145\137\062\040\072\040\062\063\056\065\060\040\127\040\040\072\040\060\056\061\062\040) kept
2019.11.16 10:08:02 3 : Strom: read A : 1 (\101\040\040\072\040\061)
2019.11.16 10:08:02 5 : Strom: Spontaneously received A : 1 (\101\040\040\072\040\061)
2019.11.16 10:08:02 5 : Strom: dispatch A : 1
2019.11.16 10:08:02 5 : Strom: merging partial message Phase_2 : 23.50 W : 0.12 (\120\150\141\163\145\137\062\040\072\040\062\063\056\065\060\040\127\040\040\072\040\060\056\061\062\040) and A : 1 (\101\040\040\072\040\061)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_2 : 23.50 W : 0.12 A : 1 (\120\150\141\163\145\137\062\040\072\040\062\063\056\065\060\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061)
2019.11.16 10:08:02 5 : Strom: partial message Phase_2 : 23.50 W : 0.12 A : 1 (\120\150\141\163\145\137\062\040\072\040\062\063\056\065\060\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061) kept
2019.11.16 10:08:02 3 : Strom: read 89.19 V (\070\071\056\061\071\040\126)
2019.11.16 10:08:02 5 : Strom: Spontaneously received 89.19 V (\070\071\056\061\071\040\126)
2019.11.16 10:08:02 5 : Strom: dispatch 89.19 V
2019.11.16 10:08:02 5 : Strom: merging partial message Phase_2 : 23.50 W : 0.12 A : 1 (\120\150\141\163\145\137\062\040\072\040\062\063\056\065\060\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061) and 89.19 V (\070\071\056\061\071\040\126)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_2 : 23.50 W : 0.12 A : 189.19 V (\120\150\141\163\145\137\062\040\072\040\062\063\056\065\060\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\071\056\061\071\040\126)
2019.11.16 10:08:02 5 : Strom: partial message Phase_2 : 23.50 W : 0.12 A : 189.19 V (\120\150\141\163\145\137\062\040\072\040\062\063\056\065\060\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\071\056\061\071\040\126) kept
2019.11.16 10:08:02 3 : Strom: read \r\nPha (\040\015\012\120\150\141)
2019.11.16 10:08:02 5 : Strom: Spontaneously received \r\nPha (\040\015\012\120\150\141)
2019.11.16 10:08:02 5 : Strom: dispatch \r\nPha
2019.11.16 10:08:02 5 : Strom: merging partial message Phase_2 : 23.50 W : 0.12 A : 189.19 V (\120\150\141\163\145\137\062\040\072\040\062\063\056\065\060\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\071\056\061\071\040\126) and \r\nPha (\040\015\012\120\150\141)
2019.11.16 10:08:02 5 : Strom: Phase_2 : 23.50 W : 0.12 A : 189.19 V \r\nPha (\120\150\141\163\145\137\062\040\072\040\062\063\056\065\060\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\071\056\061\071\040\126\040\015\012\120\150\141) split into 2 parts
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_2 : 23.50 W : 0.12 A : 189.19 V \r\n (\120\150\141\163\145\137\062\040\072\040\062\063\056\065\060\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\071\056\061\071\040\126\040\015\012)
2019.11.16 10:08:02 5 : Strom: trying to match message Pha (\120\150\141)
2019.11.16 10:08:02 5 : Strom: partial message Pha (\120\150\141) kept
2019.11.16 10:08:02 3 : Strom: read se_3 : 41.5 (\163\145\137\063\040\072\040\064\061\056\065)
2019.11.16 10:08:02 5 : Strom: Spontaneously received se_3 : 41.5 (\163\145\137\063\040\072\040\064\061\056\065)
2019.11.16 10:08:02 5 : Strom: dispatch se_3 : 41.5
2019.11.16 10:08:02 5 : Strom: merging partial message Pha (\120\150\141) and se_3 : 41.5 (\163\145\137\063\040\072\040\064\061\056\065)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_3 : 41.5 (\120\150\141\163\145\137\063\040\072\040\064\061\056\065)
2019.11.16 10:08:02 5 : Strom: partial message Phase_3 : 41.5 (\120\150\141\163\145\137\063\040\072\040\064\061\056\065) kept
2019.11.16 10:08:02 3 : Strom: read 5 W : (\065\040\127\040\040\072\040)
2019.11.16 10:08:02 5 : Strom: Spontaneously received 5 W : (\065\040\127\040\040\072\040)
2019.11.16 10:08:02 5 : Strom: dispatch 5 W :
2019.11.16 10:08:02 5 : Strom: merging partial message Phase_3 : 41.5 (\120\150\141\163\145\137\063\040\072\040\064\061\056\065) and 5 W : (\065\040\127\040\040\072\040)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_3 : 41.55 W : (\120\150\141\163\145\137\063\040\072\040\064\061\056\065\065\040\127\040\040\072\040)
2019.11.16 10:08:02 5 : Strom: partial message Phase_3 : 41.55 W : (\120\150\141\163\145\137\063\040\072\040\064\061\056\065\065\040\127\040\040\072\040) kept
2019.11.16 10:08:02 3 : Strom: read 0.22 A (\060\056\062\062\040\101)
2019.11.16 10:08:02 5 : Strom: Spontaneously received 0.22 A (\060\056\062\062\040\101)
2019.11.16 10:08:02 5 : Strom: dispatch 0.22 A
2019.11.16 10:08:02 5 : Strom: merging partial message Phase_3 : 41.55 W : (\120\150\141\163\145\137\063\040\072\040\064\061\056\065\065\040\127\040\040\072\040) and 0.22 A (\060\056\062\062\040\101)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_3 : 41.55 W : 0.22 A (\120\150\141\163\145\137\063\040\072\040\064\061\056\065\065\040\127\040\040\072\040\060\056\062\062\040\101)
2019.11.16 10:08:02 5 : Strom: partial message Phase_3 : 41.55 W : 0.22 A (\120\150\141\163\145\137\063\040\072\040\064\061\056\065\065\040\127\040\040\072\040\060\056\062\062\040\101) kept
2019.11.16 10:08:02 3 : Strom: read : 188 (\040\040\072\040\061\070\070)
2019.11.16 10:08:02 5 : Strom: Spontaneously received : 188 (\040\040\072\040\061\070\070)
2019.11.16 10:08:02 5 : Strom: dispatch : 188
2019.11.16 10:08:02 5 : Strom: merging partial message Phase_3 : 41.55 W : 0.22 A (\120\150\141\163\145\137\063\040\072\040\064\061\056\065\065\040\127\040\040\072\040\060\056\062\062\040\101) and : 188 (\040\040\072\040\061\070\070)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_3 : 41.55 W : 0.22 A : 188 (\120\150\141\163\145\137\063\040\072\040\064\061\056\065\065\040\127\040\040\072\040\060\056\062\062\040\101\040\040\072\040\061\070\070)
2019.11.16 10:08:02 5 : Strom: partial message Phase_3 : 41.55 W : 0.22 A : 188 (\120\150\141\163\145\137\063\040\072\040\064\061\056\065\065\040\127\040\040\072\040\060\056\062\062\040\101\040\040\072\040\061\070\070) kept
2019.11.16 10:08:02 3 : Strom: read .97 V \r (\056\071\067\040\126\040\015)
2019.11.16 10:08:02 5 : Strom: Spontaneously received .97 V \r (\056\071\067\040\126\040\015)
2019.11.16 10:08:02 5 : Strom: dispatch .97 V \r
2019.11.16 10:08:02 5 : Strom: merging partial message Phase_3 : 41.55 W : 0.22 A : 188 (\120\150\141\163\145\137\063\040\072\040\064\061\056\065\065\040\127\040\040\072\040\060\056\062\062\040\101\040\040\072\040\061\070\070) and .97 V \r (\056\071\067\040\126\040\015)
2019.11.16 10:08:02 5 : Strom: trying to match message Phase_3 : 41.55 W : 0.22 A : 188.97 V \r (\120\150\141\163\145\137\063\040\072\040\064\061\056\065\065\040\127\040\040\072\040\060\056\062\062\040\101\040\040\072\040\061\070\070\056\071\067\040\126\040\015)
2019.11.16 10:08:02 5 : Strom: partial message Phase_3 : 41.55 W : 0.22 A : 188.97 V \r (\120\150\141\163\145\137\063\040\072\040\064\061\056\065\065\040\127\040\040\072\040\060\056\062\062\040\101\040\040\072\040\061\070\070\056\071\067\040\126\040\015) kept
2019.11.16 10:08:02 3 : Strom: read \n (\012)
2019.11.16 10:08:02 5 : Strom: Spontaneously received \n (\012)
2019.11.16 10:08:02 5 : Strom: dispatch \n
2019.11.16 10:08:02 5 : Starting notify loop for Strom, 1 event(s), first is UNKNOWNCODE \n
2019-11-16 10:08:02 ECMD Strom UNKNOWNCODE
2019.11.16 10:08:02 5 : End notify loop for Strom
2019.11.16 10:08:02 3 : Strom: Unknown code , help me!


mfg  maik

TiPpFeHlEr

match klappte nicht.

reading W1 match "Phase_1 : .\r\n"
geändert in
reading W1 match "Phase_1 : .*\r\n"

match klappt

gibt aber Fehler beim postproc

2019.11.16 10:15:56 5 : Strom: trying to match message Phase_1 : 20.15 W : 0.11 A : 187.53 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\060\056\061\065\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061\070\067\056\065\063\040\126\040\015\012)
2019.11.16 10:15:56 5 : Strom: Phase_1 : 20.15 W : 0.11 A : 187.53 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\060\056\061\065\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061\070\067\056\065\063\040\126\040\015\012) matches regex Phase_1 : .*\r\n for reading W1 of device Strom.KG with class Stromauslesung
2019.11.16 10:15:56 5 : Postprocessing "Phase_1 : 20.15 W : 0.11 A : 187.53 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\060\056\061\065\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061\070\067\056\065\063\040\126\040\015\012)" with perl command { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$/;; $_; }.
2019.11.16 10:15:56 1 : ERROR evaluating { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$/;; $_; }: Final $ should be \$ or $name at (eval 2083) line 1, within string syntax error at (eval 2083) line 1, near "{ s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$/"
2019.11.16 10:15:56 5 : Postprocessed value is "Final $ should be \\$ or $name at (eval 2083) line 1, within string\nsyntax error at (eval 2083) line 1, near "{ s/Phase_1 : (\\d+\\.d+) W : (\\d+\\.d+) A : (\\d+\\.d+) V \\r\\n/$/"\n (\106\151\156\141\154\040\044\040\163\150\157\165\154\144\040\142\145\040\134\044\040\157\162\040\044\156\141\155\145\040\141\164\040\050\145\166\141\154\040\062\060\070\063\051\040\154\151\156\145\040\061\054\040\167\151\164\150\151\156\040\163\164\162\151\156\147\012\163\171\156\164\141\170\040\145\162\162\157\162\040\141\164\040\050\145\166\141\154\040\062\060\070\063\051\040\154\151\156\145\040\061\054\040\156\145\141\162\040\042\173\040\163\057\120\150\141\163\145\137\061\040\072\040\050\134\144\053\134\056\144\053\051\040\127\040\072\040\050\134\144\053\134\056\144\053\051\040\101\040\072\040\050\134\144\053\134\056\144\053\051\040\126\040\134\162\134\156\057\044\057\042\012)".


mfg maik

TiPpFeHlEr

#6
ok, habe also

reading W1 postproc { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$/;; $_; }

in
reading W1 postproc { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/\$/;; $_; }
geändert.

aber das erzeugt value ist nicht korrekt



2019.11.16 10:33:58 5 : Strom: trying to match message Phase_1 : 20.82 W : 0.11 A : 188.53 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\060\056\070\062\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061\070\070\056\065\063\040\126\040\015\012)
2019.11.16 10:33:58 5 : Strom: Phase_1 : 20.82 W : 0.11 A : 188.53 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\060\056\070\062\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061\070\070\056\065\063\040\126\040\015\012) matches regex Phase_1 : .*\r\n for reading V1 of device Strom.KG with class Stromauslesung
2019.11.16 10:33:58 5 : Postprocessing "Phase_1 : 20.82 W : 0.11 A : 188.53 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\060\056\070\062\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061\070\070\056\065\063\040\126\040\015\012)" with perl command { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/\$3/;; $_; }.
2019.11.16 10:33:58 5 : Postprocessed value is "Phase_1 : 20.82 W : 0.11 A : 188.53 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\060\056\070\062\040\127\040\040\072\040\060\056\061\061\040\101\040\040\072\040\061\070\070\056\065\063\040\126\040\015\012)".


momentane classdef sieht so aus
reading W1 match "Phase_1 : .*\r\n"
reading W1 postproc { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/\$/;; $_; }
reading A1 match "Phase_1 : .*\r\n"
reading A1 postproc { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/\$2/;; $_; }
reading V1 match "Phase_1 : .*\r\n"
reading V1 postproc { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/\$3/;; $_; }

reading W2 match "Phase_2 : .*\r\n"
reading W2 postproc { s/Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/\$/;; $_; }
reading A2 match "Phase_2 : .*\r\n"
reading A2 postproc { s/Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/\$2/;; $_; }
reading V2 match "Phase_2 : .*\r\n"
reading V2 postproc { s/Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/\$3/;; $_; }

reading W3 match "Phase_3 : .*\r\n"
reading W3 postproc { s/Phase_3 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/\$/;; $_; }
reading A3 match "Phase_3 : .*\r\n"
reading A3 postproc { s/Phase_3 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/\$2/;; $_; }
reading V3 match "Phase_3 : .*\r\n"
reading V3 postproc { s/Phase_3 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/\$3/;; $_; }


das kommt momentan dabei raus
defmod Strom.KG ECMDDevice Stromauslesung
attr Strom.KG IODev Strom
attr Strom.KG verbose 5

setstate Strom.KG V3 Phase_3 : 41.77 W  : 0.22 A  : 189.12 V
\

setstate Strom.KG 2019-11-16 10:49:11 A1 Phase_1 : 20.27 W  : 0.11 A  : 188.32 V
\

setstate Strom.KG 2019-11-16 10:49:11 A2 Phase_2 : 23.52 W  : 0.12 A  : 189.92 V
\

setstate Strom.KG 2019-11-16 10:49:11 A3 Phase_3 : 41.77 W  : 0.22 A  : 189.12 V
\

setstate Strom.KG 2019-11-16 10:49:11 V1 Phase_1 : 20.27 W  : 0.11 A  : 188.32 V
\

setstate Strom.KG 2019-11-16 10:49:11 V2 Phase_2 : 23.52 W  : 0.12 A  : 189.92 V
\

setstate Strom.KG 2019-11-16 10:49:11 V3 Phase_3 : 41.77 W  : 0.22 A  : 189.12 V
\

setstate Strom.KG 2019-11-16 10:49:11 W1 Phase_1 : 20.27 W  : 0.11 A  : 188.32 V
\

setstate Strom.KG 2019-11-16 10:49:11 W2 Phase_2 : 23.52 W  : 0.12 A  : 189.92 V
\

setstate Strom.KG 2019-11-16 10:49:11 W3 Phase_3 : 41.77 W  : 0.22 A  : 189.12 V
\

setstate Strom.KG 2019-11-16 10:49:11 state V3 Phase_3 : 41.77 W  : 0.22 A  : 189.12 V
\





mfg maik

Dr. Boris Neubert

Bei dem W1 postproc habe ich mich auch vertippt. Da muss $1 statt $ stehen, um die gemachte Zeile durch den gematchten Wert 1 (erste Klammer) zu ersetzen. Vor dem $ in den Ausdrücken $1, $2 und $3 darf kein \.

Kannst Du das bitte nochmal versuchen und wieder das Log posten?
Globaler Moderator, Developer, aktives Mitglied des FHEM e.V. (Marketing, Verwaltung)
Bitte keine unaufgeforderten privaten Nachrichten!

TiPpFeHlEr

Hi Boris,

das hatte ich nach viel lesen auch schon gemerkt.

die classdef sieht so aus
reading W1 match "Phase_1 : .*\r\n"
reading W1 postproc { s/Phase_1 : (\d+\.d+) W  : (\d+\.d+) A  : (\d+\.d+) V \r\n/$1/;;$_}
reading A1 match "Phase_1 : .*\r\n"
reading A1 postproc { s/Phase_1 : (\d+\.d+) W  : (\d+\.d+) A  : (\d+\.d+) V \r\n/$2/;;$_}
reading V1 match "Phase_1 : .*\r\n"
reading V1 postproc { s/Phase_1 : (\d+\.d+) W  : (\d+\.d+) A  : (\d+\.d+) V \r\n/$3/;;$_}

reading W2 match "Phase_2 : .*\r\n"
reading W2 postproc { s/Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$1/;; $_ }
reading A2 match "Phase_2 : .*\r\n"
reading A2 postproc { s/Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$2/;; $_ }
reading V2 match "Phase_2 : .*\r\n"
reading V2 postproc { s/Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$3/;; $_ }

reading W3 match "Phase_3 : .*\r\n"
reading W3 postproc { s/Phase_3 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$1/;; $_ }
reading A3 match "Phase_3 : .*\r\n"
reading A3 postproc { s/Phase_3 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$2/;; $_ }
reading V3 match "Phase_3 : .*\r\n"
reading V3 postproc { s/Phase_3 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$3/;; $_ }


raus kommt das
setstate Strom.KG 2019-11-18 17:25:48 A1 Phase_1 : 21.86 W  : 0.12 A  : 186.87 V
\

setstate Strom.KG 2019-11-18 17:25:48 A2 Phase_2 : 24.03 W  : 0.13 A  : 187.38 V
\

setstate Strom.KG 2019-11-18 17:25:48 A3 Phase_3 : 40.53 W  : 0.22 A  : 187.78 V
\

setstate Strom.KG 2019-11-18 17:25:48 V1 Phase_1 : 21.86 W  : 0.12 A  : 186.87 V
\

setstate Strom.KG 2019-11-18 17:25:48 V2 Phase_2 : 24.03 W  : 0.13 A  : 187.38 V
\

setstate Strom.KG 2019-11-18 17:25:48 V3 Phase_3 : 40.53 W  : 0.22 A  : 187.78 V
\

setstate Strom.KG 2019-11-18 17:25:48 W1 Phase_1 : 21.86 W  : 0.12 A  : 186.87 V
\

setstate Strom.KG 2019-11-18 17:25:48 W2 Phase_2 : 24.03 W  : 0.13 A  : 187.38 V
\

setstate Strom.KG 2019-11-18 17:25:48 W3 Phase_3 : 40.53 W  : 0.22 A  : 187.78 V
\

setstate Strom.KG 2019-11-18 17:25:48 state A3 Phase_3 : 40.53 W  : 0.22 A  : 187.78 V


Log:
2019.11.18 17:23:44 3 : Strom: read P (\120)
2019.11.18 17:23:44 5 : Strom: Spontaneously received P (\120)
2019.11.18 17:23:44 5 : Strom: dispatch P
2019.11.18 17:23:44 5 : Strom: trying to match message P (\120)
2019.11.18 17:23:44 5 : Strom: partial message P (\120) kept
2019.11.18 17:23:44 3 : Strom: read hase_1 : 23.05 W : (\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072)
2019.11.18 17:23:44 5 : Strom: Spontaneously received hase_1 : 23.05 W : (\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072)
2019.11.18 17:23:44 5 : Strom: dispatch hase_1 : 23.05 W :
2019.11.18 17:23:44 5 : Strom: merging partial message P (\120) and hase_1 : 23.05 W : (\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072)
2019.11.18 17:23:44 5 : Strom: trying to match message Phase_1 : 23.05 W : (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072)
2019.11.18 17:23:44 5 : Strom: partial message Phase_1 : 23.05 W : (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072) kept
2019.11.18 17:23:44 3 : Strom: read 0.12 A : (\040\060\056\061\062\040\101\040\040\072)
2019.11.18 17:23:44 5 : Strom: Spontaneously received 0.12 A : (\040\060\056\061\062\040\101\040\040\072)
2019.11.18 17:23:44 5 : Strom: dispatch 0.12 A :
2019.11.18 17:23:44 5 : Strom: merging partial message Phase_1 : 23.05 W : (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072) and 0.12 A : (\040\060\056\061\062\040\101\040\040\072)
2019.11.18 17:23:44 5 : Strom: trying to match message Phase_1 : 23.05 W : 0.12 A : (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072)
2019.11.18 17:23:44 5 : Strom: partial message Phase_1 : 23.05 W : 0.12 A : (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072) kept
2019.11.18 17:23:44 3 : Strom: read 188.62 V \r\nP (\040\061\070\070\056\066\062\040\126\040\015\012\120)
2019.11.18 17:23:44 5 : Strom: Spontaneously received 188.62 V \r\nP (\040\061\070\070\056\066\062\040\126\040\015\012\120)
2019.11.18 17:23:44 5 : Strom: dispatch 188.62 V \r\nP
2019.11.18 17:23:44 5 : Strom: merging partial message Phase_1 : 23.05 W : 0.12 A : (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072) and 188.62 V \r\nP (\040\061\070\070\056\066\062\040\126\040\015\012\120)
2019.11.18 17:23:44 5 : Strom: Phase_1 : 23.05 W : 0.12 A : 188.62 V \r\nP (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\070\056\066\062\040\126\040\015\012\120) split into 2 parts
2019.11.18 17:23:44 5 : Strom: trying to match message Phase_1 : 23.05 W : 0.12 A : 188.62 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\070\056\066\062\040\126\040\015\012)
2019.11.18 17:23:44 5 : Strom: Phase_1 : 23.05 W : 0.12 A : 188.62 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\070\056\066\062\040\126\040\015\012) matches regex Phase_1 : .*\r\n for reading W1 of device Strom.KG with class Stromauslesung
2019.11.18 17:23:44 5 : Postprocessing "Phase_1 : 23.05 W : 0.12 A : 188.62 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\070\056\066\062\040\126\040\015\012)" with perl command { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$1/;;$_}.
2019.11.18 17:23:44 5 : Postprocessed value is "Phase_1 : 23.05 W : 0.12 A : 188.62 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\070\056\066\062\040\126\040\015\012)".
2019.11.18 17:23:44 5 : Strom: Phase_1 : 23.05 W : 0.12 A : 188.62 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\070\056\066\062\040\126\040\015\012) matches regex Phase_1 : .*\r\n for reading A1 of device Strom.KG with class Stromauslesung
2019.11.18 17:23:44 5 : Postprocessing "Phase_1 : 23.05 W : 0.12 A : 188.62 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\070\056\066\062\040\126\040\015\012)" with perl command { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$2/;;$_}.
2019.11.18 17:23:44 5 : Postprocessed value is "Phase_1 : 23.05 W : 0.12 A : 188.62 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\070\056\066\062\040\126\040\015\012)".
2019.11.18 17:23:44 5 : Strom: Phase_1 : 23.05 W : 0.12 A : 188.62 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\070\056\066\062\040\126\040\015\012) matches regex Phase_1 : .*\r\n for reading V1 of device Strom.KG with class Stromauslesung
2019.11.18 17:23:44 5 : Postprocessing "Phase_1 : 23.05 W : 0.12 A : 188.62 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\070\056\066\062\040\126\040\015\012)" with perl command { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$3/;;$_}.
2019.11.18 17:23:44 5 : Postprocessed value is "Phase_1 : 23.05 W : 0.12 A : 188.62 V \r\n (\120\150\141\163\145\137\061\040\072\040\062\063\056\060\065\040\127\040\040\072\040\060\056\061\062\040\101\040\040\072\040\061\070\070\056\066\062\040\126\040\015\012)".
2019.11.18 17:23:44 5 : Strom: trying to match message P (\120)
2019.11.18 17:23:44 5 : Strom: partial message P (\120) kept
2019.11.18 17:23:44 5 : Starting notify loop for Strom.KG, 6 event(s), first is W1: Phase_1 : 23.05 W : 0.12 A : 188.62 V \r\n
2019-11-18 17:23:45 ECMDDevice Strom.KG W1: Phase_1 : 23.05 W  : 0.12 A  : 188.62 V   
2019-11-18 17:23:45 ECMDDevice Strom.KG W1 Phase_1 : 23.05 W  : 0.12 A  : 188.62 V   
2019-11-18 17:23:45 ECMDDevice Strom.KG A1: Phase_1 : 23.05 W  : 0.12 A  : 188.62 V   
2019-11-18 17:23:45 ECMDDevice Strom.KG A1 Phase_1 : 23.05 W  : 0.12 A  : 188.62 V   
2019-11-18 17:23:45 ECMDDevice Strom.KG V1: Phase_1 : 23.05 W  : 0.12 A  : 188.62 V   
2019-11-18 17:23:45 ECMDDevice Strom.KG V1 Phase_1 : 23.05 W  : 0.12 A  : 188.62 V   
2019.11.18 17:23:45 5 : End notify loop for Strom.KG
2019.11.18 17:23:45 3 : Strom: read hase_2 : 24.32 W : 0.13 A : 188.92 V \r\nPhas (\150\141\163\145\137\062\040\072\040\062\064\056\063\062\040\127\040\040\072\040\060\056\061\063\040\101\040\040\072\040\061\070\070\056\071\062\040\126\040\015\012\120\150\141\163)
2019.11.18 17:23:45 5 : Strom: Spontaneously received hase_2 : 24.32 W : 0.13 A : 188.92 V \r\nPhas (\150\141\163\145\137\062\040\072\040\062\064\056\063\062\040\127\040\040\072\040\060\056\061\063\040\101\040\040\072\040\061\070\070\056\071\062\040\126\040\015\012\120\150\141\163)
2019.11.18 17:23:45 5 : Strom: dispatch hase_2 : 24.32 W : 0.13 A : 188.92 V \r\nPhas
2019.11.18 17:23:45 5 : Strom: merging partial message P (\120) and hase_2 : 24.32 W : 0.13 A : 188.92 V \r\nPhas (\150\141\163\145\137\062\040\072\040\062\064\056\063\062\040\127\040\040\072\040\060\056\061\063\040\101\040\040\072\040\061\070\070\056\071\062\040\126\040\015\012\120\150\141\163)
2019.11.18 17:23:45 5 : Strom: Phase_2 : 24.32 W : 0.13 A : 188.92 V \r\nPhas (\120\150\141\163\145\137\062\040\072\040\062\064\056\063\062\040\127\040\040\072\040\060\056\061\063\040\101\040\040\072\040\061\070\070\056\071\062\040\126\040\015\012\120\150\141\163) split into 2 parts
2019.11.18 17:23:45 5 : Strom: trying to match message Phase_2 : 24.32 W : 0.13 A : 188.92 V \r\n (\120\150\141\163\145\137\062\040\072\040\062\064\056\063\062\040\127\040\040\072\040\060\056\061\063\040\101\040\040\072\040\061\070\070\056\071\062\040\126\040\015\012)
2019.11.18 17:23:45 5 : Strom: Phase_2 : 24.32 W : 0.13 A : 188.92 V \r\n (\120\150\141\163\145\137\062\040\072\040\062\064\056\063\062\040\127\040\040\072\040\060\056\061\063\040\101\040\040\072\040\061\070\070\056\071\062\040\126\040\015\012) matches regex Phase_2 : .*\r\n for reading V2 of device Strom.KG with class Stromauslesung
2019.11.18 17:23:45 5 : Postprocessing "Phase_2 : 24.32 W : 0.13 A : 188.92 V \r\n (\120\150\141\163\145\137\062\040\072\040\062\064\056\063\062\040\127\040\040\072\040\060\056\061\063\040\101\040\040\072\040\061\070\070\056\071\062\040\126\040\015\012)" with perl command { s/Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$3/;; $_ }.
2019.11.18 17:23:45 5 : Postprocessed value is "Phase_2 : 24.32 W : 0.13 A : 188.92 V \r\n (\120\150\141\163\145\137\062\040\072\040\062\064\056\063\062\040\127\040\040\072\040\060\056\061\063\040\101\040\040\072\040\061\070\070\056\071\062\040\126\040\015\012)".
2019.11.18 17:23:45 5 : Strom: Phase_2 : 24.32 W : 0.13 A : 188.92 V \r\n (\120\150\141\163\145\137\062\040\072\040\062\064\056\063\062\040\127\040\040\072\040\060\056\061\063\040\101\040\040\072\040\061\070\070\056\071\062\040\126\040\015\012) matches regex Phase_2 : .*\r\n for reading A2 of device Strom.KG with class Stromauslesung
2019.11.18 17:23:45 5 : Postprocessing "Phase_2 : 24.32 W : 0.13 A : 188.92 V \r\n (\120\150\141\163\145\137\062\040\072\040\062\064\056\063\062\040\127\040\040\072\040\060\056\061\063\040\101\040\040\072\040\061\070\070\056\071\062\040\126\040\015\012)" with perl command { s/Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$2/;; $_ }.
2019.11.18 17:23:45 5 : Postprocessed value is "Phase_2 : 24.32 W : 0.13 A : 188.92 V \r\n (\120\150\141\163\145\137\062\040\072\040\062\064\056\063\062\040\127\040\040\072\040\060\056\061\063\040\101\040\040\072\040\061\070\070\056\071\062\040\126\040\015\012)".
2019.11.18 17:23:45 5 : Strom: Phase_2 : 24.32 W : 0.13 A : 188.92 V \r\n (\120\150\141\163\145\137\062\040\072\040\062\064\056\063\062\040\127\040\040\072\040\060\056\061\063\040\101\040\040\072\040\061\070\070\056\071\062\040\126\040\015\012) matches regex Phase_2 : .*\r\n for reading W2 of device Strom.KG with class Stromauslesung
2019.11.18 17:23:45 5 : Postprocessing "Phase_2 : 24.32 W : 0.13 A : 188.92 V \r\n (\120\150\141\163\145\137\062\040\072\040\062\064\056\063\062\040\127\040\040\072\040\060\056\061\063\040\101\040\040\072\040\061\070\070\056\071\062\040\126\040\015\012)" with perl command { s/Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$1/;; $_ }.
2019.11.18 17:23:45 5 : Postprocessed value is "Phase_2 : 24.32 W : 0.13 A : 188.92 V \r\n (\120\150\141\163\145\137\062\040\072\040\062\064\056\063\062\040\127\040\040\072\040\060\056\061\063\040\101\040\040\072\040\061\070\070\056\071\062\040\126\040\015\012)".
2019.11.18 17:23:45 5 : Strom: trying to match message Phas (\120\150\141\163)
2019.11.18 17:23:45 5 : Strom: partial message Phas (\120\150\141\163) kept
2019.11.18 17:23:45 5 : Starting notify loop for Strom.KG, 6 event(s), first is V2: Phase_2 : 24.32 W : 0.13 A : 188.92 V \r\n
2019-11-18 17:23:45 ECMDDevice Strom.KG V2: Phase_2 : 24.32 W  : 0.13 A  : 188.92 V   
2019-11-18 17:23:45 ECMDDevice Strom.KG V2 Phase_2 : 24.32 W  : 0.13 A  : 188.92 V   
2019-11-18 17:23:45 ECMDDevice Strom.KG A2: Phase_2 : 24.32 W  : 0.13 A  : 188.92 V   
2019-11-18 17:23:45 ECMDDevice Strom.KG A2 Phase_2 : 24.32 W  : 0.13 A  : 188.92 V   
2019-11-18 17:23:45 ECMDDevice Strom.KG W2: Phase_2 : 24.32 W  : 0.13 A  : 188.92 V   
2019-11-18 17:23:45 ECMDDevice Strom.KG W2 Phase_2 : 24.32 W  : 0.13 A  : 188.92 V   
2019.11.18 17:23:45 5 : End notify loop for Strom.KG
2019.11.18 17:23:45 3 : Strom: read e_3 : 40.45 W : 0.21 A : 189.10 V \r\n (\145\137\063\040\072\040\064\060\056\064\065\040\127\040\040\072\040\060\056\062\061\040\101\040\040\072\040\061\070\071\056\061\060\040\126\040\015\012)
2019.11.18 17:23:45 5 : Strom: Spontaneously received e_3 : 40.45 W : 0.21 A : 189.10 V \r\n (\145\137\063\040\072\040\064\060\056\064\065\040\127\040\040\072\040\060\056\062\061\040\101\040\040\072\040\061\070\071\056\061\060\040\126\040\015\012)
2019.11.18 17:23:45 5 : Strom: dispatch e_3 : 40.45 W : 0.21 A : 189.10 V \r\n
2019.11.18 17:23:45 5 : Strom: merging partial message Phas (\120\150\141\163) and e_3 : 40.45 W : 0.21 A : 189.10 V \r\n (\145\137\063\040\072\040\064\060\056\064\065\040\127\040\040\072\040\060\056\062\061\040\101\040\040\072\040\061\070\071\056\061\060\040\126\040\015\012)
2019.11.18 17:23:45 5 : Strom: trying to match message Phase_3 : 40.45 W : 0.21 A : 189.10 V \r\n (\120\150\141\163\145\137\063\040\072\040\064\060\056\064\065\040\127\040\040\072\040\060\056\062\061\040\101\040\040\072\040\061\070\071\056\061\060\040\126\040\015\012)
2019.11.18 17:23:45 5 : Strom: Phase_3 : 40.45 W : 0.21 A : 189.10 V \r\n (\120\150\141\163\145\137\063\040\072\040\064\060\056\064\065\040\127\040\040\072\040\060\056\062\061\040\101\040\040\072\040\061\070\071\056\061\060\040\126\040\015\012) matches regex Phase_3 : .*\r\n for reading W3 of device Strom.KG with class Stromauslesung
2019.11.18 17:23:45 5 : Postprocessing "Phase_3 : 40.45 W : 0.21 A : 189.10 V \r\n (\120\150\141\163\145\137\063\040\072\040\064\060\056\064\065\040\127\040\040\072\040\060\056\062\061\040\101\040\040\072\040\061\070\071\056\061\060\040\126\040\015\012)" with perl command { s/Phase_3 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$1/;; $_ }.
2019.11.18 17:23:45 5 : Postprocessed value is "Phase_3 : 40.45 W : 0.21 A : 189.10 V \r\n (\120\150\141\163\145\137\063\040\072\040\064\060\056\064\065\040\127\040\040\072\040\060\056\062\061\040\101\040\040\072\040\061\070\071\056\061\060\040\126\040\015\012)".
2019.11.18 17:23:45 5 : Strom: Phase_3 : 40.45 W : 0.21 A : 189.10 V \r\n (\120\150\141\163\145\137\063\040\072\040\064\060\056\064\065\040\127\040\040\072\040\060\056\062\061\040\101\040\040\072\040\061\070\071\056\061\060\040\126\040\015\012) matches regex Phase_3 : .*\r\n for reading V3 of device Strom.KG with class Stromauslesung
2019.11.18 17:23:45 5 : Postprocessing "Phase_3 : 40.45 W : 0.21 A : 189.10 V \r\n (\120\150\141\163\145\137\063\040\072\040\064\060\056\064\065\040\127\040\040\072\040\060\056\062\061\040\101\040\040\072\040\061\070\071\056\061\060\040\126\040\015\012)" with perl command { s/Phase_3 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$3/;; $_ }.
2019.11.18 17:23:45 5 : Postprocessed value is "Phase_3 : 40.45 W : 0.21 A : 189.10 V \r\n (\120\150\141\163\145\137\063\040\072\040\064\060\056\064\065\040\127\040\040\072\040\060\056\062\061\040\101\040\040\072\040\061\070\071\056\061\060\040\126\040\015\012)".
2019.11.18 17:23:45 5 : Strom: Phase_3 : 40.45 W : 0.21 A : 189.10 V \r\n (\120\150\141\163\145\137\063\040\072\040\064\060\056\064\065\040\127\040\040\072\040\060\056\062\061\040\101\040\040\072\040\061\070\071\056\061\060\040\126\040\015\012) matches regex Phase_3 : .*\r\n for reading A3 of device Strom.KG with class Stromauslesung
2019.11.18 17:23:45 5 : Postprocessing "Phase_3 : 40.45 W : 0.21 A : 189.10 V \r\n (\120\150\141\163\145\137\063\040\072\040\064\060\056\064\065\040\127\040\040\072\040\060\056\062\061\040\101\040\040\072\040\061\070\071\056\061\060\040\126\040\015\012)" with perl command { s/Phase_3 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$2/;; $_ }.
2019.11.18 17:23:45 5 : Postprocessed value is "Phase_3 : 40.45 W : 0.21 A : 189.10 V \r\n (\120\150\141\163\145\137\063\040\072\040\064\060\056\064\065\040\127\040\040\072\040\060\056\062\061\040\101\040\040\072\040\061\070\071\056\061\060\040\126\040\015\012)".
2019.11.18 17:23:45 5 : Starting notify loop for Strom.KG, 6 event(s), first is W3: Phase_3 : 40.45 W : 0.21 A : 189.10 V \r\n
2019-11-18 17:23:45 ECMDDevice Strom.KG W3: Phase_3 : 40.45 W  : 0.21 A  : 189.10 V   
2019-11-18 17:23:45 ECMDDevice Strom.KG W3 Phase_3 : 40.45 W  : 0.21 A  : 189.10 V   
2019-11-18 17:23:45 ECMDDevice Strom.KG V3: Phase_3 : 40.45 W  : 0.21 A  : 189.10 V   
2019-11-18 17:23:45 ECMDDevice Strom.KG V3 Phase_3 : 40.45 W  : 0.21 A  : 189.10 V   
2019-11-18 17:23:45 ECMDDevice Strom.KG A3: Phase_3 : 40.45 W  : 0.21 A  : 189.10 V   
2019-11-18 17:23:45 ECMDDevice Strom.KG A3 Phase_3 : 40.45 W  : 0.21 A  : 189.10 V   
2019.11.18 17:23:45 5 : End notify loop for Strom.KG


mfg maik

Dr. Boris Neubert

Das Pattern matcht nicht. Es sieht so aus, als seien im Rückgabewert doppelte Leerzeichen, die nicht im Pattern sind. Bitte analysiere den Rückgabewert auf die Anzahl Leerzeichen und passe das Pattern im postproc darauf an.
Globaler Moderator, Developer, aktives Mitglied des FHEM e.V. (Marketing, Verwaltung)
Bitte keine unaufgeforderten privaten Nachrichten!

TiPpFeHlEr

Zitat von: Dr. Boris Neubert am 20 November 2019, 19:59:28
Das Pattern matcht nicht. Es sieht so aus, als seien im Rückgabewert doppelte Leerzeichen, die nicht im Pattern sind. Bitte analysiere den Rückgabewert auf die Anzahl Leerzeichen und passe das Pattern im postproc darauf an.

Das hatte ich auch schon gesehen, und hatte das postproc, wie man oben sieht, auf gestellt.
hier sind immer 2 Leerzeichen hinter dem W & A
reading W1 postproc { s/Phase_1 : (\d+\.d+) W  : (\d+\.d+) A  : (\d+\.d+) V \r\n/$1/;;$_}

Ich habe nun einfach den Arduino Code geändert und das doppelte Leerzeichen entfernt.
mit dem gleichen Ergebnis.

log
2019.11.22 08:27:40 3 : Strom: read P (\120)
2019.11.22 08:27:40 5 : Strom: Spontaneously received P (\120)
2019.11.22 08:27:40 5 : Strom: dispatch P
2019.11.22 08:27:40 5 : Strom: trying to match message P (\120)
2019.11.22 08:27:40 5 : Strom: partial message P (\120) kept
2019.11.22 08:27:40 3 : Strom: read hase_1 : 30 (\150\141\163\145\137\061\040\072\040\063\060)
2019.11.22 08:27:40 5 : Strom: Spontaneously received hase_1 : 30 (\150\141\163\145\137\061\040\072\040\063\060)
2019.11.22 08:27:40 5 : Strom: dispatch hase_1 : 30
2019.11.22 08:27:40 5 : Strom: merging partial message P (\120) and hase_1 : 30 (\150\141\163\145\137\061\040\072\040\063\060)
2019.11.22 08:27:40 5 : Strom: trying to match message Phase_1 : 30 (\120\150\141\163\145\137\061\040\072\040\063\060)
2019.11.22 08:27:40 5 : Strom: partial message Phase_1 : 30 (\120\150\141\163\145\137\061\040\072\040\063\060) kept
2019.11.22 08:27:40 3 : Strom: read .71 W : 0.11 (\056\067\061\040\127\040\072\040\060\056\061\061\040)
2019.11.22 08:27:40 5 : Strom: Spontaneously received .71 W : 0.11 (\056\067\061\040\127\040\072\040\060\056\061\061\040)
2019.11.22 08:27:40 5 : Strom: dispatch .71 W : 0.11
2019.11.22 08:27:40 5 : Strom: merging partial message Phase_1 : 30 (\120\150\141\163\145\137\061\040\072\040\063\060) and .71 W : 0.11 (\056\067\061\040\127\040\072\040\060\056\061\061\040)
2019.11.22 08:27:40 5 : Strom: trying to match message Phase_1 : 30.71 W : 0.11 (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040)
2019.11.22 08:27:40 5 : Strom: partial message Phase_1 : 30.71 W : 0.11 (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040) kept
2019.11.22 08:27:40 3 : Strom: read A : 270.41 V (\101\040\072\040\062\067\060\056\064\061\040\126\040)
2019.11.22 08:27:40 5 : Strom: Spontaneously received A : 270.41 V (\101\040\072\040\062\067\060\056\064\061\040\126\040)
2019.11.22 08:27:40 5 : Strom: dispatch A : 270.41 V
2019.11.22 08:27:40 5 : Strom: merging partial message Phase_1 : 30.71 W : 0.11 (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040) and A : 270.41 V (\101\040\072\040\062\067\060\056\064\061\040\126\040)
2019.11.22 08:27:40 5 : Strom: trying to match message Phase_1 : 30.71 W : 0.11 A : 270.41 V (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040\101\040\072\040\062\067\060\056\064\061\040\126\040)
2019.11.22 08:27:40 5 : Strom: partial message Phase_1 : 30.71 W : 0.11 A : 270.41 V (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040\101\040\072\040\062\067\060\056\064\061\040\126\040) kept
2019.11.22 08:27:40 3 : Strom: read \r\nPhase_2 : (\015\012\120\150\141\163\145\137\062\040\072\040)
2019.11.22 08:27:40 5 : Strom: Spontaneously received \r\nPhase_2 : (\015\012\120\150\141\163\145\137\062\040\072\040)
2019.11.22 08:27:40 5 : Strom: dispatch \r\nPhase_2 :
2019.11.22 08:27:40 5 : Strom: merging partial message Phase_1 : 30.71 W : 0.11 A : 270.41 V (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040\101\040\072\040\062\067\060\056\064\061\040\126\040) and \r\nPhase_2 : (\015\012\120\150\141\163\145\137\062\040\072\040)
2019.11.22 08:27:40 5 : Strom: Phase_1 : 30.71 W : 0.11 A : 270.41 V \r\nPhase_2 : (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040\101\040\072\040\062\067\060\056\064\061\040\126\040\015\012\120\150\141\163\145\137\062\040\072\040) split into 2 parts
2019.11.22 08:27:40 5 : Strom: trying to match message Phase_1 : 30.71 W : 0.11 A : 270.41 V \r\n (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040\101\040\072\040\062\067\060\056\064\061\040\126\040\015\012)
2019.11.22 08:27:40 5 : Strom: Phase_1 : 30.71 W : 0.11 A : 270.41 V \r\n (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040\101\040\072\040\062\067\060\056\064\061\040\126\040\015\012) matches regex Phase_1 : .*\r\n for reading A1 of device Strom.KG with class Stromauslesung
2019.11.22 08:27:40 5 : Postprocessing "Phase_1 : 30.71 W : 0.11 A : 270.41 V \r\n (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040\101\040\072\040\062\067\060\056\064\061\040\126\040\015\012)" with perl command { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$2/;;$_}.
2019.11.22 08:27:40 5 : Postprocessed value is "Phase_1 : 30.71 W : 0.11 A : 270.41 V \r\n (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040\101\040\072\040\062\067\060\056\064\061\040\126\040\015\012)".
2019.11.22 08:27:40 5 : Strom: Phase_1 : 30.71 W : 0.11 A : 270.41 V \r\n (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040\101\040\072\040\062\067\060\056\064\061\040\126\040\015\012) matches regex Phase_1 : .*\r\n for reading W1 of device Strom.KG with class Stromauslesung
2019.11.22 08:27:40 5 : Postprocessing "Phase_1 : 30.71 W : 0.11 A : 270.41 V \r\n (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040\101\040\072\040\062\067\060\056\064\061\040\126\040\015\012)" with perl command { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$1/;;$_}.
2019.11.22 08:27:40 5 : Postprocessed value is "Phase_1 : 30.71 W : 0.11 A : 270.41 V \r\n (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040\101\040\072\040\062\067\060\056\064\061\040\126\040\015\012)".
2019.11.22 08:27:40 5 : Strom: Phase_1 : 30.71 W : 0.11 A : 270.41 V \r\n (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040\101\040\072\040\062\067\060\056\064\061\040\126\040\015\012) matches regex Phase_1 : .*\r\n for reading V1 of device Strom.KG with class Stromauslesung
2019.11.22 08:27:40 5 : Postprocessing "Phase_1 : 30.71 W : 0.11 A : 270.41 V \r\n (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040\101\040\072\040\062\067\060\056\064\061\040\126\040\015\012)" with perl command { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$3/;;$_}.
2019.11.22 08:27:40 5 : Postprocessed value is "Phase_1 : 30.71 W : 0.11 A : 270.41 V \r\n (\120\150\141\163\145\137\061\040\072\040\063\060\056\067\061\040\127\040\072\040\060\056\061\061\040\101\040\072\040\062\067\060\056\064\061\040\126\040\015\012)".
2019.11.22 08:27:40 5 : Strom: trying to match message Phase_2 : (\120\150\141\163\145\137\062\040\072\040)
2019.11.22 08:27:40 5 : Strom: partial message Phase_2 : (\120\150\141\163\145\137\062\040\072\040) kept
2019.11.22 08:27:40 5 : Starting notify loop for Strom.KG, 6 event(s), first is A1: Phase_1 : 30.71 W : 0.11 A : 270.41 V \r\n
2019-11-22 08:27:40 ECMDDevice Strom.KG A1: Phase_1 : 30.71 W : 0.11 A : 270.41 V
2019-11-22 08:27:40 ECMDDevice Strom.KG A1 Phase_1 : 30.71 W : 0.11 A : 270.41 V
2019-11-22 08:27:40 ECMDDevice Strom.KG W1: Phase_1 : 30.71 W : 0.11 A : 270.41 V
2019-11-22 08:27:40 ECMDDevice Strom.KG W1 Phase_1 : 30.71 W : 0.11 A : 270.41 V
2019-11-22 08:27:40 ECMDDevice Strom.KG V1: Phase_1 : 30.71 W : 0.11 A : 270.41 V
2019-11-22 08:27:40 ECMDDevice Strom.KG V1 Phase_1 : 30.71 W : 0.11 A : 270.41 V
2019.11.22 08:27:40 5 : End notify loop for Strom.KG
2019.11.22 08:27:40 3 : Strom: read 34.41 W : 0.13 A : 270.63 (\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040)
2019.11.22 08:27:40 5 : Strom: Spontaneously received 34.41 W : 0.13 A : 270.63 (\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040)
2019.11.22 08:27:40 5 : Strom: dispatch 34.41 W : 0.13 A : 270.63
2019.11.22 08:27:40 5 : Strom: merging partial message Phase_2 : (\120\150\141\163\145\137\062\040\072\040) and 34.41 W : 0.13 A : 270.63 (\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040)
2019.11.22 08:27:40 5 : Strom: trying to match message Phase_2 : 34.41 W : 0.13 A : 270.63 (\120\150\141\163\145\137\062\040\072\040\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040)
2019.11.22 08:27:40 5 : Strom: partial message Phase_2 : 34.41 W : 0.13 A : 270.63 (\120\150\141\163\145\137\062\040\072\040\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040) kept
2019.11.22 08:27:40 3 : Strom: read V \r\nPh (\126\040\015\012\120\150)
2019.11.22 08:27:40 5 : Strom: Spontaneously received V \r\nPh (\126\040\015\012\120\150)
2019.11.22 08:27:40 5 : Strom: dispatch V \r\nPh
2019.11.22 08:27:40 5 : Strom: merging partial message Phase_2 : 34.41 W : 0.13 A : 270.63 (\120\150\141\163\145\137\062\040\072\040\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040) and V \r\nPh (\126\040\015\012\120\150)
2019.11.22 08:27:40 5 : Strom: Phase_2 : 34.41 W : 0.13 A : 270.63 V \r\nPh (\120\150\141\163\145\137\062\040\072\040\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040\126\040\015\012\120\150) split into 2 parts
2019.11.22 08:27:40 5 : Strom: trying to match message Phase_2 : 34.41 W : 0.13 A : 270.63 V \r\n (\120\150\141\163\145\137\062\040\072\040\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040\126\040\015\012)
2019.11.22 08:27:40 5 : Strom: Phase_2 : 34.41 W : 0.13 A : 270.63 V \r\n (\120\150\141\163\145\137\062\040\072\040\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040\126\040\015\012) matches regex Phase_2 : .*\r\n for reading W2 of device Strom.KG with class Stromauslesung
2019.11.22 08:27:40 5 : Postprocessing "Phase_2 : 34.41 W : 0.13 A : 270.63 V \r\n (\120\150\141\163\145\137\062\040\072\040\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040\126\040\015\012)" with perl command { s/Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$1/;; $_ }.
2019.11.22 08:27:40 5 : Postprocessed value is "Phase_2 : 34.41 W : 0.13 A : 270.63 V \r\n (\120\150\141\163\145\137\062\040\072\040\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040\126\040\015\012)".
2019.11.22 08:27:40 5 : Strom: Phase_2 : 34.41 W : 0.13 A : 270.63 V \r\n (\120\150\141\163\145\137\062\040\072\040\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040\126\040\015\012) matches regex Phase_2 : .*\r\n for reading V2 of device Strom.KG with class Stromauslesung
2019.11.22 08:27:40 5 : Postprocessing "Phase_2 : 34.41 W : 0.13 A : 270.63 V \r\n (\120\150\141\163\145\137\062\040\072\040\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040\126\040\015\012)" with perl command { s/Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$3/;; $_ }.
2019.11.22 08:27:40 5 : Postprocessed value is "Phase_2 : 34.41 W : 0.13 A : 270.63 V \r\n (\120\150\141\163\145\137\062\040\072\040\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040\126\040\015\012)".
2019.11.22 08:27:40 5 : Strom: Phase_2 : 34.41 W : 0.13 A : 270.63 V \r\n (\120\150\141\163\145\137\062\040\072\040\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040\126\040\015\012) matches regex Phase_2 : .*\r\n for reading A2 of device Strom.KG with class Stromauslesung
2019.11.22 08:27:40 5 : Postprocessing "Phase_2 : 34.41 W : 0.13 A : 270.63 V \r\n (\120\150\141\163\145\137\062\040\072\040\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040\126\040\015\012)" with perl command { s/Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$2/;; $_ }.
2019.11.22 08:27:40 5 : Postprocessed value is "Phase_2 : 34.41 W : 0.13 A : 270.63 V \r\n (\120\150\141\163\145\137\062\040\072\040\063\064\056\064\061\040\127\040\072\040\060\056\061\063\040\101\040\072\040\062\067\060\056\066\063\040\126\040\015\012)".
2019.11.22 08:27:40 5 : Strom: trying to match message Ph (\120\150)
2019.11.22 08:27:40 5 : Strom: partial message Ph (\120\150) kept
2019.11.22 08:27:40 5 : Starting notify loop for Strom.KG, 6 event(s), first is W2: Phase_2 : 34.41 W : 0.13 A : 270.63 V \r\n
2019-11-22 08:27:40 ECMDDevice Strom.KG W2: Phase_2 : 34.41 W : 0.13 A : 270.63 V
2019-11-22 08:27:40 ECMDDevice Strom.KG W2 Phase_2 : 34.41 W : 0.13 A : 270.63 V
2019-11-22 08:27:40 ECMDDevice Strom.KG V2: Phase_2 : 34.41 W : 0.13 A : 270.63 V
2019-11-22 08:27:40 ECMDDevice Strom.KG V2 Phase_2 : 34.41 W : 0.13 A : 270.63 V
2019-11-22 08:27:40 ECMDDevice Strom.KG A2: Phase_2 : 34.41 W : 0.13 A : 270.63 V
2019-11-22 08:27:40 ECMDDevice Strom.KG A2 Phase_2 : 34.41 W : 0.13 A : 270.63 V
2019.11.22 08:27:40 5 : End notify loop for Strom.KG
2019.11.22 08:27:40 3 : Strom: read ase_3 : 60.97 W : 0.22 A : (\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040)
2019.11.22 08:27:40 5 : Strom: Spontaneously received ase_3 : 60.97 W : 0.22 A : (\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040)
2019.11.22 08:27:40 5 : Strom: dispatch ase_3 : 60.97 W : 0.22 A :
2019.11.22 08:27:40 5 : Strom: merging partial message Ph (\120\150) and ase_3 : 60.97 W : 0.22 A : (\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040)
2019.11.22 08:27:40 5 : Strom: trying to match message Phase_3 : 60.97 W : 0.22 A : (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040)
2019.11.22 08:27:40 5 : Strom: partial message Phase_3 : 60.97 W : 0.22 A : (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040) kept
2019.11.22 08:27:40 3 : Strom: read 272.12 (\062\067\062\056\061\062\040)
2019.11.22 08:27:40 5 : Strom: Spontaneously received 272.12 (\062\067\062\056\061\062\040)
2019.11.22 08:27:40 5 : Strom: dispatch 272.12
2019.11.22 08:27:40 5 : Strom: merging partial message Phase_3 : 60.97 W : 0.22 A : (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040) and 272.12 (\062\067\062\056\061\062\040)
2019.11.22 08:27:40 5 : Strom: trying to match message Phase_3 : 60.97 W : 0.22 A : 272.12 (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040\062\067\062\056\061\062\040)
2019.11.22 08:27:40 5 : Strom: partial message Phase_3 : 60.97 W : 0.22 A : 272.12 (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040\062\067\062\056\061\062\040) kept
2019.11.22 08:27:40 3 : Strom: read V \r\n (\126\040\015\012)
2019.11.22 08:27:40 5 : Strom: Spontaneously received V \r\n (\126\040\015\012)
2019.11.22 08:27:40 5 : Strom: dispatch V \r\n
2019.11.22 08:27:40 5 : Strom: merging partial message Phase_3 : 60.97 W : 0.22 A : 272.12 (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040\062\067\062\056\061\062\040) and V \r\n (\126\040\015\012)
2019.11.22 08:27:40 5 : Strom: trying to match message Phase_3 : 60.97 W : 0.22 A : 272.12 V \r\n (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040\062\067\062\056\061\062\040\126\040\015\012)
2019.11.22 08:27:40 5 : Strom: Phase_3 : 60.97 W : 0.22 A : 272.12 V \r\n (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040\062\067\062\056\061\062\040\126\040\015\012) matches regex Phase_3 : .*\r\n for reading V3 of device Strom.KG with class Stromauslesung
2019.11.22 08:27:40 5 : Postprocessing "Phase_3 : 60.97 W : 0.22 A : 272.12 V \r\n (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040\062\067\062\056\061\062\040\126\040\015\012)" with perl command { s/Phase_3 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$3/; $_ }.
2019.11.22 08:27:40 5 : Postprocessed value is "Phase_3 : 60.97 W : 0.22 A : 272.12 V \r\n (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040\062\067\062\056\061\062\040\126\040\015\012)".
2019.11.22 08:27:40 5 : Strom: Phase_3 : 60.97 W : 0.22 A : 272.12 V \r\n (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040\062\067\062\056\061\062\040\126\040\015\012) matches regex Phase_3 : .*\r\n for reading W3 of device Strom.KG with class Stromauslesung
2019.11.22 08:27:40 5 : Postprocessing "Phase_3 : 60.97 W : 0.22 A : 272.12 V \r\n (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040\062\067\062\056\061\062\040\126\040\015\012)" with perl command { s/Phase_3 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$1/; $_ }.
2019.11.22 08:27:40 5 : Postprocessed value is "Phase_3 : 60.97 W : 0.22 A : 272.12 V \r\n (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040\062\067\062\056\061\062\040\126\040\015\012)".
2019.11.22 08:27:40 5 : Strom: Phase_3 : 60.97 W : 0.22 A : 272.12 V \r\n (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040\062\067\062\056\061\062\040\126\040\015\012) matches regex Phase_3 : .*\r\n for reading A3 of device Strom.KG with class Stromauslesung
2019.11.22 08:27:40 5 : Postprocessing "Phase_3 : 60.97 W : 0.22 A : 272.12 V \r\n (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040\062\067\062\056\061\062\040\126\040\015\012)" with perl command { s/Phase_3 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$2/; $_ }.
2019.11.22 08:27:40 5 : Postprocessed value is "Phase_3 : 60.97 W : 0.22 A : 272.12 V \r\n (\120\150\141\163\145\137\063\040\072\040\066\060\056\071\067\040\127\040\072\040\060\056\062\062\040\101\040\072\040\062\067\062\056\061\062\040\126\040\015\012)".
2019.11.22 08:27:40 5 : Starting notify loop for Strom.KG, 6 event(s), first is V3: Phase_3 : 60.97 W : 0.22 A : 272.12 V \r\n
2019-11-22 08:27:40 ECMDDevice Strom.KG V3: Phase_3 : 60.97 W : 0.22 A : 272.12 V
2019-11-22 08:27:40 ECMDDevice Strom.KG V3 Phase_3 : 60.97 W : 0.22 A : 272.12 V
2019-11-22 08:27:40 ECMDDevice Strom.KG W3: Phase_3 : 60.97 W : 0.22 A : 272.12 V
2019-11-22 08:27:40 ECMDDevice Strom.KG W3 Phase_3 : 60.97 W : 0.22 A : 272.12 V
2019-11-22 08:27:40 ECMDDevice Strom.KG A3: Phase_3 : 60.97 W : 0.22 A : 272.12 V
2019-11-22 08:27:40 ECMDDevice Strom.KG A3 Phase_3 : 60.97 W : 0.22 A : 272.12 V
2019.11.22 08:27:40 5 : End notify loop for Strom.KG


classdef
reading W1 match "Phase_1 : .*\r\n"
reading W1 postproc { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$1/;;$_}
reading A1 match "Phase_1 : .*\r\n"
reading A1 postproc { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$2/;;$_}
reading V1 match "Phase_1 : .*\r\n"
reading V1 postproc { s/Phase_1 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$3/;;$_}

reading W2 match "Phase_2 : .*\r\n"
reading W2 postproc { s/Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$1/;; $_ }
reading A2 match "Phase_2 : .*\r\n"
reading A2 postproc { s/Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$2/;; $_ }
reading V2 match "Phase_2 : .*\r\n"
reading V2 postproc { s/Phase_2 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$3/;; $_ }

reading W3 match "Phase_3 : .*\r\n"
reading W3 postproc { s/Phase_3 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$1/;; $_ }
reading A3 match "Phase_3 : .*\r\n"
reading A3 postproc { s/Phase_3 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$2/;; $_ }
reading V3 match "Phase_3 : .*\r\n"
reading V3 postproc { s/Phase_3 : (\d+\.d+) W : (\d+\.d+) A : (\d+\.d+) V \r\n/$3/;; $_ }


MfG Maik

TiPpFeHlEr

#11
Hallo,

ich habe den Fehler gefunden.
es ist der Punkt im Wert!

geht nicht
(\d+\.d+)

geht
((\d+).(\d+))

geht auch
(\d+.\d+)

der Backslash im ersten ist an der falschen Position?

mfg maik

Dr. Boris Neubert

Hallo Maik,

der Punkt in einem regulären Ausdruck matcht jedes Zeichen. Es ist daher klar, dass

(\d+.\d+)

funktioniert. Wenn ich einen Punkt matchen will, muss ich den Punkt im regulären Ausdruck maskieren mit einem Backslash:

(\d+\.\d+)

Allerdings fällt mir gerade auf, dass vor dem d, das eine Ziffer matchen soll, in meiner Vorgabe der Backslash fehlte  :-[

Ich sollte abends keine regulären Ausdrücke mehr tippen, wenn ich müde bin und nicht mehr aus den Augen gucken kann.  ::)

Also, richtig ist:

(\d+\.\d+)

Viele Grüße
Boris
Globaler Moderator, Developer, aktives Mitglied des FHEM e.V. (Marketing, Verwaltung)
Bitte keine unaufgeforderten privaten Nachrichten!

TiPpFeHlEr

Hi Boris,,

ZitatIch sollte abends keine regulären Ausdrücke mehr tippen, wenn ich müde bin und nicht mehr aus den Augen gucken kann.  ::)
nich so schlimm  ;D

(\d+\.\d+)
werde ich natürlich übernehmen
ist aber das gleiche wie
((\d+).(\d+))
oder?

mfg maik


Dr. Boris Neubert

Ein Ausdruck in Klammern ist eine Capturing Group. Dafür wird dann eine Variable gefüllt. Wie $1 $2 $3 erhältst Du dann weitere. Das ist überflüssig. Der Match bleibt aber derselbe.
Globaler Moderator, Developer, aktives Mitglied des FHEM e.V. (Marketing, Verwaltung)
Bitte keine unaufgeforderten privaten Nachrichten!