mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 23:06:37 +00:00
10_MQTT2_DEVICE.pm: add $NAME/$DEVICETOPIC to perl@setList (Forum #96833)
git-svn-id: https://svn.fhem.de/fhem/trunk@18485 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c081ec49e0
commit
e055978c77
@ -256,7 +256,10 @@ MQTT2_buildCmd($$$)
|
|||||||
|
|
||||||
shift @{$a};
|
shift @{$a};
|
||||||
if($cmd =~ m/^{.*}$/) {
|
if($cmd =~ m/^{.*}$/) {
|
||||||
$cmd = EvalSpecials($cmd, ("%EVENT"=>join(" ",@{$a}), "%NAME"=>$hash->{NAME}));
|
$cmd = EvalSpecials($cmd,
|
||||||
|
("%EVENT" => join(" ",@{$a}),
|
||||||
|
"%NAME" => $hash->{NAME},
|
||||||
|
"%DEVICETOPIC" => $hash->{DEVICETOPIC}));
|
||||||
$cmd = AnalyzeCommandChain($hash->{CL}, $cmd);
|
$cmd = AnalyzeCommandChain($hash->{CL}, $cmd);
|
||||||
return if(!$cmd);
|
return if(!$cmd);
|
||||||
|
|
||||||
@ -272,9 +275,10 @@ MQTT2_buildCmd($$$)
|
|||||||
shift @{$a};
|
shift @{$a};
|
||||||
$cmd .= " ".join(" ",@{$a}) if(@{$a});
|
$cmd .= " ".join(" ",@{$a}) if(@{$a});
|
||||||
}
|
}
|
||||||
|
$cmd =~ s/\$NAME/$hash->{NAME}/g;
|
||||||
|
$cmd =~ s/\$DEVICETOPIC/$hash->{DEVICETOPIC}/g;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cmd =~ s/\$DEVICETOPIC/$hash->{DEVICETOPIC}/g;
|
|
||||||
return $cmd;
|
return $cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,7 +378,8 @@ MQTT2_DEVICE_Attr($$)
|
|||||||
if($par2 =~ m/^{.*}$/) {
|
if($par2 =~ m/^{.*}$/) {
|
||||||
my $ret = perlSyntaxCheck($par2,
|
my $ret = perlSyntaxCheck($par2,
|
||||||
("%TOPIC"=>1, "%EVENT"=>"0 1 2 3 4 5 6 7 8 9",
|
("%TOPIC"=>1, "%EVENT"=>"0 1 2 3 4 5 6 7 8 9",
|
||||||
"%NAME"=>$dev, "%DEVICETOPIC"=>$hash->{DEVICETOPIC},
|
"%NAME"=>$dev,
|
||||||
|
"%DEVICETOPIC"=>$hash->{DEVICETOPIC},
|
||||||
"%JSONMAP"=>""));
|
"%JSONMAP"=>""));
|
||||||
return $ret if($ret);
|
return $ret if($ret);
|
||||||
} else {
|
} else {
|
||||||
@ -383,7 +388,10 @@ MQTT2_DEVICE_Attr($$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
my $ret = perlSyntaxCheck($par2, ("%EVENT"=>"0 1 2 3 4 5 6 7 8 9"));
|
my $ret = perlSyntaxCheck($par2,
|
||||||
|
("%NAME"=>$dev,
|
||||||
|
"%EVENT"=>"0 1 2 3 4 5 6 7 8 9",
|
||||||
|
"%DEVICETOPIC"=>$dev));
|
||||||
return $ret if($ret);
|
return $ret if($ret);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -843,7 +851,8 @@ zigbee2mqtt_devStateIcon255($)
|
|||||||
<li>arguments to the set command will be appended to the message
|
<li>arguments to the set command will be appended to the message
|
||||||
published (not for the perl expression)</li>
|
published (not for the perl expression)</li>
|
||||||
<li>the command arguments are available as $EVENT, $EVTPART0, etc.,
|
<li>the command arguments are available as $EVENT, $EVTPART0, etc.,
|
||||||
bot in the perl expression and the "normal" topic variant.</li>
|
the name of the device as $NAME, both in the perl expression and the
|
||||||
|
"normal" topic variant.</li>
|
||||||
<li>the perl expression must return a string containing the topic and
|
<li>the perl expression must return a string containing the topic and
|
||||||
the message separated by a space.</li>
|
the message separated by a space.</li>
|
||||||
<li>SetExtensions is activated</li>
|
<li>SetExtensions is activated</li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user