mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
98_weekprofile: reduce warning if master device has no default profile
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@10426 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
bb96840084
commit
ed8555cf71
@ -149,16 +149,29 @@ sub weekprofile_readDevProfile(@)
|
|||||||
return "" if (!defined ($type));
|
return "" if (!defined ($type));
|
||||||
|
|
||||||
my $prf = {};
|
my $prf = {};
|
||||||
|
my $logDaysWarning="";
|
||||||
|
my $logDaysCnt=0;
|
||||||
foreach my $day (@shortDays){
|
foreach my $day (@shortDays){
|
||||||
my ($dayTimes, $dayTemps) = weekprofile_readDayProfile($device,$day,$type,$me);
|
my ($dayTimes, $dayTemps) = weekprofile_readDayProfile($device,$day,$type,$me);
|
||||||
if (scalar(@{$dayTemps})==0) {
|
if (scalar(@{$dayTemps})==0) {
|
||||||
push(@{$dayTimes}, "24:00");
|
push(@{$dayTimes}, "24:00");
|
||||||
push(@{$dayTemps}, "18.0");
|
push(@{$dayTemps}, "18.0");
|
||||||
Log3 $me, 3, "WARNING master device $device has no day profile for $day - create default";
|
$logDaysWarning .= "\n" if ($logDaysCnt>0);
|
||||||
|
$logDaysWarning .= "WARNING master device $device has no day profile for $day - create default";
|
||||||
|
$logDaysCnt++;
|
||||||
}
|
}
|
||||||
$prf->{$day}->{"temp"} = $dayTemps;
|
$prf->{$day}->{"temp"} = $dayTemps;
|
||||||
$prf->{$day}->{"time"} = $dayTimes;
|
$prf->{$day}->{"time"} = $dayTimes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ($logDaysCnt>0) && ($logDaysCnt<(@shortDays)) ) {
|
||||||
|
Log3 $me, 3, $logDaysWarning;
|
||||||
|
} else {
|
||||||
|
if ($logDaysCnt == (@shortDays)) {
|
||||||
|
Log3 $me, 3, "WARNING master device $device has no week profile - create default";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $prf;
|
return $prf;
|
||||||
}
|
}
|
||||||
##############################################
|
##############################################
|
||||||
@ -253,10 +266,14 @@ sub weekprofile_sendDevProfile(@)
|
|||||||
$k++;
|
$k++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$cmd =~ s/^\s+|\s+$//g if ($cmd);
|
|
||||||
|
my $ret = undef;
|
||||||
|
if ($cmd) {
|
||||||
|
$cmd =~ s/^\s+|\s+$//g;
|
||||||
Log3 $me, 4, "$me(sendDevProfile): $cmd";
|
Log3 $me, 4, "$me(sendDevProfile): $cmd";
|
||||||
fhem($cmd);
|
$ret = fhem($cmd);
|
||||||
return undef;
|
}
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user