FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: fl_Indigo am 10 Januar 2017, 10:30:47

Titel: GELÖST: errors im LOG obwohl
Beitrag von: fl_Indigo am 10 Januar 2017, 10:30:47
folgendes notify

define copy_Stromzaehler_kWh_consumed_thismonth notify Stromzaehler:statElectricityConsumed.* {fhem("setreading Stromzaehler statElectricityConsumedThisMonth $EVTPART6")}


erzeugt folgenden logeintrag

2017.01.10 00:00:47 1: ERROR evaluating my $EVTPART0='statElectricityConsumedToday:';my $TYPE='JSONMETER';my $SELF='copy_Stromzaehler_kWh_consumed_thismonth';my $NAME='Stromzaehler';my $EVENT='statElectricityConsumedToday: 0';my $EVTPART1='0';{fhem("setreading Stromzaehler statElectricityConsumedThisMonth $EVTPART6")}: Global symbol "$EVTPART6" requires explicit package name (did you forget to declare "my $EVTPART6"?) at (eval 108977) line 1.
2017.01.10 00:00:47 3: copy_Stromzaehler_kWh_consumed_thismonth return value: Global symbol "$EVTPART6" requires explicit package name (did you forget to declare "my $EVTPART6"?) at (eval 108977) line 1.
2017.01.10 00:00:47 1: ERROR evaluating my $EVTPART1='417030';my $EVENT='statElectricityConsumedLastMonth: 417030';my $NAME='Stromzaehler';my $SELF='copy_Stromzaehler_kWh_consumed_thismonth';my $TYPE='JSONMETER';my $EVTPART0='statElectricityConsumedLastMonth:';{fhem("setreading Stromzaehler statElectricityConsumedThisMonth $EVTPART6")}: Global symbol "$EVTPART6" requires explicit package name (did you forget to declare "my $EVTPART6"?) at (eval 108985) line 1.
2017.01.10 00:00:47 3: copy_Stromzaehler_kWh_consumed_thismonth return value: Global symbol "$EVTPART6" requires explicit package name (did you forget to declare "my $EVTPART6"?) at (eval 108985) line 1.


das notify funktioniert aber tadellos, woran kann das liegen?
Titel: Antw:errors im LOG obwohl
Beitrag von: dev0 am 10 Januar 2017, 10:39:17
Ursache: Das Notify wird auch durch Events getriggert, die kein $EVTPART6 enthalten.

Du könntest:
- Regex enger fassen, dass nur die passenden Events das Notify triggern.
- $EVENT selbst splitten und entsprechend verarbeiten.
- Verbose level anpassen, damit nicht gelogged wird.
- Mit dem Logeintrag leben.
Titel: Antw:errors im LOG obwohl
Beitrag von: fl_Indigo am 10 Januar 2017, 11:07:17
danke für den hinweis, muss man auch erstmal drauf kommen ;)

danke!
Titel: Antw:GELÖST: errors im LOG obwohl
Beitrag von: fl_Indigo am 23 Januar 2017, 10:39:43
ich muss an dieser stelle nochmal nachhaken:

es gibt im device Stromzaehler zwei readings auf die das notify im ersten post reagiert:


statElectricityConsumed
statElectricityConsumedLast


wie bekomme ich das notify dazu NUR auf das erste reading zu triggern?

wenn ich das notify wie folgt umdefiniere:

define copy_Stromzaehler_kWh_consumed_thismonth notify Stromzaehler:statElectricityConsumed {fhem("setreading Stromzaehler statElectricityConsumedThisMonth $EVTPART6")}

funktionierts mal nicht

und für den fall das die frage kommt: JA, das reading ändert sich regelmäßig! ;)
Titel: Antw:GELÖST: errors im LOG obwohl
Beitrag von: dev0 am 23 Januar 2017, 12:56:11
Zitat
If <trigger> is given, then all processing for this specific user reading is only done if one of the just updated "reading: value" combinations matches <trigger>, which is treated as a regexp.


define copy_Stromzaehler_kWh_consumed_thismonth notify Stromzaehler:statElectricityConsumed:.* {...}
Titel: Antw:GELÖST: errors im LOG obwohl
Beitrag von: fl_Indigo am 23 Januar 2017, 13:09:29
thnx, das gute liegt oft so nah...