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?
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.
danke für den hinweis, muss man auch erstmal drauf kommen ;)
danke!
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! ;)
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:.* {...}
thnx, das gute liegt oft so nah...