Browse Source

Merge pull request #890 from mcspr/mqtt-sub

Migrate from {identifier} to {hostname}
rfm69
Xose Pérez 6 years ago
committed by GitHub
parent
commit
61c61e858c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
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

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

+ 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