From 7c4caae9b3734e6f0ddd597d987bf95ca9e52fef Mon Sep 17 00:00:00 2001
From: rudolfkoenig <>
Date: Fri, 16 Sep 2022 18:15:35 +0000
Subject: [PATCH] MQTT2_SERVER/MQTT2_CLIENT: addd topicConversion attribute
(Forum #129206)
git-svn-id: https://svn.fhem.de/fhem/trunk@26405 2b470e98-0d58-463d-a4d8-8e2adae1ed80
---
fhem/FHEM/00_MQTT2_CLIENT.pm | 14 +++++++++++---
fhem/FHEM/00_MQTT2_SERVER.pm | 14 +++++++++++---
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/fhem/FHEM/00_MQTT2_CLIENT.pm b/fhem/FHEM/00_MQTT2_CLIENT.pm
index 9a284f273..9c503ca39 100644
--- a/fhem/FHEM/00_MQTT2_CLIENT.pm
+++ b/fhem/FHEM/00_MQTT2_CLIENT.pm
@@ -56,6 +56,7 @@ MQTT2_CLIENT_Initialize($)
subscriptions
SSL
sslargs
+ topicConversion:0,1
username
);
use warnings 'qw';
@@ -517,7 +518,7 @@ MQTT2_CLIENT_Read($@)
}
$val = substr($pl, $off);
if($unicodeEncoding) {
- if(!$hash->{binaryTopicRegexp} || $tp !~ m/^$hash->{binaryTopicRegexp}$/) {
+ if(!$hash->{binaryTopicRegexp} || $tp !~ m/^$hash->{binaryTopicRegexp}$/){
$val = Encode::decode('UTF-8', $val);
}
}
@@ -530,10 +531,10 @@ MQTT2_CLIENT_Read($@)
my $ir = AttrVal($name, "ignoreRegexp", undef);
if(!defined($ir) || "$tp:$val" !~ m/$ir/) {
my $ac = AttrVal($name, "autocreate", "no");
- $ac = $ac eq "1" ? "simple" : ($ac eq "0" ? "no" : $ac); # backward comp.
+ $ac = $ac eq "1" ? "simple" : ($ac eq "0" ? "no" : $ac); #backward comp.
my $cid = makeDeviceName($hash->{clientId});
- $tp =~ s/:/_/g; # 96608
+ $tp =~ s/:/_/g if(AttrVal($name, "topicConversion", 1)); # 96608
Dispatch($hash, "autocreate=$ac\0$cid\0$tp\0$val", undef, $ac eq "no");
my $re = AttrVal($name, "rawEvents", undef);
@@ -942,6 +943,13 @@ MQTT2_CLIENT_feedTheList($$$)
possible options documented in perldoc IO::Socket::SSL
+
+