mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
eventMap fixes: EnOcean and translation both should work with the on:off toggle
git-svn-id: https://svn.fhem.de/fhem/trunk@1727 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
099c95f98a
commit
d8bb67aff8
@ -2542,7 +2542,8 @@ ReplaceEventMap($$$)
|
|||||||
{
|
{
|
||||||
my ($dev, $str, $dir) = @_;
|
my ($dev, $str, $dir) = @_;
|
||||||
my $em = $attr{$dev}{eventMap};
|
my $em = $attr{$dev}{eventMap};
|
||||||
return $str if(!$em || (!$dir && $str->[1] eq "?"));
|
return $str if($dir && !$em);
|
||||||
|
return @{$str} if(!$dir && (!$em || $str->[1] eq "?"));
|
||||||
my $dname = shift @{$str} if(!$dir);
|
my $dname = shift @{$str} if(!$dir);
|
||||||
|
|
||||||
my $nstr = join(" ", @{$str}) if(!$dir);
|
my $nstr = join(" ", @{$str}) if(!$dir);
|
||||||
|
@ -653,8 +653,7 @@ FW_doDetail($)
|
|||||||
FW_pO "<table>";
|
FW_pO "<table>";
|
||||||
foreach my $cmd (split(":", $webCmd)) {
|
foreach my $cmd (split(":", $webCmd)) {
|
||||||
FW_pO "<tr>";
|
FW_pO "<tr>";
|
||||||
FW_pH "cmd.$d=set $d $cmd&detail=$d",
|
FW_pH "cmd.$d=set $d $cmd&detail=$d", $cmd, 1, "col1";
|
||||||
ReplaceEventMap($d,$cmd,1), 1, "col1";
|
|
||||||
FW_pO "</tr>";
|
FW_pO "</tr>";
|
||||||
}
|
}
|
||||||
FW_pO "</table>";
|
FW_pO "</table>";
|
||||||
@ -903,7 +902,6 @@ FW_showRoom()
|
|||||||
FW_pO "</td>";
|
FW_pO "</td>";
|
||||||
if($cmdlist) {
|
if($cmdlist) {
|
||||||
my @cList = split(":", $cmdlist);
|
my @cList = split(":", $cmdlist);
|
||||||
my @rList = map { ReplaceEventMap($d,$_,1) } @cList;
|
|
||||||
my $firstIdx = 0;
|
my $firstIdx = 0;
|
||||||
|
|
||||||
# Special handling (slider, dropdown)
|
# Special handling (slider, dropdown)
|
||||||
@ -952,8 +950,7 @@ FW_showRoom()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(my $idx=$firstIdx; $idx < @cList; $idx++) {
|
for(my $idx=$firstIdx; $idx < @cList; $idx++) {
|
||||||
FW_pH "cmd.$d=set $d $cList[$idx]$rf",
|
FW_pH "cmd.$d=set $d $cList[$idx]$rf", $cList[$idx], 1,"col3";
|
||||||
ReplaceEventMap($d,$cList[$idx],1),1,"col3";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1879,18 +1876,24 @@ sub
|
|||||||
FW_dev2image($)
|
FW_dev2image($)
|
||||||
{
|
{
|
||||||
my ($name) = @_;
|
my ($name) = @_;
|
||||||
my $icon = "";
|
my $d = $defs{$name};
|
||||||
return $icon if(!$name || !$defs{$name});
|
return "" if(!$name || !$d);
|
||||||
|
|
||||||
my ($type, $state) = ($defs{$name}{TYPE}, $defs{$name}{STATE});
|
my ($type, $state) = ($d->{TYPE}, $d->{STATE});
|
||||||
return $icon if(!$type || !defined($state));
|
return "" if(!$type || !$state);
|
||||||
|
|
||||||
|
my (undef, $rstate) = ReplaceEventMap($name, [undef, $state], 0);
|
||||||
$state =~ s/ .*//; # Want to be able to have icons for "on-for-timer xxx"
|
$state =~ s/ .*//; # Want to be able to have icons for "on-for-timer xxx"
|
||||||
$icon = $FW_icons{$state} if(defined($FW_icons{$state}));# on.png
|
|
||||||
$icon = $FW_icons{$type} if($FW_icons{$type}); # FS20.png
|
my $icon;
|
||||||
$icon = $FW_icons{"$type.$state"} if($FW_icons{"$type.$state"}); # FS20.on.png
|
$icon = $FW_icons{"$name.$state"} if(!$icon); # lamp.Aus.png
|
||||||
$icon = $FW_icons{$name} if($FW_icons{$name}); # lamp.png
|
$icon = $FW_icons{"$name.$rstate"} if(!$icon); # lamp.on.png
|
||||||
$icon = $FW_icons{"$name.$state"} if($FW_icons{"$name.$state"}); # lamp.on.png
|
$icon = $FW_icons{$name} if(!$icon); # lamp.png
|
||||||
|
$icon = $FW_icons{"$type.$state"} if(!$icon); # FS20.Aus.png
|
||||||
|
$icon = $FW_icons{"$type.$rstate"} if(!$icon); # FS20.on.png
|
||||||
|
$icon = $FW_icons{$type} if(!$icon); # FS20.png
|
||||||
|
$icon = $FW_icons{$state} if(!$icon); # Aus.png
|
||||||
|
$icon = $FW_icons{$rstate} if(!$icon); # on.png
|
||||||
return $icon;
|
return $icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2068,10 +2071,11 @@ FW_devState($$)
|
|||||||
$cmdlist = $webCmd;
|
$cmdlist = $webCmd;
|
||||||
|
|
||||||
} elsif($hasOnOff && !$cmdlist) {
|
} elsif($hasOnOff && !$cmdlist) {
|
||||||
my (undef, $nstate) = ReplaceEventMap($d, [$d, $state], 0);
|
# Have to cover: "on:An off:Aus", "A0:Aus AI:An Aus:off An:on"
|
||||||
$nstate = $state if(!defined($nstate));
|
my $on = ReplaceEventMap($d, "on", 1);
|
||||||
$link = "cmd.$d=set $d " . ($nstate eq "on" ? "off" : "on");
|
my $off = ReplaceEventMap($d, "off", 1);
|
||||||
$cmdlist = "on:off";
|
$link = "cmd.$d=set $d " . ($state eq $on ? $off : $on);
|
||||||
|
$cmdlist = "$on:$off";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user