Skip to content

Commit

Permalink
Merge pull request xoseperez#890 from mcspr/mqtt-sub
Browse files Browse the repository at this point in the history
Migrate from {identifier} to {hostname}
  • Loading branch information
xoseperez authored May 29, 2018
2 parents 32a4789 + 65481c2 commit 61c61e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 9 additions & 0 deletions code/espurna/migrate.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,15 @@ void migrate() {

}

#if MQTT_SUPPORT
// Deprecated MQTT substitution
String mqttTopic = getSetting("mqttTopic", MQTT_TOPIC);
if (mqttTopic.indexOf("{identifier}") > 0) {
mqttTopic.replace("{identifier}", "{hostname}");
setSetting("mqttTopic", mqttTopic);
}
#endif

saveSettings();

}
1 change: 0 additions & 1 deletion code/espurna/mqtt.ino
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ void _mqttConfigure() {
if (_mqtt_topic.endsWith("/")) _mqtt_topic.remove(_mqtt_topic.length()-1);

// Placeholders
_mqtt_topic.replace("{identifier}", getSetting("hostname"));
_mqtt_topic.replace("{hostname}", getSetting("hostname"));
_mqtt_topic.replace("{magnitude}", "#");
if (_mqtt_topic.indexOf("#") == -1) _mqtt_topic = _mqtt_topic + "/#";
Expand Down

0 comments on commit 61c61e8

Please sign in to comment.