mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-16 10:46:03 +00:00
76_SolarForecast: contrib 0.82.0
git-svn-id: https://svn.fhem.de/fhem/trunk@27924 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
544c328125
commit
d94c4fb830
@ -1130,6 +1130,7 @@ sub _readCacheFile {
|
|||||||
my ($err, $dtree) = fileRetrieve ($file);
|
my ($err, $dtree) = fileRetrieve ($file);
|
||||||
|
|
||||||
if (!$err && $dtree) {
|
if (!$err && $dtree) {
|
||||||
|
return if($t2sabs); # Modul Test2::Suite ist nicht installiert
|
||||||
my $valid = isa_ok($dtree, 'AI::DecisionTree');
|
my $valid = isa_ok($dtree, 'AI::DecisionTree');
|
||||||
|
|
||||||
if ($valid == 1) {
|
if ($valid == 1) {
|
||||||
@ -10514,8 +10515,10 @@ sub aiAddInstance { ## no critic "not used"
|
|||||||
$wcc = HistoryVal ($hash, $pvd, $hod, 'wcc', 0);
|
$wcc = HistoryVal ($hash, $pvd, $hod, 'wcc', 0);
|
||||||
$wrp = HistoryVal ($hash, $pvd, $hod, 'wrp', 0);
|
$wrp = HistoryVal ($hash, $pvd, $hod, 'wrp', 0);
|
||||||
|
|
||||||
|
my $tbin = temp2bin ($temp);
|
||||||
|
|
||||||
eval { $dtree->add_instance (attributes => { rad1h => $rad1h,
|
eval { $dtree->add_instance (attributes => { rad1h => $rad1h,
|
||||||
temp => $temp,
|
temp => $tbin,
|
||||||
wcc => $wcc,
|
wcc => $wcc,
|
||||||
wrp => $wrp,
|
wrp => $wrp,
|
||||||
hod => $hod
|
hod => $hod
|
||||||
@ -10530,7 +10533,7 @@ sub aiAddInstance { ## no critic "not used"
|
|||||||
|
|
||||||
$data{$type}{$name}{current}{aiaddistate} = 'ok';
|
$data{$type}{$name}{current}{aiaddistate} = 'ok';
|
||||||
|
|
||||||
debugLog ($paref, 'aiProcess', qq{AI Instance added - day: $pvd, hod: $hod, rad1h: $rad1h, pvrl: $pvrl, wcc: $wcc, wrp: $wrp, temp: $temp});
|
debugLog ($paref, 'aiProcess', qq{AI Instance added - day: $pvd, hod: $hod, rad1h: $rad1h, pvrl: $pvrl, wcc: $wcc, wrp: $wrp, temp: $tbin});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10611,10 +10614,12 @@ sub aiGetResult { ## no critic "not used"
|
|||||||
my $wrp = NexthoursVal ($hash, $nhidx, "rainprob", 0);
|
my $wrp = NexthoursVal ($hash, $nhidx, "rainprob", 0);
|
||||||
my $temp = NexthoursVal ($hash, $nhidx, "temp", 20);
|
my $temp = NexthoursVal ($hash, $nhidx, "temp", 20);
|
||||||
|
|
||||||
|
my $tbin = temp2bin ($temp);
|
||||||
|
|
||||||
my $pvaifc;
|
my $pvaifc;
|
||||||
|
|
||||||
eval { $pvaifc = $dtree->get_result (attributes => { rad1h => $rad1h,
|
eval { $pvaifc = $dtree->get_result (attributes => { rad1h => $rad1h,
|
||||||
temp => $temp,
|
temp => $tbin,
|
||||||
wcc => $wcc,
|
wcc => $wcc,
|
||||||
wrp => $wrp,
|
wrp => $wrp,
|
||||||
hod => $hod
|
hod => $hod
|
||||||
@ -10628,7 +10633,7 @@ sub aiGetResult { ## no critic "not used"
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (defined $pvaifc) {
|
if (defined $pvaifc) {
|
||||||
debugLog ($paref, 'aiData', qq{result AI: pvaifc: $pvaifc (hod: $hod, rad1h: $rad1h, wcc: $wcc, wrp: $wrp, temp: $temp)});
|
debugLog ($paref, 'aiData', qq{result AI: pvaifc: $pvaifc (hod: $hod, rad1h: $rad1h, wcc: $wcc, wrp: $wrp, temp: $tbin)});
|
||||||
return ('', $pvaifc);
|
return ('', $pvaifc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12651,6 +12656,23 @@ sub getCDnames {
|
|||||||
return ($cname, $dswname);
|
return ($cname, $dswname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# diskrete Temperaturen in "Bins" wandeln
|
||||||
|
################################################################
|
||||||
|
sub temp2bin {
|
||||||
|
my $temp = shift;
|
||||||
|
|
||||||
|
my $bin = $temp > 30 ? 'veryhot' :
|
||||||
|
$temp > 25 ? 'hot' :
|
||||||
|
$temp > 20 ? 'warm' :
|
||||||
|
$temp > 10 ? 'medium' :
|
||||||
|
$temp > 5 ? 'cool' :
|
||||||
|
$temp > 0 ? 'cold' :
|
||||||
|
'verycold';
|
||||||
|
|
||||||
|
return $bin;
|
||||||
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# verscrambelt einen String
|
# verscrambelt einen String
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user