Skip to content

Commit

Permalink
Replace {identifier} with {hostname}
Browse files Browse the repository at this point in the history
  • Loading branch information
mcspr committed May 27, 2018
1 parent f37b15c commit 65481c2
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 @@ -1001,6 +1001,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 65481c2

Please sign in to comment.