2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-13 17:26:34 +00:00

Fix toggle on eventmap

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

View File

@ -1998,21 +1998,27 @@ FW_devState($$)
my ($d, $rf) = @_;
my ($allSets, $hasOnOff, $cmdlist, $link);
my $webCmd = AttrVal($d, "webCmd", undef);
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 $webCmd = AttrVal($d, "webCmd", "");
my $state = $defs{$d}{STATE};
$state = "" if(!defined($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))) {
my $v = $defs{$d}{READINGS}{state}{TIME};
$txt = $v if(defined($v));