diff --git a/fhem/FHEM/10_MQTT2_DEVICE.pm b/fhem/FHEM/10_MQTT2_DEVICE.pm index 1c0f759da..27e532a08 100644 --- a/fhem/FHEM/10_MQTT2_DEVICE.pm +++ b/fhem/FHEM/10_MQTT2_DEVICE.pm @@ -174,15 +174,19 @@ MQTT2_DEVICE_Parse($$) next if(!$hash); my $reRepl = $re; map { $reRepl =~ s/\$$_/$hash->{".DT"}{$_}/g } keys %{$hash->{".DT"}}; - next if(!("$topic:$value" =~ m/^$reRepl$/s || - "$cid:$topic:$value" =~ m/^$reRepl$/s)); + + my @matched = ("$topic:$value" =~ m/^$reRepl$/sg); # 143401 + @matched = ("$cid:$topic:$value" =~ m/^$reRepl$/sg) if(!@matched); + next if(!@matched); + next if(IsDisabled($dev)); Log3 $dev, 4, "MQTT2_DEVICE_Parse: $dev $topic => $code"; if($code =~ m/^{.*}$/s) { my %v = ("%TOPIC"=>$topic, "%EVENT"=>$value, "%NAME"=>$hash->{NAME}, - "%CID"=>$cid, "%JSONMAP","\$defs{\"$dev\"}{JSONMAP}"); + "%CID"=>$cid, "%JSONMAP","\$defs{\"$dev\"}{JSONMAP}", + "%MATCHED"=>\@matched); map { $v{"%$_"} = $hash->{".DT"}{$_} } keys %{$hash->{".DT"}}; $code = EvalSpecials($code, %v); my $ret = AnalyzePerlCommand(undef, $code); @@ -1136,7 +1140,11 @@ zigbee2mqtt_devStateIcon255($;$$)