Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
zoic21 authored Aug 29, 2024
1 parent 66ac94d commit 0f941be
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/class/mqtt2.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static function syncTopicToJeedomCloud($_local_topic = '',$_remote_topic
throw new Exception(__('Le local topic et le remonte ne peuvent etre vide',__FILE__));
}
$local_authentifications = explode(':', explode("\n", config::byKey('mqtt::password', __CLASS__))[0]);
$conf = "--- Begin autogenerate for ".$_local_topic." -> ".$_remote_topic." ---\n";
$conf = "# Begin autogenerate for ".$_local_topic." -> ".$_remote_topic."\n";
$conf .= "connection jeedom-".config::genKey(8)."\n";
$conf .= "address mqtt.jeedom.com:8883\n";
$conf .= "topic # both 0 ".$_local_topic."/ ".mb_strtolower(config::byKey('market::username'))."/".$_remote_topic."/\n";
Expand All @@ -40,8 +40,8 @@ public static function syncTopicToJeedomCloud($_local_topic = '',$_remote_topic
$conf .= "start_type automatic\n";
$conf .= "bridge_insecure true\n";
$conf .= "bridge_cafile ".__DIR__."/../config/ca_jeedom_cloud.crt\n";
$conf .= "--- End autogenerate for ".$_local_topic." -> ".$_remote_topic." ---\n";
$current_conf = preg_replace('/(--- Begin autogenerate for '.$_local_topic.' -> '.$_remote_topic.' ---)((.|\n)*)(--- End autogenerate for '.$_local_topic.' -> '.$_remote_topic.' ---)/m', "", config::byKey('mosquitto::parameters', __CLASS__));
$conf .= "# End autogenerate for ".$_local_topic." -> ".$_remote_topic."\n";
$current_conf = preg_replace('/(# Begin autogenerate for '.$_local_topic.' -> '.$_remote_topic.')((.|\n)*)(# End autogenerate for '.$_local_topic.' -> '.$_remote_topic.')/m', "", config::byKey('mosquitto::parameters', __CLASS__));
config::save('mosquitto::parameters', $current_conf."\n\n".$conf, __CLASS__);
mqtt2::installMosquitto(config::byKey('mode', 'mqtt2'));
}
Expand Down

0 comments on commit 0f941be

Please sign in to comment.