2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

76_SolarForecast: new attribute flowGraphicShift

git-svn-id: https://svn.fhem.de/fhem/trunk@29082 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2024-08-18 20:24:09 +00:00
parent e600faf5c8
commit b058b62aec
2 changed files with 74 additions and 93 deletions

View File

@ -1,5 +1,7 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it # Do not insert empty lines here, update check depends on it
- feature: 76_SolarForecast: new attribute flowGraphicShift,
Forum:https://forum.fhem.de/index.php?msg=1318597
- change: 93_DbRep: message data ignored change loglevel to 2, Forum:#138986 - change: 93_DbRep: message data ignored change loglevel to 2, Forum:#138986
- bufgix: 76_SMAInverter: fix IDC2 bug 3MPP - bufgix: 76_SMAInverter: fix IDC2 bug 3MPP
- bufgix: 76_SMAInverter: fix IDC3 bug - bufgix: 76_SMAInverter: fix IDC3 bug

View File

@ -155,6 +155,8 @@ BEGIN {
# Versions History intern # Versions History intern
my %vNotesIntern = ( my %vNotesIntern = (
"1.30.0" => "18.08.2024 new attribute flowGraphicShift, Forum:https://forum.fhem.de/index.php?msg=1318597 ",
"1.29.4" => "03.08.2024 delete writeCacheToFile from _getRoofTopData, _specialActivities: avoid loop caused by \@widgetreadings ",
"1.29.3" => "20.07.2024 eleminate hand over \$hash in _getRoofTopData routines, fix label 'gcon' to 'gcons' ", "1.29.3" => "20.07.2024 eleminate hand over \$hash in _getRoofTopData routines, fix label 'gcon' to 'gcons' ",
"1.29.2" => "17.06.2024 ___readCandQ: improve manual setting of pvCorrectionFactor_XX ", "1.29.2" => "17.06.2024 ___readCandQ: improve manual setting of pvCorrectionFactor_XX ",
"1.29.1" => "17.06.2024 fix Warnings, Forum: https://forum.fhem.de/index.php?msg=1315283, fix roofIdentPair ", "1.29.1" => "17.06.2024 fix Warnings, Forum: https://forum.fhem.de/index.php?msg=1315283, fix roofIdentPair ",
@ -1187,6 +1189,7 @@ sub Initialize {
"flowGraphicSize ". "flowGraphicSize ".
"flowGraphicAnimate:1,0 ". "flowGraphicAnimate:1,0 ".
"flowGraphicConsumerDistance:slider,80,10,500 ". "flowGraphicConsumerDistance:slider,80,10,500 ".
"flowGraphicShift:slider,-80,5,80 ".
"flowGraphicShowConsumer:1,0 ". "flowGraphicShowConsumer:1,0 ".
"flowGraphicShowConsumerDummy:1,0 ". "flowGraphicShowConsumerDummy:1,0 ".
"flowGraphicShowConsumerPower:0,1 ". "flowGraphicShowConsumerPower:0,1 ".
@ -2591,7 +2594,6 @@ sub __solCast_ApiRequest {
my $hash = $defs{$name}; my $hash = $defs{$name};
if (!$allstrings) { # alle Strings wurden abgerufen if (!$allstrings) { # alle Strings wurden abgerufen
writeCacheToFile ($hash, 'solcastapi', $scpicache.$name); # Cache File SolCast API Werte schreiben
return; return;
} }
@ -3009,7 +3011,6 @@ sub __forecastSolar_ApiRequest {
my $hash = $defs{$name}; my $hash = $defs{$name};
if (!$allstrings) { # alle Strings wurden abgerufen if (!$allstrings) { # alle Strings wurden abgerufen
writeCacheToFile ($hash, 'solcastapi', $scpicache.$name); # Cache File API Werte schreiben
$data{$type}{$name}{solcastapi}{'?All'}{'?All'}{todayDoneAPIcalls} += 1; $data{$type}{$name}{solcastapi}{'?All'}{'?All'}{todayDoneAPIcalls} += 1;
return; return;
} }
@ -3906,7 +3907,6 @@ sub __openMeteoDWD_ApiRequest {
my $hash = $defs{$name}; my $hash = $defs{$name};
if (!$allstrings) { # alle Strings wurden abgerufen if (!$allstrings) { # alle Strings wurden abgerufen
writeCacheToFile ($hash, 'solcastapi', $scpicache.$name);
my $apiitv = SolCastAPIVal ($hash, '?All', '?All', 'currentAPIinterval', $ometeorepdef); my $apiitv = SolCastAPIVal ($hash, '?All', '?All', 'currentAPIinterval', $ometeorepdef);
readingsSingleUpdate ($hash, 'nextRadiationAPICall', $hqtxt{after}{$lang}.' '.(timestampToTimestring ($t + $apiitv, $lang))[0], 1); readingsSingleUpdate ($hash, 'nextRadiationAPICall', $hqtxt{after}{$lang}.' '.(timestampToTimestring ($t + $apiitv, $lang))[0], 1);
$data{$type}{$name}{solcastapi}{'?All'}{'?All'}{todayDoneAPIcalls} += 1; $data{$type}{$name}{solcastapi}{'?All'}{'?All'}{todayDoneAPIcalls} += 1;
@ -6160,8 +6160,6 @@ sub writeCacheToFile {
} }
my $type = $hash->{TYPE}; my $type = $hash->{TYPE};
my @data;
my ($error, $err, $lw); my ($error, $err, $lw);
if ($cachename eq 'aitrained') { if ($cachename eq 'aitrained') {
@ -6188,13 +6186,13 @@ sub writeCacheToFile {
if ($data) { if ($data) {
$error = fileStore ($data, $file); $error = fileStore ($data, $file);
}
if ($error) { if ($error) {
$err = qq{ERROR while writing AI data to file "$file": $error}; $err = qq{ERROR while writing AI data to file "$file": $error};
Log3 ($name, 1, "$name - $err"); Log3 ($name, 1, "$name - $err");
return $err; return $err;
} }
}
$lw = gettimeofday(); $lw = gettimeofday();
$hash->{LCACHEFILE} = "last write time: ".FmtTime($lw)." File: $file"; $hash->{LCACHEFILE} = "last write time: ".FmtTime($lw)." File: $file";
@ -6206,16 +6204,16 @@ sub writeCacheToFile {
if ($cachename eq 'dwdcatalog') { if ($cachename eq 'dwdcatalog') {
if (scalar keys %{$data{$type}{$name}{dwdcatalog}}) { if (scalar keys %{$data{$type}{$name}{dwdcatalog}}) {
$error = fileStore ($data{$type}{$name}{dwdcatalog}, $file); $error = fileStore ($data{$type}{$name}{dwdcatalog}, $file);
}
else {
return "The DWD Station Catalog is empty";
}
if ($error) { if ($error) {
$err = qq{ERROR while writing DWD Station Catalog to file "$file": $error}; $err = qq{ERROR while writing DWD Station Catalog to file "$file": $error};
Log3 ($name, 1, "$name - $err"); Log3 ($name, 1, "$name - $err");
return $err; return $err;
} }
}
else {
return "The DWD Station Catalog is empty";
}
return; return;
} }
@ -6225,13 +6223,13 @@ sub writeCacheToFile {
if (scalar keys %{$plantcfg}) { if (scalar keys %{$plantcfg}) {
$error = fileStore ($plantcfg, $file); $error = fileStore ($plantcfg, $file);
}
if ($error) { if ($error) {
$err = qq{ERROR writing cache file "$file": $error}; $err = qq{ERROR writing cache file "$file": $error};
Log3 ($name, 1, "$name - $err"); Log3 ($name, 1, "$name - $err");
return $err; return $err;
} }
}
$lw = gettimeofday(); $lw = gettimeofday();
$hash->{LCACHEFILE} = "last write time: ".FmtTime($lw)." File: $file"; $hash->{LCACHEFILE} = "last write time: ".FmtTime($lw)." File: $file";
@ -6241,10 +6239,11 @@ sub writeCacheToFile {
} }
return if(!$data{$type}{$name}{$cachename}); return if(!$data{$type}{$name}{$cachename});
my $json = encode_json ($data{$type}{$name}{$cachename});
push @data, $json;
$error = FileWrite ($file, @data); my @arr;
push @arr, encode_json ($data{$type}{$name}{$cachename});
$error = FileWrite ($file, @arr);
if ($error) { if ($error) {
$err = qq{ERROR writing cache file "$file": $error}; $err = qq{ERROR writing cache file "$file": $error};
@ -6497,36 +6496,6 @@ sub centralTask {
### nicht mehr benötigte Daten verarbeiten - Bereich kann später wieder raus !! ### nicht mehr benötigte Daten verarbeiten - Bereich kann später wieder raus !!
########################################################################################################################## ##########################################################################################################################
my $val = ReadingsVal ($name, 'currentMeterDev', ''); # 01.06.2024
if ($val) {
CommandAttr (undef, "$name setupMeterDev $val");
readingsDelete ($hash, 'currentMeterDev');
}
my $val1 = ReadingsVal ($name, 'currentBatteryDev', ''); # 02.06.2024
if ($val1) {
CommandAttr (undef, "$name setupBatteryDev $val1");
readingsDelete ($hash, 'currentBatteryDev');
}
my $idts = ReadingsTimestamp ($name, 'currentInverterDev', ''); # 02.06.2024
if ($idts) {
$idts = timestringToTimestamp ($idts);
$data{$type}{$name}{circular}{99}{attrInvChangedTs} = $idts;
}
my $val2 = ReadingsVal ($name, 'currentInverterDev', ''); # 03.06.2024
if ($val2) {
CommandAttr (undef, "$name setupInverterDev $val2");
readingsDelete ($hash, 'currentInverterDev');
}
my $val3 = ReadingsVal ($name, 'inverterStrings', ''); # 05.06.2024
if ($val3) {
CommandAttr (undef, "$name setupInverterStrings $val3");
readingsDelete ($hash, 'inverterStrings');
}
my $val4 = ReadingsVal ($name, 'currentRadiationAPI', ''); # 10.06.2024 my $val4 = ReadingsVal ($name, 'currentRadiationAPI', ''); # 10.06.2024
if ($val4) { if ($val4) {
CommandAttr (undef, "$name setupRadiationAPI $val4"); CommandAttr (undef, "$name setupRadiationAPI $val4");
@ -7162,9 +7131,14 @@ sub _specialActivities {
readingsDelete ($hash, 'Today_PVdeviation'); readingsDelete ($hash, 'Today_PVdeviation');
readingsDelete ($hash, 'Today_PVreal'); readingsDelete ($hash, 'Today_PVreal');
for my $wdr (@widgetreadings) { # Array der Hilfsreadings (Attributspeicher) löschen if (scalar(@widgetreadings)) { # vermeide Schleife falls FHEMWEB geöfffnet
my @acopy = @widgetreadings;
@widgetreadings = ();
for my $wdr (@acopy) { # Array der Hilfsreadings (Attributspeicher) löschen
readingsDelete ($hash, $wdr); readingsDelete ($hash, $wdr);
} }
}
delete $data{$type}{$name}{solcastapi}{'?All'}{'?All'}{todayDoneAPIrequests}; delete $data{$type}{$name}{solcastapi}{'?All'}{'?All'}{todayDoneAPIrequests};
delete $data{$type}{$name}{solcastapi}{'?All'}{'?All'}{todayDoneAPIcalls}; delete $data{$type}{$name}{solcastapi}{'?All'}{'?All'}{todayDoneAPIcalls};
@ -10319,17 +10293,7 @@ sub __getCyclesAndRuntime {
### nicht mehr benötigte Daten verarbeiten - Bereich kann später wieder raus !! ### nicht mehr benötigte Daten verarbeiten - Bereich kann später wieder raus !!
########################################################################################################################## ##########################################################################################################################
my $nds = ConsumerVal ($hash, $c, 'numberDayStarts', 'leer'); # 28.05.2024
my $art = ConsumerVal ($hash, $c, 'avgruntime', 'leer');
if ($nds ne 'leer') {
$data{$type}{$name}{consumers}{$c}{cycleDayNum} = $nds;
delete $data{$type}{$name}{consumers}{$c}{numberDayStarts};
}
if ($art ne 'leer') {
$data{$type}{$name}{consumers}{$c}{runtimeAvgDay} = $art;
delete $data{$type}{$name}{consumers}{$c}{avgruntime};
}
########################################################################################################################## ##########################################################################################################################
my ($starthour, $startday); my ($starthour, $startday);
@ -11540,6 +11504,7 @@ sub entryGraphic {
hdrDetail => AttrVal ($name, 'graphicHeaderDetail', 'all'), # ermöglicht den Inhalt zu begrenzen, um bspw. passgenau in ftui einzubetten hdrDetail => AttrVal ($name, 'graphicHeaderDetail', 'all'), # ermöglicht den Inhalt zu begrenzen, um bspw. passgenau in ftui einzubetten
flowgsize => AttrVal ($name, 'flowGraphicSize', $flowGSizedef), # Größe Energieflußgrafik flowgsize => AttrVal ($name, 'flowGraphicSize', $flowGSizedef), # Größe Energieflußgrafik
flowgani => AttrVal ($name, 'flowGraphicAnimate', 0), # Animation Energieflußgrafik flowgani => AttrVal ($name, 'flowGraphicAnimate', 0), # Animation Energieflußgrafik
flowgshift => AttrVal ($name, 'flowGraphicShift', 0), # Verschiebung der Flußgrafikbox (muß negiert werden)
flowgcons => AttrVal ($name, 'flowGraphicShowConsumer', 1), # Verbraucher in der Energieflußgrafik anzeigen flowgcons => AttrVal ($name, 'flowGraphicShowConsumer', 1), # Verbraucher in der Energieflußgrafik anzeigen
flowgconX => AttrVal ($name, 'flowGraphicShowConsumerDummy', 1), # Dummyverbraucher in der Energieflußgrafik anzeigen flowgconX => AttrVal ($name, 'flowGraphicShowConsumerDummy', 1), # Dummyverbraucher in der Energieflußgrafik anzeigen
flowgconsPower => AttrVal ($name, 'flowGraphicShowConsumerPower' , 1), # Verbraucher Leistung in der Energieflußgrafik anzeigen flowgconsPower => AttrVal ($name, 'flowGraphicShowConsumerPower' , 1), # Verbraucher Leistung in der Energieflußgrafik anzeigen
@ -11711,16 +11676,6 @@ sub _checkSetupNotComplete {
### nicht mehr benötigte Daten verarbeiten - Bereich kann später wieder raus !! ### nicht mehr benötigte Daten verarbeiten - Bereich kann später wieder raus !!
########################################################################################## ##########################################################################################
my $val2 = ReadingsVal ($name, 'currentInverterDev', ''); # 03.06.2024
if ($val2) {
CommandAttr (undef, "$name setupInverterDev $val2");
}
my $val3 = ReadingsVal ($name, 'inverterStrings', ''); # 05.06.2024
if ($val3) {
CommandAttr (undef, "$name setupInverterStrings $val3");
}
my $dir = ReadingsVal ($name, 'moduleAzimuth', ''); # 16.06.2024 my $dir = ReadingsVal ($name, 'moduleAzimuth', ''); # 16.06.2024
if ($dir) { if ($dir) {
readingsSingleUpdate ($hash, 'setupStringAzimuth', $dir, 0); readingsSingleUpdate ($hash, 'setupStringAzimuth', $dir, 0);
@ -13610,10 +13565,11 @@ sub _flowGraphic {
my $name = $paref->{name}; my $name = $paref->{name};
my $flowgsize = $paref->{flowgsize}; my $flowgsize = $paref->{flowgsize};
my $flowgani = $paref->{flowgani}; my $flowgani = $paref->{flowgani};
my $flowgcons = $paref->{flowgcons}; my $flowgshift = $paref->{flowgshift}; # Verschiebung der Flußgrafikbox (muß negiert werden)
my $flowgcons = $paref->{flowgcons}; # Verbraucher in der Energieflußgrafik anzeigen
my $flowgconTime = $paref->{flowgconsTime}; # Verbraucher Restlaufeit in der Energieflußgrafik anzeigen
my $flowgconX = $paref->{flowgconX}; my $flowgconX = $paref->{flowgconX};
my $flowgconPower = $paref->{flowgconsPower}; my $flowgconPower = $paref->{flowgconsPower};
my $flowgconTime = $paref->{flowgconsTime};
my $consDist = $paref->{flowgconsDist}; my $consDist = $paref->{flowgconsDist};
my $css = $paref->{css}; my $css = $paref->{css};
@ -13666,10 +13622,10 @@ sub _flowGraphic {
my $batout_direction = 'M902,305 L730,510'; # Batterientladung aus Netz my $batout_direction = 'M902,305 L730,510'; # Batterientladung aus Netz
if($batin) { if ($batin) {
my $gbi = $batin - $cpv; my $gbi = $batin - $cpv;
if($gbi > 1) { if ($gbi > 1) {
$batin -= $gbi; $batin -= $gbi;
$batout_style = 'flowg active_in'; $batout_style = 'flowg active_in';
$batout_direction = 'M730,510 L902,305'; $batout_direction = 'M730,510 L902,305';
@ -13682,9 +13638,18 @@ sub _flowGraphic {
my $csc_style = $csc && $cpv ? 'flowg active_out' : 'flowg inactive_out'; my $csc_style = $csc && $cpv ? 'flowg active_out' : 'flowg inactive_out';
my $cgfi_style = $cgfi ? 'flowg active_out' : 'flowg inactive_out'; my $cgfi_style = $cgfi ? 'flowg active_out' : 'flowg inactive_out';
my $vbox_default = !$flowgcons ? '5 -25 800 480' : my $vbminx = -10 * $flowgshift; # min-x and min-y represent the smallest X and Y coordinates that the viewBox may have
$flowgconTime ? '5 -25 800 700' : my $vbminy = -25;
'5 -25 800 680'; my $vbwidth = 800; # width and height specify the viewBox size
my $vbhight = !$flowgcons ? 480 :
$flowgconTime ? 700 :
680;
my $vbox = "$vbminx $vbminy $vbwidth $vbhight";
#my $vbox = !$flowgcons ? "$vbminx -25 800 480" :
# $flowgconTime ? "$vbminx -25 800 700" :
# "$vbminx -25 800 680";
my $ret = << "END0"; my $ret = << "END0";
<style> <style>
@ -13692,7 +13657,7 @@ sub _flowGraphic {
$animation $animation
</style> </style>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="$vbox_default" style="$style" id="SVGPLOT"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="$vbox" style="$style" id="SVGPLOT">
<g transform="translate(400,50)"> <g transform="translate(400,50)">
<g> <g>
@ -19912,6 +19877,13 @@ to ensure that the system configuration is correct.
</li> </li>
<br> <br>
<a id="SolarForecast-attr-flowGraphicShift"></a>
<li><b>flowGraphicShift &lt;Pixel/10&gt; </b><br>
Horizontal shift of the energy flow graph. <br>
(default: 0)
</li>
<br>
<a id="SolarForecast-attr-flowGraphicShowConsumerDummy"></a> <a id="SolarForecast-attr-flowGraphicShowConsumerDummy"></a>
<li><b>flowGraphicShowConsumerDummy </b><br> <li><b>flowGraphicShowConsumerDummy </b><br>
Shows or suppresses the dummy consumer in the energy flow graph. <br> Shows or suppresses the dummy consumer in the energy flow graph. <br>
@ -22198,6 +22170,13 @@ die ordnungsgemäße Anlagenkonfiguration geprüft werden.
</li> </li>
<br> <br>
<a id="SolarForecast-attr-flowGraphicShift"></a>
<li><b>flowGraphicShift &lt;Pixel/10&gt; </b><br>
Horizontale Verschiebung der Energieflußgrafik. <br>
(default: 0)
</li>
<br>
<a id="SolarForecast-attr-flowGraphicShowConsumerDummy"></a> <a id="SolarForecast-attr-flowGraphicShowConsumerDummy"></a>
<li><b>flowGraphicShowConsumerDummy </b><br> <li><b>flowGraphicShowConsumerDummy </b><br>
Zeigt bzw. unterdrückt den Dummy-Verbraucher in der Energieflußgrafik. <br> Zeigt bzw. unterdrückt den Dummy-Verbraucher in der Energieflußgrafik. <br>