2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

98_weekprofile: fix tempOff > tempOn

git-svn-id: https://svn.fhem.de/fhem/trunk@15803 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Risiko 2018-01-06 16:58:18 +00:00
parent e0a5e88f1a
commit 7d1021977c
2 changed files with 33 additions and 4 deletions

View File

@ -445,14 +445,15 @@ sub weekprofile_assignDev($)
}
if (!defined($prf)) {
my $prfDev = weekprofile_createDefaultProfile($hash);
Log3 $me, 5, "create default profile";
my $prfDev = weekprofile_createDefaultProfile($hash);
if(defined($prfDev)) {
$prf = {};
$prf->{DATA} = $prfDev;
$prf->{NAME} = 'default';
$prf->{TOPIC} = 'default';
}
$hash->{STATE} = "created";
$hash->{STATE} = "created";
}
}
if(defined($prf)) {
@ -1017,6 +1018,22 @@ sub weekprofile_Attr($$$)
$attr{$me}{$attrName} = $attrVal;
weekprofile_writeProfilesToFile($hash) if ($attrName eq 'configFile');
if ($attrName eq 'tempON') {
my $tempOFF = AttrVal($me, "tempOFF", $attrVal);
if ($tempOFF > $attrVal) {
Log3 $me, 2, "$me(weekprofile_Attr): warning: tempON must be bigger than tempOFF";
}
}
if ($attrName eq 'tempOFF') {
my $tempON = AttrVal($me, "tempON", $attrVal);
if ($tempON < $attrVal) {
Log3 $me, 2, "$me(weekprofile_Attr): warning: tempOFF must be smaller than tempON";
}
}
return undef;
}
@ -1026,6 +1043,11 @@ sub weekprofile_writeProfilesToFile(@)
my ($hash) = @_;
my $me = $hash->{NAME};
if (!defined($hash->{PROFILES})) {
Log3 $me, 4, "$me(writeProfileToFile): no pofiles to save";
return;
}
my $start = (defined($hash->{MASTERDEV})) ? 1:0;
my $prfCnt = scalar(@{$hash->{PROFILES}});
return if ($prfCnt <= $start);

View File

@ -566,12 +566,19 @@ function FW_weekprofileEditDay(widget,day)
//temp
var tempOn = widget.TEMP_ON;
var tempOff = widget.TEMP_OFF;
if (tempOn == null)
tempOn = 30;
if (tempOff == null)
tempOff = 5;
if (tempOff > tempOn)
{
var tmp = tempOn;
tempOn = tempOff;
tempOff = tmp;
}
html += "<td><select name=\"TEMP\" size=\"1\" onchange=\"FW_weekprofileTemp_chached(this)\">";
for (var k=tempOff; k <= tempOn; k+=.5)