2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-13 23:36:37 +00:00

desired-temp list moved from FHEMWEB to the source module.

git-svn-id: https://svn.fhem.de/fhem/trunk@1193 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2012-01-20 18:12:56 +00:00
parent 7f0312f866
commit a77401b19f
3 changed files with 21 additions and 11 deletions

View File

@ -1075,6 +1075,7 @@ CUL_HM_Set($@)
}
$hash->{STATE} = $state if($state);
Log GetLogLevel($name,2), "CUL_HM set $name " . join(" ", @a[1..$#a]);
CUL_HM_ProcessCmdStack($hash) if(!$isSender);
return "";
@ -1458,10 +1459,16 @@ CUL_HM_encodeTime16($)
sub
CUL_HM_convTemp($)
{
my ($in) = @_;
return "$in is not a number" if($in !~ m/^\d+$/ && $in !~ m/\d+\.\d+$/);
return "$in is out of bounds (6 .. 30)" if($in < 6 || $in > 30);
return sprintf("%02X", $in*2);
my ($val) = @_;
my @list = map { ($_.".0", $_+0.5) } (6..30);
pop @list;
return "Invalid temperature $val, choose one of on off " . join(" ",@list)
if(!($val eq "on" || $val eq "off" ||
($val =~ m/^\d*\.?\d+$/ && $val >= 6 && $val <= 30)));
$val = 100 if($val eq "on");
$val = 0 if($val eq "off");
return sprintf("%02X", $val*2);
}
#############################

View File

@ -219,12 +219,16 @@ FHT_Set($@)
if ($cmd =~ m/-temp/) {
return "Invalid temperature, use NN.N" if($val !~ m/^\d*\.?\d+$/);
return "Invalid temperature, must between 5.5 and 30.5"
if($val < 5.5 || $val > 30.5);
my @list = map { ($_.".0", $_+0.5) } (6..30);
pop @list;
return "Invalid temperature $val, choose one of on off " . join(" ",@list)
if(!($val eq "on" || $val eq "off" ||
($val =~ m/^\d*\.?\d+$/ && $val >= 5.5 && $val <= 30.5)));
$val = 30.5 if($val eq "on");
$val = 5.5 if($val eq "off");
my $a = int($val*2);
$arg .= sprintf("%02x", $a);
$ret .= sprintf("Rounded temperature to %.1f", $a/2) if($a/2 != $val);
$val = sprintf("%.1f", $a/2);
} elsif($cmd =~ m/-from/ || $cmd =~ m/-to/) {
@ -239,7 +243,7 @@ FHT_Set($@)
} elsif($cmd eq "mode") {
return "Invalid mode, use one of " . join(" ", sort keys %m2c)
return "Invalid mode, choose one of " . join(" ", sort keys %m2c)
if(!defined($m2c{$val}));
$arg .= sprintf("%02x", $m2c{$val});

View File

@ -889,8 +889,7 @@ FW_showRoom()
$txt = ReadingsVal($d, "measured-temp", "");
$txt =~ s/ .*//;
$txt = sprintf("%2.1f", int(2*$txt)/2) if($txt =~ m/[0-9.-]/);
my @tv = map { ($_.".0", $_+0.5) } (5..30);
shift(@tv); # 5.0 is not valid
my @tv = split(" ", getAllSets("$d desired-temp"));
$txt = int($txt*20)/$txt if($txt =~ m/^[0-9].$/);
FW_pO "<td>".