mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-20 01:06:04 +00:00
76_SolarForecast: contrib 1.49.5
git-svn-id: https://svn.fhem.de/fhem/trunk@29810 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
5b6e2e20e7
commit
c8ab9192fa
@ -6282,27 +6282,21 @@ sub _attraiControl { ## no critic "not used"
|
|||||||
my $aVal = $paref->{aVal};
|
my $aVal = $paref->{aVal};
|
||||||
my $cmd = $paref->{cmd};
|
my $cmd = $paref->{cmd};
|
||||||
|
|
||||||
my $hash = $defs{$name};
|
my $valid = {
|
||||||
|
aiStorageDuration => { comp => '\d+', act => 0 },
|
||||||
for my $av ( qw( aiStorageDuration
|
aiTrainStart => { comp => '(1?[1-9]|10|2[0-3])', act => 0 },
|
||||||
aiTrainStart
|
aiTreesPV => { comp => '(1?[1-9]|10|[2-4][0-9]|50)', act => 0 },
|
||||||
aiTreesPV
|
};
|
||||||
) ) {
|
|
||||||
|
|
||||||
|
for my $av (keys %{$valid}) {
|
||||||
delete $data{$name}{current}{$av};
|
delete $data{$name}{current}{$av};
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cmd eq 'set') {
|
|
||||||
my $valid = {
|
|
||||||
aiStorageDuration => '\d+',
|
|
||||||
aiTrainStart => '(1?[1-9]|10|2[0-3])',
|
|
||||||
aiTreesPV => '(1?[1-9]|10|[2-4][0-9]|50)',
|
|
||||||
};
|
|
||||||
|
|
||||||
my ($a, $h) = parseParams ($aVal);
|
my ($a, $h) = parseParams ($aVal);
|
||||||
|
|
||||||
|
if ($cmd eq 'set') {
|
||||||
for my $key (keys %{$h}) {
|
for my $key (keys %{$h}) {
|
||||||
my $comp = $valid->{$key};
|
my $comp = $valid->{$key}{comp};
|
||||||
next if(!$comp);
|
next if(!$comp);
|
||||||
|
|
||||||
if ($h->{$key} =~ /^$comp$/xs) {
|
if ($h->{$key} =~ /^$comp$/xs) {
|
||||||
@ -6314,6 +6308,18 @@ sub _attraiControl { ## no critic "not used"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for my $akey (keys %{$h}) { # von bestimmten Schlüsseln abhängige Aktionen ausführen
|
||||||
|
next if(!$valid->{$akey}{act});
|
||||||
|
|
||||||
|
$paref->{akey} = $akey;
|
||||||
|
$paref->{keyval} = $h->{$akey};
|
||||||
|
|
||||||
|
__attrKeyAction ($paref);
|
||||||
|
|
||||||
|
delete $paref->{keyval};
|
||||||
|
delete $paref->{akey};
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6326,35 +6332,26 @@ sub _attrplantControl { ## no critic "not used"
|
|||||||
my $aVal = $paref->{aVal};
|
my $aVal = $paref->{aVal};
|
||||||
my $cmd = $paref->{cmd};
|
my $cmd = $paref->{cmd};
|
||||||
|
|
||||||
my $hash = $defs{$name};
|
my $valid = {
|
||||||
|
backupFilesKeep => { comp => '\d+', act => 0 },
|
||||||
for my $av ( qw( backupFilesKeep
|
batteryPreferredCharge => { comp => '([0-9]|[1-9][0-9]|100)', act => 0 },
|
||||||
batteryPreferredCharge
|
consForecastIdentWeekdays => { comp => '(0|1)', act => 0 },
|
||||||
consForecastIdentWeekdays
|
consForecastLastDays => { comp => '([1-9]|[1-9][0-9]|1[0-7][0-9]|180)', act => 0 },
|
||||||
consForecastLastDays
|
consForecastInPlanning => { comp => '(0|1)', act => 0 },
|
||||||
consForecastInPlanning
|
feedinPowerLimit => { comp => '\d+', act => 0 },
|
||||||
feedinPowerLimit
|
interval => { comp => '\d+', act => 1 },
|
||||||
showLink
|
showLink => { comp => '(0|1)', act => 0 },
|
||||||
) ) {
|
};
|
||||||
|
|
||||||
|
for my $av (keys %{$valid}) {
|
||||||
delete $data{$name}{current}{$av};
|
delete $data{$name}{current}{$av};
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cmd eq 'set') {
|
|
||||||
my $valid = {
|
|
||||||
backupFilesKeep => '\d+',
|
|
||||||
batteryPreferredCharge => '([0-9]|[1-9][0-9]|100)',
|
|
||||||
consForecastIdentWeekdays => '(0|1)',
|
|
||||||
consForecastLastDays => '([1-9]|[1-9][0-9]|1[0-7][0-9]|180)',
|
|
||||||
consForecastInPlanning => '(0|1)',
|
|
||||||
feedinPowerLimit => '\d+',
|
|
||||||
showLink => '(0|1)',
|
|
||||||
};
|
|
||||||
|
|
||||||
my ($a, $h) = parseParams ($aVal);
|
my ($a, $h) = parseParams ($aVal);
|
||||||
|
|
||||||
|
if ($cmd eq 'set') {
|
||||||
for my $key (keys %{$h}) {
|
for my $key (keys %{$h}) {
|
||||||
my $comp = $valid->{$key};
|
my $comp = $valid->{$key}{comp};
|
||||||
next if(!$comp);
|
next if(!$comp);
|
||||||
|
|
||||||
if ($h->{$key} =~ /^$comp$/xs) {
|
if ($h->{$key} =~ /^$comp$/xs) {
|
||||||
@ -6366,6 +6363,18 @@ sub _attrplantControl { ## no critic "not used"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for my $akey (keys %{$h}) { # von bestimmten Schlüsseln abhängige Aktionen ausführen
|
||||||
|
next if(!$valid->{$akey}{act});
|
||||||
|
|
||||||
|
$paref->{akey} = $akey;
|
||||||
|
$paref->{keyval} = $h->{$akey};
|
||||||
|
|
||||||
|
__attrKeyAction ($paref);
|
||||||
|
|
||||||
|
delete $paref->{keyval};
|
||||||
|
delete $paref->{akey};
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6883,6 +6892,29 @@ sub _attrgraphicBeamXContent { ## no critic "not used"
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# von bestimmten Schlüsseln abhängige Aktionen ausführen
|
||||||
|
################################################################
|
||||||
|
sub __attrKeyAction {
|
||||||
|
my $paref = shift;
|
||||||
|
my $name = $paref->{name};
|
||||||
|
my $akey = $paref->{akey};
|
||||||
|
my $keyval = $paref->{keyval};
|
||||||
|
my $cmd = $paref->{cmd};
|
||||||
|
|
||||||
|
my $hash = $defs{$name};
|
||||||
|
|
||||||
|
if ($cmd eq 'set') {
|
||||||
|
if ($init_done && $akey eq 'interval') {
|
||||||
|
_newCycTime ($hash, time, $keyval);
|
||||||
|
my $nct = CurrentVal ($name, 'nextCycleTime', 0); # gespeicherte nächste CyleTime
|
||||||
|
readingsSingleUpdate ($hash, 'nextCycletime', (!$nct ? 'Manual / Event-controlled' : FmtTime($nct)), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# Attr setupRadiationAPI und setupWeatherDev1
|
# Attr setupRadiationAPI und setupWeatherDev1
|
||||||
# harmonisieren wenn erforderlich
|
# harmonisieren wenn erforderlich
|
||||||
|
Loading…
x
Reference in New Issue
Block a user