Slider: "on/off" causes NaN -> converted it to 0

git-svn-id: https://svn.fhem.de/fhem/trunk@2821 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2013-02-27 09:55:55 +00:00
parent fabe572563
commit 51b8e05b25
2 changed files with 3 additions and 0 deletions

View File

@@ -1088,6 +1088,7 @@ FW_showRoom()
my $cv = ReadingsVal($d, $cmd, Value($d)); my $cv = ReadingsVal($d, $cmd, Value($d));
$cmd = "" if($cmd eq "state"); $cmd = "" if($cmd eq "state");
$cv =~ s/.*?(\d+).*/$1/; # get first number $cv =~ s/.*?(\d+).*/$1/; # get first number
$cv = 0 if($cv !~ m/\d/);
FW_pO "<td colspan='2'>". FW_pO "<td colspan='2'>".
"<div class='slider' id='slider.$d' ". "<div class='slider' id='slider.$d' ".
"min='$min' stp='$stp' max='$max' ". "min='$min' stp='$stp' max='$max' ".

View File

@@ -60,6 +60,8 @@ FW_doUpdate()
} }
if(doSet) { if(doSet) {
var val = d[1].replace(/^.*?(\d+).*/g, "$1"); // get first number var val = d[1].replace(/^.*?(\d+).*/g, "$1"); // get first number
if(!val.match(/\d+/))
val = 0;
Slider(el, val); Slider(el, val);
} }
} }