From 2f28df7bf68684bc9ddf122354054ac4e7837b8c Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Sun, 13 Oct 2024 20:35:09 +0000 Subject: [PATCH] 76_SolarForecast: new attr affectConsForecastLastDays and more features, changes in Flowgraphic git-svn-id: https://svn.fhem.de/fhem/trunk@29236 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/76_SolarForecast.pm | 97 +++++++++++++++++++-- fhem/contrib/DS_Starter/76_SolarForecast.pm | 97 +++++++++++++++++++-- 2 files changed, 178 insertions(+), 16 deletions(-) diff --git a/fhem/FHEM/76_SolarForecast.pm b/fhem/FHEM/76_SolarForecast.pm index 4f09476e2..c1bd8f0e5 100644 --- a/fhem/FHEM/76_SolarForecast.pm +++ b/fhem/FHEM/76_SolarForecast.pm @@ -156,7 +156,7 @@ BEGIN { # Versions History intern my %vNotesIntern = ( - "1.36.0" => "13.10.2024 new Getter valInverter and valProducer, preparation for multiple inverters ". + "1.36.0" => "13.10.2024 new Getter valInverter, valStrings and valProducer, preparation for multiple inverters ". "rename setupInverterDev to setupInverterDev01, new attr affectConsForecastLastDays ". "Model DWD: dayAfterTomorrowPVforecast now available ". "delete etotal from HistoryVal, _flowGraphic: move PV Icon up to the producers row ". @@ -628,6 +628,7 @@ my %hget = ( # Ha valCurrent => { fn => \&_getlistCurrent, needcred => 0 }, valInverter => { fn => \&_getlistvalInverter, needcred => 0 }, valProducer => { fn => \&_getlistvalProducer, needcred => 0 }, + valStrings => { fn => \&_getlistvalStrings, needcred => 0 }, valConsumerMaster => { fn => \&_getlistvalConsumerMaster, needcred => 0 }, plantConfigCheck => { fn => \&_setplantConfiguration, needcred => 0 }, pvHistory => { fn => \&_getlistPVHistory, needcred => 0 }, @@ -2475,17 +2476,20 @@ sub Get { my @vcm = map {sprintf "%02d", $_} sort {$a<=>$b} keys %{$data{$type}{$name}{consumers}}; my @vin = map {sprintf "%02d", $_} sort {$a<=>$b} keys %{$data{$type}{$name}{inverters}}; my @vpn = map {sprintf "%02d", $_} sort {$a<=>$b} keys %{$data{$type}{$name}{producers}}; + my @vst = sort keys %{$data{$type}{$name}{strings}}; my $hol = join ",", @ho; my $pvl = join ",", @pha; my $cml = join ",", @vcm; my $inl = join ",", @vin; my $pnl = join ",", @vpn; + my $str = join ",", @vst; my $getlist = "Unknown argument $opt, choose one of ". "valConsumerMaster:#,$cml ". "valInverter:#,$inl ". "valProducer:#,$pnl ". + "valStrings:#,$str ". "data:noArg ". "dwdCatalog ". "forecastQualities:noArg ". @@ -4668,6 +4672,21 @@ sub _getlistvalProducer { return $ret; } +############################################################### +# Getter valStrings +############################################################### +sub _getlistvalStrings { + my $paref = shift; + my $name = $paref->{name}; + my $arg = $paref->{arg}; + my $hash = $defs{$name}; + + my $ret = listDataPool ($hash, 'strings', $arg); + $ret .= lineFromSpaces ($ret, 30); + +return $ret; +} + ############################################################### # Getter solApiData ############################################################### @@ -15944,10 +15963,11 @@ sub listDataPool { } } - if ($htol =~ /consumers|inverters|producers/xs) { + if ($htol =~ /consumers|inverters|producers|strings/xs) { my $sub = $htol eq 'consumers' ? \&ConsumerVal : $htol eq 'inverters' ? \&InverterVal : $htol eq 'producers' ? \&ProducerVal : + $htol eq 'strings' ? \&StringVal : ''; $h = $data{$type}{$name}{$htol}; @@ -15957,7 +15977,7 @@ sub listDataPool { } for my $i (keys %{$h}) { - if ($i !~ /^[0-9]{2}$/ix) { # bereinigen ungültige Position, Forum: https://forum.fhem.de/index.php/topic,117864.msg1173219.html#msg1173219 + if ($i !~ /^[0-9]{2}$/ix && $htol ne 'strings') { # bereinigen ungültige Position, Forum: https://forum.fhem.de/index.php/topic,117864.msg1173219.html#msg1173219 delete $data{$type}{$name}{$htol}{$i}; Log3 ($name, 2, qq{$name - INFO - invalid key "$i" was deleted from }.ucfirst($htol).qq{ storage}); } @@ -15965,7 +15985,8 @@ sub listDataPool { for my $idx (sort{$a<=>$b} keys %{$h}) { next if($par && $idx ne $par); - my $cret; + my ($cret, $s1); + my $sp1 = _ldpspaces ($idx, q{}); for my $ckey (sort keys %{$h->{$idx}}) { if (ref $h->{$idx}{$ckey} eq 'HASH') { @@ -15974,13 +15995,13 @@ sub listDataPool { $hk .= " " if($hk); $hk .= "$f=".$h->{$idx}{$ckey}{$f}; } - $cret .= $ckey." => ".$hk."\n "; + $cret .= ($s1 ? $sp1 : "").$ckey." => ".$hk."\n"; } else { - $cret .= $ckey." => ". &{$sub} ($hash, $idx, $ckey, "")."\n "; + $cret .= ($s1 ? $sp1 : "").$ckey." => ". &{$sub} ($hash, $idx, $ckey, "")."\n"; } + $s1 = 1; } - $sq .= $idx." => ".$cret."\n"; } } @@ -20154,7 +20175,8 @@ to ensure that the system configuration is correct. ietotal total energy generated by the inverter to date (Wh) igeneration current PV generation (W) iicon any icons defined for displaying the device in the graphic - iname name of the device + ialias Alias of the device + iname Name of the device invertercap the nominal power (W) of the inverter (if defined) @@ -20162,6 +20184,35 @@ to ensure that the system configuration is correct.
+ + +
+ + +

@@ -22540,6 +22591,7 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden. ietotal Stand gesamte bisher erzeugte Energie des Wechselrichters (Wh) igeneration aktuelle PV Erzeugung (W) iicon die evtl. festgelegten Icons zur Darstellung des Gerätes in der Grafik + ialias Alias des Devices iname Name des Devices invertercap die nominale Leistung (W) des Wechselrichters (falls definiert) @@ -22548,6 +22600,35 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.
+ + +
+ + +

diff --git a/fhem/contrib/DS_Starter/76_SolarForecast.pm b/fhem/contrib/DS_Starter/76_SolarForecast.pm index 4f09476e2..c1bd8f0e5 100644 --- a/fhem/contrib/DS_Starter/76_SolarForecast.pm +++ b/fhem/contrib/DS_Starter/76_SolarForecast.pm @@ -156,7 +156,7 @@ BEGIN { # Versions History intern my %vNotesIntern = ( - "1.36.0" => "13.10.2024 new Getter valInverter and valProducer, preparation for multiple inverters ". + "1.36.0" => "13.10.2024 new Getter valInverter, valStrings and valProducer, preparation for multiple inverters ". "rename setupInverterDev to setupInverterDev01, new attr affectConsForecastLastDays ". "Model DWD: dayAfterTomorrowPVforecast now available ". "delete etotal from HistoryVal, _flowGraphic: move PV Icon up to the producers row ". @@ -628,6 +628,7 @@ my %hget = ( # Ha valCurrent => { fn => \&_getlistCurrent, needcred => 0 }, valInverter => { fn => \&_getlistvalInverter, needcred => 0 }, valProducer => { fn => \&_getlistvalProducer, needcred => 0 }, + valStrings => { fn => \&_getlistvalStrings, needcred => 0 }, valConsumerMaster => { fn => \&_getlistvalConsumerMaster, needcred => 0 }, plantConfigCheck => { fn => \&_setplantConfiguration, needcred => 0 }, pvHistory => { fn => \&_getlistPVHistory, needcred => 0 }, @@ -2475,17 +2476,20 @@ sub Get { my @vcm = map {sprintf "%02d", $_} sort {$a<=>$b} keys %{$data{$type}{$name}{consumers}}; my @vin = map {sprintf "%02d", $_} sort {$a<=>$b} keys %{$data{$type}{$name}{inverters}}; my @vpn = map {sprintf "%02d", $_} sort {$a<=>$b} keys %{$data{$type}{$name}{producers}}; + my @vst = sort keys %{$data{$type}{$name}{strings}}; my $hol = join ",", @ho; my $pvl = join ",", @pha; my $cml = join ",", @vcm; my $inl = join ",", @vin; my $pnl = join ",", @vpn; + my $str = join ",", @vst; my $getlist = "Unknown argument $opt, choose one of ". "valConsumerMaster:#,$cml ". "valInverter:#,$inl ". "valProducer:#,$pnl ". + "valStrings:#,$str ". "data:noArg ". "dwdCatalog ". "forecastQualities:noArg ". @@ -4668,6 +4672,21 @@ sub _getlistvalProducer { return $ret; } +############################################################### +# Getter valStrings +############################################################### +sub _getlistvalStrings { + my $paref = shift; + my $name = $paref->{name}; + my $arg = $paref->{arg}; + my $hash = $defs{$name}; + + my $ret = listDataPool ($hash, 'strings', $arg); + $ret .= lineFromSpaces ($ret, 30); + +return $ret; +} + ############################################################### # Getter solApiData ############################################################### @@ -15944,10 +15963,11 @@ sub listDataPool { } } - if ($htol =~ /consumers|inverters|producers/xs) { + if ($htol =~ /consumers|inverters|producers|strings/xs) { my $sub = $htol eq 'consumers' ? \&ConsumerVal : $htol eq 'inverters' ? \&InverterVal : $htol eq 'producers' ? \&ProducerVal : + $htol eq 'strings' ? \&StringVal : ''; $h = $data{$type}{$name}{$htol}; @@ -15957,7 +15977,7 @@ sub listDataPool { } for my $i (keys %{$h}) { - if ($i !~ /^[0-9]{2}$/ix) { # bereinigen ungültige Position, Forum: https://forum.fhem.de/index.php/topic,117864.msg1173219.html#msg1173219 + if ($i !~ /^[0-9]{2}$/ix && $htol ne 'strings') { # bereinigen ungültige Position, Forum: https://forum.fhem.de/index.php/topic,117864.msg1173219.html#msg1173219 delete $data{$type}{$name}{$htol}{$i}; Log3 ($name, 2, qq{$name - INFO - invalid key "$i" was deleted from }.ucfirst($htol).qq{ storage}); } @@ -15965,7 +15985,8 @@ sub listDataPool { for my $idx (sort{$a<=>$b} keys %{$h}) { next if($par && $idx ne $par); - my $cret; + my ($cret, $s1); + my $sp1 = _ldpspaces ($idx, q{}); for my $ckey (sort keys %{$h->{$idx}}) { if (ref $h->{$idx}{$ckey} eq 'HASH') { @@ -15974,13 +15995,13 @@ sub listDataPool { $hk .= " " if($hk); $hk .= "$f=".$h->{$idx}{$ckey}{$f}; } - $cret .= $ckey." => ".$hk."\n "; + $cret .= ($s1 ? $sp1 : "").$ckey." => ".$hk."\n"; } else { - $cret .= $ckey." => ". &{$sub} ($hash, $idx, $ckey, "")."\n "; + $cret .= ($s1 ? $sp1 : "").$ckey." => ". &{$sub} ($hash, $idx, $ckey, "")."\n"; } + $s1 = 1; } - $sq .= $idx." => ".$cret."\n"; } } @@ -20154,7 +20175,8 @@ to ensure that the system configuration is correct. ietotal total energy generated by the inverter to date (Wh) igeneration current PV generation (W) iicon any icons defined for displaying the device in the graphic - iname name of the device + ialias Alias of the device + iname Name of the device invertercap the nominal power (W) of the inverter (if defined) @@ -20162,6 +20184,35 @@ to ensure that the system configuration is correct.
+ + +
+ + +

@@ -22540,6 +22591,7 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden. ietotal Stand gesamte bisher erzeugte Energie des Wechselrichters (Wh) igeneration aktuelle PV Erzeugung (W) iicon die evtl. festgelegten Icons zur Darstellung des Gerätes in der Grafik + ialias Alias des Devices iname Name des Devices invertercap die nominale Leistung (W) des Wechselrichters (falls definiert) @@ -22548,6 +22600,35 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.
+ + +
+ + +