2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

76_Solarforcast: contrib 0.50.0

git-svn-id: https://svn.fhem.de/fhem/trunk@24563 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2021-06-02 05:10:41 +00:00
parent a5f513d048
commit 65c01dca6a

View File

@ -2674,28 +2674,28 @@ sub ___switchonTimelimits {
my $starttime = $paref->{starttime};
my $origtime = $starttime;
my $notbefore = ConsumerVal ($hash, $c, "notbefore", "");
my $notafter = ConsumerVal ($hash, $c, "notafter", "");
my $notbefore = ConsumerVal ($hash, $c, "notbefore", 0);
my $notafter = ConsumerVal ($hash, $c, "notafter", 0);
my ($starthour) = $starttime =~ /\s(\d{2}):/xs;
my $subst;
my $change = q{};
if(int $starthour < int $notbefore) {
if($notbefore && int $starthour < int $notbefore) {
$starthour = $notbefore;
$subst = 1;
$change = "notbefore";
}
if(int $starthour > int $notafter) {
if($notafter && int $starthour > int $notafter) {
$starthour = $notafter;
$subst = 1;
$change = "notafter";
}
$starthour = sprintf("%02d", $starthour);
$starttime =~ s/\s(\d{2}):/ $starthour:/x;
if($subst) {
if($change) {
my $cname = ConsumerVal ($hash, $c, "name", "");
Log3 ($name, 4, qq{$name - Planned starttime "$cname" changed from "$origtime" to "$starttime" due to notbefore/notafter conditions});
Log3 ($name, 4, qq{$name - Planned starttime "$cname" changed from "$origtime" to "$starttime" due to $change conditions});
}
return $starttime;