mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-21 20:06:18 +00:00
EventSpecial has problems with ECMDDevice.
git-svn-id: https://svn.fhem.de/fhem/trunk@1396 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1a409283bf
commit
b287ba0f88
63
fhem/fhem.pl
63
fhem/fhem.pl
@ -2079,42 +2079,43 @@ SemicolonEscape($)
|
|||||||
sub
|
sub
|
||||||
EvalSpecials($%)
|
EvalSpecials($%)
|
||||||
{
|
{
|
||||||
# The character % will be replaced with the received event,
|
# The character % will be replaced with the received event,
|
||||||
# e.g. with on or off or measured-temp: 21.7 (Celsius)
|
# e.g. with on or off or measured-temp: 21.7 (Celsius)
|
||||||
# The character @ will be replaced with the device name.
|
# The character @ will be replaced with the device name.
|
||||||
# To use % or @ in the text itself, use the double mode (%% or @@).
|
# To use % or @ in the text itself, use the double mode (%% or @@).
|
||||||
# Instead of % and @, the parameters %EVENT (same as %),
|
# Instead of % and @, the parameters %EVENT (same as %),
|
||||||
# %NAME (same as @) and %TYPE (contains the device type, e.g. FHT)
|
# %NAME (same as @) and %TYPE (contains the device type, e.g. FHT)
|
||||||
# can be used. A single % looses its special meaning if any of these
|
# can be used. A single % looses its special meaning if any of these
|
||||||
# parameters appears in the definition.
|
# parameters appears in the definition.
|
||||||
|
my ($exec, %specials)= @_;
|
||||||
|
$exec = SemicolonEscape($exec);
|
||||||
|
|
||||||
my ($exec, %specials)= @_;
|
$exec =~ s/%%/____/g;
|
||||||
$exec = SemicolonEscape($exec);
|
|
||||||
|
|
||||||
$exec =~ s/%%/____/g;
|
# %EVTPART due to HM remote logic
|
||||||
|
my $idx = 0;
|
||||||
|
if(defined($specials{"%EVENT"})) {
|
||||||
|
foreach my $part (split(" ", $specials{"%EVENT"})) {
|
||||||
|
$specials{"%EVTPART$idx"} = $part;
|
||||||
|
$idx++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# %EVTPART due to HM remote logic
|
# perform macro substitution
|
||||||
my $idx = 0;
|
my $extsyntax= 0;
|
||||||
foreach my $part (split(" ", $specials{"%EVENT"})) {
|
foreach my $special (keys %specials) {
|
||||||
$specials{"%EVTPART$idx"} = $part;
|
$extsyntax+= ($exec =~ s/$special/$specials{$special}/g);
|
||||||
$idx++;
|
}
|
||||||
}
|
if(!$extsyntax) {
|
||||||
|
$exec =~ s/%/$specials{"%EVENT"}/g;
|
||||||
|
}
|
||||||
|
$exec =~ s/____/%/g;
|
||||||
|
|
||||||
# perform macro substitution
|
$exec =~ s/@@/____/g;
|
||||||
my $extsyntax= 0;
|
$exec =~ s/@/$specials{"%NAME"}/g;
|
||||||
foreach my $special (keys %specials) {
|
$exec =~ s/____/@/g;
|
||||||
$extsyntax+= ($exec =~ s/$special/$specials{$special}/g);
|
|
||||||
}
|
|
||||||
if(!$extsyntax) {
|
|
||||||
$exec =~ s/%/$specials{"%EVENT"}/g;
|
|
||||||
}
|
|
||||||
$exec =~ s/____/%/g;
|
|
||||||
|
|
||||||
$exec =~ s/@@/____/g;
|
return $exec;
|
||||||
$exec =~ s/@/$specials{"%NAME"}/g;
|
|
||||||
$exec =~ s/____/@/g;
|
|
||||||
|
|
||||||
return $exec;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user