10_pilight_ctrl: FIX: handling ContactAsSwitch befor white list check

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@9232 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
risiko79 2015-09-11 17:30:45 +00:00
parent c73d6f4000
commit 58f137f146

View File

@ -1,5 +1,5 @@
############################################## ##############################################
# $Id: 10_pilight_ctrl.pm 1.11 2015-09-06 Risiko $ # $Id: 10_pilight_ctrl.pm 1.12 2015-09-11 Risiko $
# #
# Usage # Usage
# #
@ -36,6 +36,7 @@
# V 1.09 2015-07-21 - NEW: support submodule pilight_raw to send raw codes # V 1.09 2015-07-21 - NEW: support submodule pilight_raw to send raw codes
# V 1.10 2015-08-30 - NEW: support pressure, windavg, winddir, windgust from weather stations and GPIO sensors # V 1.10 2015-08-30 - NEW: support pressure, windavg, winddir, windgust from weather stations and GPIO sensors
# V 1.11 2015-09-06 - FIX: pressure, windavg, winddir, windgust from weather stations without temperature # V 1.11 2015-09-06 - FIX: pressure, windavg, winddir, windgust from weather stations without temperature
# V 1.12 2015-09-11 - FIX: handling ContactAsSwitch befor white list check
############################################## ##############################################
package main; package main;
@ -752,6 +753,15 @@ sub pilight_ctrl_Parse($$)
last if ($unit ne ""); last if ($unit ne "");
} }
# handling ContactAsSwitch befor white list check
my $asSwitch = $attr{$me}{ContactAsSwitch};
if ( defined($asSwitch) && $proto =~ /contact/ && $asSwitch =~ /$id/) {
$proto =~ s/contact/switch/g;
$state =~ s/opened/on/g;
$state =~ s/closed/off/g;
Log3 $me, 5, "$me(Parse): contact as switch for $id";
}
my @ignoreIDs = split(",",AttrVal($me, "ignoreProtocol","")); my @ignoreIDs = split(",",AttrVal($me, "ignoreProtocol",""));
# white or ignore list # white or ignore list
@ -828,17 +838,7 @@ sub pilight_ctrl_Parse($$)
$msg.= ",$dimlevel" if ($dimlevel ne ""); $msg.= ",$dimlevel" if ($dimlevel ne "");
return Dispatch($hash, $msg ,undef); return Dispatch($hash, $msg ,undef);
} }
case 3 { case 3 {return;}
my $asSwitch = $attr{$me}{ContactAsSwitch};
if ( defined($asSwitch) && $asSwitch =~ /$id/) {
$proto =~ s/contact/switch/g;
$state =~ s/opened/on/g;
$state =~ s/closed/off/g;
Log3 $me, 5, "$me(Parse): contact as switch for $id";
return Dispatch($hash, "PISWITCH,$proto,$id,$unit,$state",undef);
}
return;
}
case 4 { case 4 {
my $piTempData = ""; my $piTempData = "";
$piTempData .= ",temperature:$data->{$s}{temperature}" if (defined($data->{$s}{temperature})); $piTempData .= ",temperature:$data->{$s}{temperature}" if (defined($data->{$s}{temperature}));