2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-28 11:01:59 +00:00

76_Solarforcast: contrib 1.1.0

git-svn-id: https://svn.fhem.de/fhem/trunk@28158 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2023-11-14 12:09:14 +00:00
parent 7d56f4ddf5
commit 05bc6a588c

View File

@ -149,7 +149,7 @@ BEGIN {
# Versions History intern # Versions History intern
my %vNotesIntern = ( my %vNotesIntern = (
"1.0.11" => "13.11.2023 graphicHeaderOwnspec: add possible set/attr commands ", "1.1.0" => "14.11.2023 graphicHeaderOwnspec: possible add set/attr commands ",
"1.0.10" => "31.10.2023 fix warnings, edit comref ", "1.0.10" => "31.10.2023 fix warnings, edit comref ",
"1.0.9" => "29.10.2023 _aiGetSpread: set spread from 50 to 20 ", "1.0.9" => "29.10.2023 _aiGetSpread: set spread from 50 to 20 ",
"1.0.8" => "22.10.2023 codechange: add central readings store array, new function storeReading, writeCacheToFile ". "1.0.8" => "22.10.2023 codechange: add central readings store array, new function storeReading, writeCacheToFile ".
@ -536,7 +536,7 @@ my @dd = qw( none
saveData2Cache saveData2Cache
); );
my $allwidgets = 'icon|sortable|uzsu|knob|noArg|time|text|slider|multiple|select|bitfield|widgetList'; my $allwidgets = 'icon|sortable|uzsu|knob|noArg|time|text|slider|multiple|select|bitfield|widgetList|colorpicker';
# Steuerhashes # Steuerhashes
############### ###############
@ -1388,7 +1388,7 @@ sub _setconsumerImmediatePlanning { ## no critic "not used"
my $type = $paref->{type}; my $type = $paref->{type};
my $opt = $paref->{opt}; my $opt = $paref->{opt};
my $c = $paref->{prop}; my $c = $paref->{prop};
my $evt = $paref->{prop1} // 1; my $evt = $paref->{prop1} // 0; # geändert V 1.0.11 - 1 -> 0
return qq{no consumer number specified} if(!$c); return qq{no consumer number specified} if(!$c);
return qq{no valid consumer id "$c"} if(!ConsumerVal ($hash, $c, "name", "")); return qq{no valid consumer id "$c"} if(!ConsumerVal ($hash, $c, "name", ""));
@ -9173,17 +9173,27 @@ sub ___getFWwidget {
my $name = shift; my $name = shift;
my $elm = shift; # Element my $elm = shift; # Element
my $allc = shift; # Kommandovorrat -> ist Element enthalten? my $allc = shift; # Kommandovorrat -> ist Element enthalten?
my $ctyp = shift // 'set'; # Kommandotyp: set/get my $ctyp = shift // 'set'; # Kommandotyp: set/attr
my $widget = ''; my $widget = '';
if ($allc =~ /$elm:(.*?)\s+/xs) { my ($current, $reading);
if ($allc =~ /$elm:?(.*?)\s/xs) {
my $arg = $1; my $arg = $1;
$arg = 'textFieldNL' if(!$arg);
if ($arg !~ /^\#/xs && $arg !~ /^$allwidgets/xs) { if ($arg !~ /^\#/xs && $arg !~ /^$allwidgets/xs) {
$arg = '#,'.$arg; $arg = '#,'.$arg;
} }
if ($ctyp eq 'attr') {
$current = AttrVal ($name, $elm, '');
$reading = '.'.$elm;
readingsSingleUpdate ($defs{$name}, $reading, $current, 0);
}
no strict "refs"; ## no critic 'NoStrict' no strict "refs"; ## no critic 'NoStrict'
$widget = &{$webCmdFn} ($FW_wname, $name, "", $elm, $arg); $widget = &{$webCmdFn} ($FW_wname, $name, "", $elm, $arg);
use strict "refs"; use strict "refs";
@ -9193,7 +9203,18 @@ sub ___getFWwidget {
$widget =~ s,></div>, type='$ctyp'></div>,x; $widget =~ s,></div>, type='$ctyp'></div>,x;
} }
else { else {
$widget = FW_pH ("cmd=$ctyp $name $elm imgget", $elm, 0, "", 1, 1); $widget = FW_pH ("cmd=$ctyp $name $elm", $elm, 0, "", 1, 1);
}
if ($ctyp eq 'attr') {
my ($sc) = $widget =~ /current='(.*?)'/xs;
my ($sr) = $widget =~ /reading='(.*?)'/xs;
$widget =~ s/$sc/$current/ if(defined $sc);
$widget =~ s/$sr/$reading/ if(defined $sr);
}
if ($arg eq 'textField' || $arg eq 'textField-long') { # Label (Reading) ausblenden -> siehe fhemweb.js function FW_createTextField Zeile 1657
$widget =~ s/arg='textField/arg='textFieldNL/xs;
} }
} }
@ -9987,20 +10008,29 @@ sub __weatherOnBeam {
$ret .= "<tr class='$htr{$m}{cl}'><td class='solarfc'></td>"; # freier Platz am Anfang $ret .= "<tr class='$htr{$m}{cl}'><td class='solarfc'></td>"; # freier Platz am Anfang
my $ii; my $ii = 0;
for my $i (0..($maxhours * 2) - 1) { for my $i (0..($maxhours * 2) - 1) {
last if (!exists ($hfcg->{$i}{weather})); last if (!exists ($hfcg->{$i}{weather}));
next if (!$show_night && defined($hfcg->{$i}{weather})
&& ($hfcg->{$i}{weather} > 99) $hfcg->{$i}{weather} = 999 if(!defined $hfcg->{$i}{weather});
debugLog ($paref, 'graphic', "check weather id beam (from left) number >$i< ...") if($ii < $maxhours);
if (!$show_night && $hfcg->{$i}{weather} > 99
&& !$hfcg->{$i}{beam1} && !$hfcg->{$i}{beam1}
&& !$hfcg->{$i}{beam2}); && !$hfcg->{$i}{beam2}) {
debugLog ($paref, 'graphic', "weather id >$i<: don't show night condition ... check next") if($ii < $maxhours);
next;
};
# Lässt Nachticons aber noch durch wenn es einen Wert gibt , ToDo : klären ob die Nacht richtig gesetzt wurde # Lässt Nachticons aber noch durch wenn es einen Wert gibt , ToDo : klären ob die Nacht richtig gesetzt wurde
$ii++; # wieviele Stunden Icons haben wir bisher beechnet ? $ii++; # wieviele Stunden Icons haben wir bisher beechnet ?
last if($ii > $maxhours); last if($ii > $maxhours);
# ToDo : weather_icon sollte im Fehlerfall Title mit der ID besetzen um in FHEMWEB sofort die ID sehen zu können # ToDo : weather_icon sollte im Fehlerfall Title mit der ID besetzen um in FHEMWEB sofort die ID sehen zu können
if (exists($hfcg->{$i}{weather}) && defined($hfcg->{$i}{weather})) { debugLog ($paref, 'graphic', "weather id >$i<: ".
debugLog ($paref, 'graphic', "weather id beam (from left) number >$i<: ".$hfcg->{$i}{weather}); (defined $hfcg->{$i}{weather} ? $hfcg->{$i}{weather} : 'undefined') );
#if (defined $hfcg->{$i}{weather}) {
my ($icon_name, $title) = $hfcg->{$i}{weather} > 100 ? my ($icon_name, $title) = $hfcg->{$i}{weather} > 100 ?
weather_icon ($name, $lang, $hfcg->{$i}{weather}-100) : weather_icon ($name, $lang, $hfcg->{$i}{weather}-100) :
weather_icon ($name, $lang, $hfcg->{$i}{weather}); weather_icon ($name, $lang, $hfcg->{$i}{weather});
@ -10027,11 +10057,11 @@ sub __weatherOnBeam {
} }
$ret .= "<td title='$title' class='solarfc' width='$width' style='margin:1px; vertical-align:middle align:center; padding-bottom:1px;'>$val</td>"; $ret .= "<td title='$title' class='solarfc' width='$width' style='margin:1px; vertical-align:middle align:center; padding-bottom:1px;'>$val</td>";
} #}
else { # mit $hfcg->{$i}{weather} = undef kann man unten leicht feststellen ob für diese Spalte bereits ein Icon ausgegeben wurde oder nicht #else { # mit $hfcg->{$i}{weather} = undef kann man unten leicht feststellen ob für diese Spalte bereits ein Icon ausgegeben wurde oder nicht
$ret .= "<td></td>"; # $ret .= "<td></td>";
$hfcg->{$i}{weather} = undef; # ToDo : prüfen ob noch nötig # $hfcg->{$i}{weather} = undef; # ToDo : prüfen ob noch nötig
} #}
} }
$ret .= "<td class='solarfc'></td></tr>"; # freier Platz am Ende der Icon Zeile $ret .= "<td class='solarfc'></td></tr>"; # freier Platz am Ende der Icon Zeile