Hallo zusammen,
mein LOG file wird gerade mit:
2018.12.25 10:10:06.864 1: PERL WARNING: Invalid conversion in sprintf: "% /" at (eval 104941) line 1.
2018.12.25 10:10:06.872 1: PERL WARNING: Invalid conversion in sprintf: "% /" at (eval 104942) line 1.
2018.12.25 10:10:06.881 1: PERL WARNING: Invalid conversion in sprintf: "% /" at (eval 104943) line 1.
2018.12.25 10:10:06.891 1: PERL WARNING: Invalid conversion in sprintf: "% /" at (eval 104944) line 1.
2018.12.25 10:10:16.099 1: PERL WARNING: Invalid conversion in sprintf: "% /" at (eval 104966) line 1.
2018.12.25 10:10:16.108 1: PERL WARNING: Invalid conversion in sprintf: "% /" at (eval 104967) line 1.
2018.12.25 10:10:16.118 1: PERL WARNING: Invalid conversion in sprintf: "% /" at (eval 104968) line 1.
2018.12.25 10:10:16.128 1: PERL WARNING: Invalid conversion in sprintf: "% /" at (eval 104969) line 1.
geflutet, wie kommt man so einem Fehler auf die Spur ?
Danke
Scheint ein notify oder userReadings zu sein. Wenn Du im global Device stacktrace aktivierst solltest du mehr sehen.
Danke für den Tip, leider komme ich damit nicht weiter.
Die Stelle bei der es scheinbar ein Problem mit dem sprintf gibt habe ich ersetzt, aber es kommt noch immer zur Fehlermeldung obwohl im stack trace kein sprintf ausgeführt wird.
2018.12.30 22:53:39.181 4: DbLog pwr_month_dblog1 -> number of events received: 1 for device: dHeizLeistung
2018.12.30 22:53:39.181 4: DbLog pwr_month_dblog1 -> check Device: dHeizLeistung , Event: heating-performance-percent: 5.7842444196969
2018.12.30 22:53:39.182 5: End notify loop for dHeizLeistung
2018.12.30 22:53:39.183 5: Cmd: >setreading dHeizLeistung heating-state off<
2018.12.30 22:53:39.184 1: PERL WARNING: Invalid conversion in sprintf: "% /" at (eval 1251) line 3.
2018.12.30 22:53:39.184 3: eval: my $SELF='n_heizleistung';my $EVTPART0='ValvePosition:';my $NAME='KU_Thermostat_Clima';my $EVTPART1='0';my $TYPE='CUL_HM';my $EVENT='ValvePosition: 0';{
my @climates = devspec2array("NAME=.*_Clima:FILTER=TYPE=CUL_HM");
my $totalPower = 0;
my $heatingPerformance = 0;
my $heatingPerformancePercent = 0;
foreach (@climates) {
my $power = AttrNum($_, "ht_power", -1);
my $valvePosition = ReadingsNum($_, "ValvePosition", 0);
if ($power> -1 ) {
$totalPower += $power;
if ($valvePosition > 0) {
$heatingPerformance += $power * ($valvePosition / 100);
}
}
}
$heatingPerformancePercent = $heatingPerformance / $totalPower * 100;
fhem("setreading dHeizLeistung total-power " . $totalPower);
fhem("setreading dHeizLeistung heating-performance " . $heatingPerformance);
[color=red]##
##fhem("setreading dHeizLeistung heating-performance-percent " . sprintf("%.2f", $heatingPerformancePercent));[/color]
fhem("setreading dHeizLeistung heating-performance-percent " . $heatingPerformancePercent);
## get % limit from dummy device
my $HeatingLimit = ReadingsNum("dHeizLeistung", "heating-limit", 0);
if ($heatingPerformancePercent > $HeatingLimit)
{
fhem("setreading dHeizLeistung heating-state on;set KHZ_SchalterSonoff_HZSchalter on");
}
else
{
fhem("setreading dHeizLeistung heating-state off;set KHZ_SchalterSonoff_HZSchalter off");
}
}
2018.12.30 22:53:39.184 1: stacktrace:
2018.12.30 22:53:39.184 1: main::__ANON__ called by (eval 1251) (3)
2018.12.30 22:53:39.184 1: (eval) called by fhem.pl (4477)
2018.12.30 22:53:39.184 1: main::evalStateFormat called by fhem.pl (4578)
2018.12.30 22:53:39.184 1: main::readingsEndUpdate called by fhem.pl (4768)
2018.12.30 22:53:39.185 1: main::readingsSingleUpdate called by fhem.pl (2318)
2018.12.30 22:53:39.185 1: main::CommandSetReading called by fhem.pl (1218)
2018.12.30 22:53:39.185 1: main::AnalyzeCommand called by fhem.pl (1064)
2018.12.30 22:53:39.185 1: main::AnalyzeCommandChain called by fhem.pl (3650)
2018.12.30 22:53:39.185 1: main::fhem called by (eval 1247) (35)
2018.12.30 22:53:39.185 1: (eval) called by fhem.pl (1117)
2018.12.30 22:53:39.185 1: main::AnalyzePerlCommand called by fhem.pl (1142)
2018.12.30 22:53:39.185 1: main::AnalyzeCommand called by fhem.pl (1064)
2018.12.30 22:53:39.186 1: main::AnalyzeCommandChain called by ./FHEM/91_notify.pm (120)
2018.12.30 22:53:39.186 1: main::notify_Exec called by fhem.pl (3610)
2018.12.30 22:53:39.186 1: main::CallFn called by fhem.pl (3530)
2018.12.30 22:53:39.186 1: main::DoTrigger called by fhem.pl (3888)
2018.12.30 22:53:39.186 1: main::Dispatch called by ./FHEM/00_CUL.pm (948)
2018.12.30 22:53:39.186 1: main::CUL_Parse called by ./FHEM/00_CUL.pm (832)
2018.12.30 22:53:39.186 1: main::CUL_Read called by fhem.pl (3610)
2018.12.30 22:53:39.187 1: main::CallFn called by fhem.pl (727)
Wenn Jemand eine Idee hat ...
Danke
was steht denn in $heatingPerformancePercent bzw. in $heatingPerformance und $totalPower?
Hallo KernSani,
hier der Auszug der RAW Definition:
setstate n_heizleistung 2018-12-05 13:43:22 heating-performance 420.02
setstate n_heizleistung 2018-12-05 13:43:22 heating-performance-percent 2.17
setstate n_heizleistung 2018-12-30 22:52:32 state active
setstate n_heizleistung 2018-12-05 13:43:22 total-power 19353
https://perldoc.perl.org/functions/sprintf.html
LG
pah
Hallo pah, da hatte ich ich auch geschaut.
wenn ich das richtig verstehe ist im stack trace nur eine Stelle mit sprintf die es sein könnte:
sprintf("%.2f", $heatingPerformancePercent)
heating-performance-percent = 2.17
sollte also gehen.
Jetzt habe ich es auskommentiert aber die Meldung kommt noch immer.
Also muß es ein sprintf sein was nicht im stack trace zu sehen ist.
Sorry aber irgendwie habe ich keine Idee an welcher Stelle ich schauen soll.
Danke und guten Übergang.
Gefunden !
Leider hat mich der stack trace nur bedingt an die richtige Stelle geführt.
Die Fehlerhafte Zeile tauchte nirgend auf.
Problem war das device "dHeizLeistung"
2018.12.30 22:53:39.183 5: Cmd: >setreading dHeizLeistung heating-state off<
2018.12.30 22:53:39.184 1: PERL WARNING: Invalid conversion in sprintf: "% /" at (eval 1251) line 3.
dort gab es eine Definition:
attr dHeizLeistung stateFormat {\
sprintf("%.1fW / %.1f% / %s",\
ReadingsVal("dHeizLeistung","heating-performance",0),\
ReadingsVal("dHeizLeistung","heating-performance-percent",0),\
ReadingsVal("dHeizLeistung","heating-state","")\
) \
Da war der Fehler: %.1f% weil zur Ausgabe des % an diese Stelle: %.1f%% muß.
Ich habe also die ganze Zeit an der falschen Stelle gesucht.
Was ich gelernt habe:
- schau dir die Zeile über der Fehlermeldung an, die wurde gerade abgearbeitet
- vergiss alle folgenden Zeilen im stack trace, die dienen nur der Verwirrung :-)