Browse Source

Replace {identifier} with {hostname}

rfm69
Maxim Prokhorov 6 years ago
parent
commit
65481c23ef
2 changed files with 9 additions and 1 deletions
  1. +9
    -0
      code/espurna/migrate.ino
  2. +0
    -1
      code/espurna/mqtt.ino

+ 9
- 0
code/espurna/migrate.ino View File

@ -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();
}

+ 0
- 1
code/espurna/mqtt.ino View File

@ -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 + "/#";


Loading…
Cancel
Save