mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 04:36:36 +00:00
SetExtensions.pm: fix the EnOcean on/off eventMap (Forum #95589)
git-svn-id: https://svn.fhem.de/fhem/trunk@18197 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
79376fdcc0
commit
12ab1e3b0a
@ -68,10 +68,11 @@ SetExtensions($$@)
|
||||
($list =~ m/(^| )$uCmd\b/ ? $uCmd : ""));
|
||||
}
|
||||
|
||||
# Must work with EnOceans "attr x eventMap BI:off B0:on"
|
||||
sub
|
||||
getReplCmd($$)
|
||||
{
|
||||
my ($name, $cmd);
|
||||
my ($name, $cmd) = @_;
|
||||
my (undef,$value) = ReplaceEventMap($name, [$name, $cmd], 0);
|
||||
return $cmd if($value ne $cmd);
|
||||
|
||||
@ -85,15 +86,19 @@ SetExtensions($$@)
|
||||
my $offCmd = getCmd($list, "off");
|
||||
|
||||
my $eventMap = AttrVal($name, "eventMap", undef);
|
||||
my $fixedIt;
|
||||
if((!$onCmd || !$offCmd) && $eventMap) {
|
||||
$onCmd = getReplCmd($name, "on") if(!$onCmd);
|
||||
$offCmd = getReplCmd($name, "off") if(!$offCmd && $onCmd);
|
||||
$fixedIt = 1;
|
||||
}
|
||||
|
||||
if(!$onCmd || !$offCmd) { # No extension
|
||||
return AttrTemplate_Set($hash, $list, $name, $cmd, @a);
|
||||
}
|
||||
|
||||
$cmd = ReplaceEventMap($name, $cmd, 1) if($fixedIt);
|
||||
|
||||
if(!defined($se_list{$cmd})) {
|
||||
# Add only "new" commands
|
||||
my @mylist = grep { $list !~ m/\b$_\b/ } keys %se_list;
|
||||
|
Loading…
x
Reference in New Issue
Block a user