Hallo zusammen,
in unten angegebenem Beitrag habe ich das Thema schon gesehen, ist jedoch leider gesperrt für neue Beiträge.
Ich erhalte auch diese Meldungen/Warnungen im Log und würde das gerne eliminieren.
Verbose = 0 hat bei mir nicht funktioniert.
https://forum.fhem.de/index.php?topic=50710.0
Logauszug
2022.12.26 19:52:51 1 : main::readingsEndUpdate called by ./FHEM/98_Modbus.pm (2742)
2022.12.26 19:52:51 1 : Modbus::CreateDataObjects called by ./FHEM/98_Modbus.pm (2766)
2022.12.26 19:52:51 1 : Modbus::ParseDataString called by ./FHEM/98_Modbus.pm (2272)
2022.12.26 19:52:51 1 : Modbus::HandleResponse called by ./FHEM/98_Modbus.pm (1936)
2022.12.26 19:52:51 1 : Modbus::ReadFn called by fhem.pl (3976)
2022.12.26 19:52:51 1 : main::CallFn called by fhem.pl (784)
2022.12.26 19:52:51 1 : PERL WARNING: Useless use of a constant ("battwatt") in void context at (eval 1081485) line 24.
2022.12.26 19:52:51 1 : stacktrace:
2022.12.26 19:52:51 1 : main::__ANON__ called by (eval 1081485) (24)
2022.12.26 19:52:51 1 : (eval) called by ./FHEM/33_readingsGroup.pm (357)
2022.12.26 19:52:51 1 : main::lookup2 called by ./FHEM/33_readingsGroup.pm (1445)
2022.12.26 19:52:51 1 : main::readingsGroup_Notify called by fhem.pl (3976)
2022.12.26 19:52:51 1 : main::CallFn called by fhem.pl (3888)
2022.12.26 19:52:51 1 : main::DoTrigger called by fhem.pl (4995)
2022.12.26 19:52:51 1 : main::readingsEndUpdate called by ./FHEM/98_Modbus.pm (2742)
2022.12.26 19:52:51 1 : Modbus::CreateDataObjects called by ./FHEM/98_Modbus.pm (2766)
2022.12.26 19:52:51 1 : Modbus::ParseDataString called by ./FHEM/98_Modbus.pm (2272)
2022.12.26 19:52:51 1 : Modbus::HandleResponse called by ./FHEM/98_Modbus.pm (1936)
2022.12.26 19:52:51 1 : Modbus::ReadFn called by fhem.pl (3976)
2022.12.26 19:52:51 1 : main::CallFn called by fhem.pl (784)
2022.12.26 19:52:51 1 : PERL WARNING: Useless use of a constant ("%.0f Watt") in void context at (eval 1081485) line 2
Kommt aus der Readingsgroup
Internals:
DEF <Verbraucher>,<>,<Aktuell>,<Heute>,<Gestern>,<Monat>,<Vormonat>,<{strftime("%Y", localtime)}>,<{strftime("%Y", localtime)-1}>,<Gesamt>
S10:<Gesamtleistung>,!Leistung,!statLeistungDay,!statLeistungDayLast,!statLeistungMonth,!statLeistungMonthLast,-,-
S10:<Hausverbrauch>,!homewatt,!statVerbrauchDay,!statVerbrauchDayLast,!statVerbrauchMonth,!statVerbrauchMonthLast,-,-
S10:<Netz/Einspeisung>,!gridwatt,!statNetzDay,{statNetzDay*0.082},!statNetzDayLast,!statNetzMonth,!statNetzMonthLast,-,-
S10:<Einspeisung>,!gridwatt,!statEinspeiseDay,!statEinspeiseDayLast,!statEinspeiseMonth,!statEinspeiseMonthLast,-,-
S10:<Einspeiseverg.>,<->,!statEinspeiseVergDay,!statEinspeiseVergDayLast,!statEinspeiseVergMonth,!statEinspeiseVergMonthLast,<->,<->,!Einspeiseverguetung
S10:<Batterie>,!battwatt
S10:<Batterie_Status>,!battsoc
S10:<NotStrom>,!notstrom
FUUID 630ddef2-f33f-4184-e942-fd9c814fb20989e1
NAME E3DC
NR 469
NTFY_ORDER 50-E3DC
STATE Initialized
TYPE readingsGroup
changed 0
mayBeVisible 1
CONTENT:
S10 1
CONTENT2:
DEVICES:
ARRAY(0x1209f520)
ARRAY(0x1292e128)
ARRAY(0x127ca128)
ARRAY(0x1237a6e8)
ARRAY(0x2677f08)
ARRAY(0x1290f800)
ARRAY(0x12b80d70)
ARRAY(0x12d29e38)
ARRAY(0x12d29580)
fhem:
lastDefChange 128
last_update 1672131073.31084
helper:
DEF
valueFormat {
if ($READING eq 'power')
{
return "%.1f W";
}
elsif ($READING eq 'homewatt' || $READING eq 'Leistung' || $READING eq 'gridwatt' )
{
return "%.1f W";
}
elsif ($READING =~ m/^statEinspeiseVerg/ || $READING eq 'Einspeiseverguetung' )
{
return "%.2f €";
}
elsif ($READING =~ m/^stat/)
{
return "%.2f kWh";
}
costsDay => "%.1f €";
battsoc => "%.1f %";
homewatt => "%.0f Watt";
sunwatt => "%.0f Watt";
gridwatt => "%.0f Watt";
battwatt => "%.0f Watt";
notstrom => "%.0f";
sun2watt2 => "%.0f Watt";
Leistung => "%.0f Watt";
}
valueStyle { if($READING eq "battsoc" && $VALUE > 85) { 'style="color:green"'}elsif($READING eq "battsoc" && $VALUE > 60) { 'style="color:green"'}
elsif($READING eq "battsoc" && $VALUE > 35) { 'style="color:black"'}elsif($READING eq "battsoc" && $VALUE > 20) { 'style="color:orange"'}
elsif($READING eq "battsoc" && $VALUE < 21 ) { 'style="color:red"'}
elsif($READING eq "notstrom" && $VALUE > 1){ 'style="color:black"'}elsif($READING eq "notstrom" && $VALUE < 1) { 'style="color:orange"'}
elsif($READING eq "homewatt" && $VALUE > 401){ 'style="color:orange"'}elsif($READING eq "homewatt" && $VALUE < 400){ 'style="color:green"'}
elsif($READING eq "homewatt" && $VALUE > 1500){ 'style="color:black"'}elsif($READING eq "homewatt" && $VALUE > 3000){ 'style="color:red"'}
elsif($READING eq "sunwatt" && $VALUE > 0){ 'style="color:black"'}elsif($READING eq "sunwatt" && $VALUE < 1){ 'style="color:black"'}
elsif($READING eq "sun2watt2" && $VALUE > 0){ 'style="color:black"'}elsif($READING eq "sun2watt2" && $VALUE < 1){ 'style="color:black"'}
elsif($READING eq "gridwatt" && $VALUE < 0){ 'style="color:green"'}elsif($READING eq "gridwatt" && $VALUE > 0){ 'style="color:red"'}
elsif($READING eq "battwatt" && $VALUE > 0){ 'style="color:black"'}elsif($READING eq "battwatt" && $VALUE < 0){ 'style="color:green"'}
elsif($READING eq "Leistung" && $VALUE > 1){ 'style="color:orange"'}elsif($READING eq "notstrom" && $VALUE > 3){ 'style="color:red"'} }
positions:
S10.Einspeiseverguetung 6:9
S10.Leistung 2:2
S10.battsoc 8:2
S10.battwatt 7:2
S10.gridwatt 4:2,5:2
S10.homewatt 3:2
S10.notstrom 9:2
S10.statEinspeiseDay 5:3
S10.statEinspeiseDayLast 5:4
S10.statEinspeiseMonth 5:5
S10.statEinspeiseMonthLast 5:6
S10.statEinspeiseVergDay 6:3
S10.statEinspeiseVergDayLast 6:4
S10.statEinspeiseVergMonth 6:5
S10.statEinspeiseVergMonthLast 6:6
S10.statLeistungDay 2:3
S10.statLeistungDayLast 2:4
S10.statLeistungMonth 2:5
S10.statLeistungMonthLast 2:6
S10.statNetzDay 4:3
S10.statNetzDayLast 4:4
S10.statNetzMonth 4:5
S10.statNetzMonthLast 4:6
S10.statVerbrauchDay 3:3
S10.statVerbrauchDayLast 3:4
S10.statVerbrauchMonth 3:5
S10.statVerbrauchMonthLast 3:6
recalc:
undef
undef
ARRAY(0x12aaa648)
ARRAY(0x12b40560)
ARRAY(0x273aaf0)
ARRAY(0x1243dff8)
ARRAY(0x12d2d178)
undef
undef
ARRAY(0x12d2e940)
values:
formated:
undef
undef
ARRAY(0x12a41c60)
ARRAY(0x124387e8)
ARRAY(0x12a6f438)
ARRAY(0x10f73ff0)
ARRAY(0xee94c70)
undef
undef
ARRAY(0x1294b328)
orig:
undef
undef
ARRAY(0x12b3fe10)
ARRAY(0x1107baf0)
ARRAY(0xee921f0)
ARRAY(0x127c9d50)
ARRAY(0x129561f8)
undef
undef
ARRAY(0x11e49080)
prefixsuffix:
undef
undef
ARRAY(0x9741970)
ARRAY(0x12b76fe0)
ARRAY(0x12a42828)
ARRAY(0x128b2f18)
ARRAY(0x126f7400)
undef
undef
ARRAY(0xebc0d78)
Attributes:
group E3DC
room 97_Statistics,PV-Anlage
valueFormat {
if ($READING eq 'power')
{
return "%.1f W";
}
elsif ($READING eq 'homewatt' || $READING eq 'Leistung' || $READING eq 'gridwatt' )
{
return "%.1f W";
}
elsif ($READING =~ m/^statEinspeiseVerg/ || $READING eq 'Einspeiseverguetung' )
{
return "%.2f €";
}
elsif ($READING =~ m/^stat/)
{
return "%.2f kWh";
}
costsDay => "%.1f €";
battsoc => "%.1f %";
homewatt => "%.0f Watt";
sunwatt => "%.0f Watt";
gridwatt => "%.0f Watt";
battwatt => "%.0f Watt";
notstrom => "%.0f";
sun2watt2 => "%.0f Watt";
Leistung => "%.0f Watt";
}
valueStyle { if($READING eq "battsoc" && $VALUE > 85) { 'style="color:green"'}elsif($READING eq "battsoc" && $VALUE > 60) { 'style="color:green"'}
elsif($READING eq "battsoc" && $VALUE > 35) { 'style="color:black"'}elsif($READING eq "battsoc" && $VALUE > 20) { 'style="color:orange"'}
elsif($READING eq "battsoc" && $VALUE < 21 ) { 'style="color:red"'}
elsif($READING eq "notstrom" && $VALUE > 1){ 'style="color:black"'}elsif($READING eq "notstrom" && $VALUE < 1) { 'style="color:orange"'}
elsif($READING eq "homewatt" && $VALUE > 401){ 'style="color:orange"'}elsif($READING eq "homewatt" && $VALUE < 400){ 'style="color:green"'}
elsif($READING eq "homewatt" && $VALUE > 1500){ 'style="color:black"'}elsif($READING eq "homewatt" && $VALUE > 3000){ 'style="color:red"'}
elsif($READING eq "sunwatt" && $VALUE > 0){ 'style="color:black"'}elsif($READING eq "sunwatt" && $VALUE < 1){ 'style="color:black"'}
elsif($READING eq "sun2watt2" && $VALUE > 0){ 'style="color:black"'}elsif($READING eq "sun2watt2" && $VALUE < 1){ 'style="color:black"'}
elsif($READING eq "gridwatt" && $VALUE < 0){ 'style="color:green"'}elsif($READING eq "gridwatt" && $VALUE > 0){ 'style="color:red"'}
elsif($READING eq "battwatt" && $VALUE > 0){ 'style="color:black"'}elsif($READING eq "battwatt" && $VALUE < 0){ 'style="color:green"'}
elsif($READING eq "Leistung" && $VALUE > 1){ 'style="color:orange"'}elsif($READING eq "notstrom" && $VALUE > 3){ 'style="color:red"'} }
verbose 0
wie kann ich die Warnungen im Perl unterdrücken
Das valueFormat Attribut ist eine Mischung aus Perl-Code und Hash-Eintraegen, das ist so nicht richtig.
Zitat von: rudolfkoenig am 27 Dezember 2022, 11:36:05
Das valueFormat Attribut ist eine Mischung aus Perl-Code und Hash-Eintraegen, das ist so nicht richtig.
du meinst diesen Teil?
costsDay => "%.1f €";
battsoc => "%.1f %";
homewatt => "%.0f Watt";
sunwatt => "%.0f Watt";
gridwatt => "%.0f Watt";
battwatt => "%.0f Watt";
notstrom => "%.0f";
sun2watt2 => "%.0f Watt";
Leistung => "%.0f Watt";
kannst Du mir auf die Sprünge helfen, was ich anpassen muss?
Jede dieser Zeilen in einer elsif(...) {...} Konstrukt umwandeln, wie im Abschnitt darueber mit stat & Co.
Zitat von: rudolfkoenig am 27 Dezember 2022, 12:36:09
Jede dieser Zeilen in einer elsif(...) {...} Konstrukt umwandeln, wie im Abschnitt darueber mit stat & Co.
Danke
Oder auskommentieren, wenn man die Werte gar nicht braucht.
Vermutlich war das, was wie ein hash aussieht, ursprünglich nur als Gedankenstütze gedacht.