From ca67602045b6f471dcbd0b62917e0853fa8477da Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sat, 31 Mar 2012 08:11:24 +0000 Subject: [PATCH] Fix toggle on eventmap git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@1400 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- webfrontend/pgm2/01_FHEMWEB.pm | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/webfrontend/pgm2/01_FHEMWEB.pm b/webfrontend/pgm2/01_FHEMWEB.pm index 292ac0667..ee74e872d 100755 --- a/webfrontend/pgm2/01_FHEMWEB.pm +++ b/webfrontend/pgm2/01_FHEMWEB.pm @@ -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));