Fix toggle on eventmap

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@1400 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2012-03-31 08:11:24 +00:00
parent 712301072f
commit ca67602045

View File

@ -1998,21 +1998,27 @@ FW_devState($$)
my ($d, $rf) = @_; my ($d, $rf) = @_;
my ($allSets, $hasOnOff, $cmdlist, $link); my ($allSets, $hasOnOff, $cmdlist, $link);
my $webCmd = AttrVal($d, "webCmd", undef); my $webCmd = AttrVal($d, "webCmd", "");
if(!$webCmd) {
$allSets = " " . getAllSets($d) . " ";
$hasOnOff = ($allSets =~ m/ on / && $allSets =~ m/ off /);
if(!$hasOnOff) { # Check the eventMap
my $em = AttrVal($d, "eventMap", "") . " ";
$hasOnOff = ($em =~ m/:on\b/ && $em =~ m/:off\b/);
}
}
my $state = $defs{$d}{STATE}; my $state = $defs{$d}{STATE};
$state = "" if(!defined($state)); $state = "" if(!defined($state));
my $txt = $state; my $txt = $state;
if(!$webCmd) {
$allSets = " " . getAllSets($d) . " ";
$hasOnOff = ($allSets =~ m/ on / && $allSets =~ m/ off /);
my $em = AttrVal($d, "eventMap", "");
if($em) {
if(!$hasOnOff) {
$em .= " ";
$hasOnOff = ($em =~ m/:on\b/ && $em =~ m/:off\b/);
} else {
(undef, $state) = ReplaceEventMap($d,[$d, $state],0);
}
}
}
if(defined(AttrVal($d, "showtime", undef))) { if(defined(AttrVal($d, "showtime", undef))) {
my $v = $defs{$d}{READINGS}{state}{TIME}; my $v = $defs{$d}{READINGS}{state}{TIME};
$txt = $v if(defined($v)); $txt = $v if(defined($v));